Package org.snmp4j.model.mapper
Class VariableBindingMapperJava
java.lang.Object
org.snmp4j.model.mapper.AbstractVariableBindingMapper<Long,BigInteger,String,GregorianCalendar,byte[]>
org.snmp4j.model.mapper.VariableBindingMapperJava
- All Implemented Interfaces:
VariableBindingMapper<Long,
BigInteger, String, GregorianCalendar, byte[]>
public class VariableBindingMapperJava
extends AbstractVariableBindingMapper<Long,BigInteger,String,GregorianCalendar,byte[]>
VariableBindingMapperJava
maps SNMP4J VariableBinding
variables
to Java native language objects and vice versa.- Version:
- 1.0
- Author:
- Frank Fock
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.snmp4j.smi.VariableBinding
fromBinary
(org.snmp4j.smi.OID oid, byte[] binaryValue) Create a SNMP4J variable binding for anOID
and a binary string value.org.snmp4j.smi.VariableBinding
fromDate
(org.snmp4j.smi.OID oid, GregorianCalendar dateValue) Create a SNMP4J variable binding for anOID
and a date value.org.snmp4j.smi.VariableBinding
Create a SNMP4J variable binding for anOID
and a long value.org.snmp4j.smi.VariableBinding
fromObject
(org.snmp4j.smi.OID oid, Object object) Create a SNMP4J variable binding for anOID
and an object value.org.snmp4j.smi.VariableBinding
fromString
(org.snmp4j.smi.OID oid, String stringValue) Create a SNMP4J variable binding for anOID
and a string value.org.snmp4j.smi.VariableBinding
fromUnsignedLong
(org.snmp4j.smi.OID oid, BigInteger unsignedLongValue) Create a SNMP4J variable binding for anOID
and an unsigned long value.byte[]
toBinary
(org.snmp4j.smi.VariableBinding variableBinding) Convert the provided variable binding to a binary value.toDate
(org.snmp4j.smi.VariableBinding variableBinding) Convert the provided variable binding to a date value.toLong
(org.snmp4j.smi.VariableBinding variableBinding) Convert the provided variable binding to a long value.Convert the provided variable binding to a value of the specified class.toString
(org.snmp4j.smi.VariableBinding variableBinding) Convert the provided variable binding to a string value.toUnsignedLong
(org.snmp4j.smi.VariableBinding variableBinding) Convert the provided variable binding to an unsigned long value.Methods inherited from class org.snmp4j.model.mapper.AbstractVariableBindingMapper
formatLong, formatString, makeCalendar, makeDateAndTime, scanLong, scanString, validateDateAndTime
-
Constructor Details
-
VariableBindingMapperJava
public VariableBindingMapperJava()
-
-
Method Details
-
toLong
Description copied from interface:VariableBindingMapper
Convert the provided variable binding to a long value.- Parameters:
variableBinding
- a SNMP4J variable binding.- Returns:
- a long value.
-
toUnsignedLong
Description copied from interface:VariableBindingMapper
Convert the provided variable binding to an unsigned long value.- Parameters:
variableBinding
- a SNMP4J variable binding.- Returns:
- an unsigned long.
-
toString
Description copied from interface:VariableBindingMapper
Convert the provided variable binding to a string value.- Parameters:
variableBinding
- a SNMP4J variable binding.- Returns:
- a string value.
-
toDate
Description copied from interface:VariableBindingMapper
Convert the provided variable binding to a date value.- Parameters:
variableBinding
- a SNMP4J variable binding.- Returns:
- a date value.
-
toBinary
public byte[] toBinary(org.snmp4j.smi.VariableBinding variableBinding) Description copied from interface:VariableBindingMapper
Convert the provided variable binding to a binary value.- Parameters:
variableBinding
- a SNMP4J variable binding.- Returns:
- a binary value.
-
toObject
Description copied from interface:VariableBindingMapper
Convert the provided variable binding to a value of the specified class.- Parameters:
variableBinding
- the SNMP4J variable binding to convert (no modification of the object itself).targetClass
- the class of the return type.- Returns:
- an instance of
targetClass
with the converted value ofvariableBinding
ornull
if the conversion failed.
-
fromLong
Description copied from interface:VariableBindingMapper
Create a SNMP4J variable binding for anOID
and a long value.- Parameters:
oid
- an OID.longValue
- a numeric long value.- Returns:
- a
VariableBinding
instance with theOID
oid
and variable that matches the SNMP type defined for that OID with the specified long value,null
will be returned if the conversion failed.
-
fromUnsignedLong
public org.snmp4j.smi.VariableBinding fromUnsignedLong(org.snmp4j.smi.OID oid, BigInteger unsignedLongValue) Description copied from interface:VariableBindingMapper
Create a SNMP4J variable binding for anOID
and an unsigned long value.- Parameters:
oid
- an OID.unsignedLongValue
- a numeric unsigned long value.- Returns:
- a
VariableBinding
instance with theOID
oid
and variable that matches the SNMP type defined for that OID with the specified unsigned long value,null
will be returned if the conversion failed.
-
fromString
Description copied from interface:VariableBindingMapper
Create a SNMP4J variable binding for anOID
and a string value.- Parameters:
oid
- an OID.stringValue
- a numeric long value.- Returns:
- a
VariableBinding
instance with theOID
oid
and variable that matches the SNMP type defined for that OID with the specified string value,null
will be returned if the conversion failed.
-
fromDate
Description copied from interface:VariableBindingMapper
Create a SNMP4J variable binding for anOID
and a date value.- Parameters:
oid
- an OID.dateValue
- a string value.- Returns:
- a
VariableBinding
instance with theOID
oid
and variable that matches the SNMP type defined for that OID with the specified date value,null
will be returned if the conversion failed.
-
fromBinary
public org.snmp4j.smi.VariableBinding fromBinary(org.snmp4j.smi.OID oid, byte[] binaryValue) Description copied from interface:VariableBindingMapper
Create a SNMP4J variable binding for anOID
and a binary string value.- Parameters:
oid
- an OID.binaryValue
- a binary string value.- Returns:
- a
VariableBinding
instance with theOID
oid
and variable that matches the SNMP type defined for that OID with the specified binary value,null
will be returned if the conversion failed.
-
fromObject
Description copied from interface:VariableBindingMapper
Create a SNMP4J variable binding for anOID
and an object value.- Parameters:
oid
- an OID.object
- an object value.- Returns:
- a
VariableBinding
instance with theOID
oid
and variable that matches the SNMP type defined for that OID with the specified object value,null
will be returned if the conversion failed.
-