Module org.snmp4j

Class VariantVariable

java.lang.Object
org.snmp4j.smi.AbstractVariable
org.snmp4j.smi.VariantVariable
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Variable>, BERSerializable, AssignableFromByteArray, AssignableFromInteger, AssignableFromLong, AssignableFromString, Variable

The VariantVariable provides a decorator for any type of Variable instance, to be able to intercept or monitor variable value modification by using a VariantVariableCallback.

This class will work for implementations that use getSyntax() method to determine the variables syntax. However "instanceof" will not work.

In contrast to the native Variable implementations, VariantVariable can be modified dynamically (i.e. while a PDU is being BER encoded where this variable has been added to) without causing BER encoding errors.

Since:
1.7
Version:
1.8
Author:
Frank Fock
See Also:
  • Constructor Details

    • VariantVariable

      public VariantVariable(Variable initialVariable)
      Creates a variant variable wrapping the specified value.
      Parameters:
      initialVariable - a Variable.
    • VariantVariable

      public VariantVariable(Variable initialVariable, VariantVariableCallback callback)
      Creates a variant variable wrapping the specified value and a callback that monitors value modifications.
      Parameters:
      initialVariable - a Variable.
      callback - a callback handler that is called before the value is to be modified and after it has been modified.
  • Method Details