Package org.snmp4j.model.mapper
Interface VariableBindingMapper<L,U,S,D,B>
- Type Parameters:
L
- the model type for signed long values.U
- the model type for unsigned long values.S
- the model type for string values.D
- the model type for date (DateAndTime) values.B
- the model type for binary values (OCTET STRING, BITS).
- All Known Implementing Classes:
AbstractVariableBindingMapper
,VariableBindingMapperJava
public interface VariableBindingMapper<L,U,S,D,B>
This
VariableBindingMapper
interface provides conversion methods
to convert VariableBinding
instances to and from signed long,
unsigned long, string, date and time, and binary values.- Version:
- 1.0
- Author:
- Frank Fock
-
Method Summary
Modifier and TypeMethodDescriptionorg.snmp4j.smi.VariableBinding
fromBinary
(org.snmp4j.smi.OID oid, B binaryValue) Create a SNMP4J variable binding for anOID
and a binary string value.org.snmp4j.smi.VariableBinding
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, S stringValue) Create a SNMP4J variable binding for anOID
and a string value.org.snmp4j.smi.VariableBinding
fromUnsignedLong
(org.snmp4j.smi.OID oid, U unsignedLongValue) Create a SNMP4J variable binding for anOID
and an unsigned long value.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.
-
Method Details
-
toLong
Convert the provided variable binding to a long value.- Parameters:
variableBinding
- a SNMP4J variable binding.- Returns:
- a long value.
-
toUnsignedLong
Convert the provided variable binding to an unsigned long value.- Parameters:
variableBinding
- a SNMP4J variable binding.- Returns:
- an unsigned long.
-
toString
Convert the provided variable binding to a string value.- Parameters:
variableBinding
- a SNMP4J variable binding.- Returns:
- a string value.
-
toDate
Convert the provided variable binding to a date value.- Parameters:
variableBinding
- a SNMP4J variable binding.- Returns:
- a date value.
-
toBinary
Convert the provided variable binding to a binary value.- Parameters:
variableBinding
- a SNMP4J variable binding.- Returns:
- a binary value.
-
toObject
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
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
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
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
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
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
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.
-