Module org.snmp4j.agent
Package org.snmp4j.agent.mo.snmp
Class DisplayString<V extends org.snmp4j.smi.OctetString>
- java.lang.Object
-
- org.snmp4j.agent.mo.MOColumn<V>
-
- org.snmp4j.agent.mo.MOMutableColumn<V>
-
- org.snmp4j.agent.mo.snmp.DisplayString<V>
-
- Type Parameters:
V
- theOctetString
subclass that defines the baseVariable
class of this display string.
- All Implemented Interfaces:
Comparable<V>
public class DisplayString<V extends org.snmp4j.smi.OctetString> extends MOMutableColumn<V>
TheDisplayString
class implements the DisplayString textual convention as defined by the SNMPv2-TC MIB specification for columnar objects.- Version:
- 3.4.1
- Author:
- Frank Fock
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DisplayString.DisplayStringValidation
TheDisplayStringValidation
can be used to validate the contents ofOctetString
variables that follow the DisplayString TC rules.
-
Constructor Summary
Constructors Constructor Description DisplayString(int columnID, MOAccess access, V defaultValue)
DisplayString(int columnID, MOAccess access, V defaultValue, boolean mutableInService)
DisplayString(int columnID, MOAccess access, V defaultValue, boolean mutableInService, int minSize, int maxSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
validate(V newValue, V oldValue)
static <V extends org.snmp4j.smi.Variable>
intvalidateDisplayString(V displayString, ValueConstraint sizeConstraints)
Validates a variable as a DisplayString OCTET STRING.-
Methods inherited from class org.snmp4j.agent.mo.MOColumn
compareTo, get, getAccess, getColumnID, getRestoreValue, getStoreValue, getSyntax, getTable, getValue, isVolatile, setAccess, setColumnID, setSyntax, setTable
-
Methods inherited from class org.snmp4j.agent.mo.MOMutableColumn
addMOValueValidationListener, cleanup, commit, getDefaultValue, isMandatory, isMutableInService, prepare, removeMOValueValidationListener, setDefaultValue, setMandatory, setMutableInService, toString, undo, validateSetRequest
-
-
-
-
Field Detail
-
MIN_SIZE
public static final int MIN_SIZE
- See Also:
- Constant Field Values
-
MAX_SIZE
public static final int MAX_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
validate
public int validate(V newValue, V oldValue)
- Overrides:
validate
in classMOMutableColumn<V extends org.snmp4j.smi.OctetString>
-
validateDisplayString
public static <V extends org.snmp4j.smi.Variable> int validateDisplayString(V displayString, ValueConstraint sizeConstraints)
Validates a variable as a DisplayString OCTET STRING. If the variable is not an OctetString instance, wrongType is returned as error status. Otherwise wrongValue is returned if the string contains non-printable characters other than 'return' and 'new-line'.- Type Parameters:
V
- theOctetString
subclass that defines the baseVariable
class of this display string. If V is not an OctetString,SnmpConstants.SNMP_ERROR_WRONG_TYPE
will be returned always.- Parameters:
displayString
- a variable to validate.sizeConstraints
- a constraint for the size (length) of the string.- Returns:
- a SNMP error status if the variable is not a valid DisplayString or zero if it is.
-
-