All Packages Class Hierarchy This Package Previous Next Index
Class Snmp.LeafSyntax
java.lang.Object
|
+----Snmp.LeafSyntax
- public class LeafSyntax
- extends Object
This class represents the syntax of a leaf node in a MIB module.
It implements parsing of the definition for
the object syntax for both OBJECT-TYPE and Textual Conventions.
Two constructors are used, one to add pre-defined types, and
the other to parse the SYNTAX clause in the OBJECT-TYPE macro and
parse Textual Conventions in a MIB module.
The following methods may be used more frequently.
createVariable() to create a variable of type determined by
this LeafSyntax instance. The checkValue() methods to
determine if an int/string is valid per this LeafSyntax instance.
And the getInt() and getLabel() methods to get labels/values for enums.
-
description
- The defining description, e.g.
-
enumInt
- The values for each of the enumerated integer values
-
enumLabel
- The labels for each of the enumerated integer values
-
equivName
- Equivalent SNMP type name
-
MAX
- Maximum value allowed for integers
-
MIN
- Minimum value allowed for integers
-
name
- The name of this LeafSyntax instance
-
size
- Maximum Size restriction for string
-
type
- the SNMP type defined by the SnmpAPI types
-
LeafSyntax(String, byte)
- First of two constructors, to help define basic types
-
LeafSyntax(String, Vector, LeafSyntax)
- Second constructor, to define syntax based on Textual Convention,
or OBJECT-TYPE SYNTAX def.
-
checkValue(int)
- Checks to see if the int value argument is in the defined range for this syntax definition
-
checkValue(String)
- Checks to see if the String value argument is in the defined range for this syntax definition
-
createVariable(String)
- This method instantiates and returns an SnmpVar of type specified by this Syntax,
initialized to a value specified in the argument string
-
getInt(String)
- Returns the int value of the label argument if an enumerated integer
-
getLabel(int)
- Returns the label of the int value argument if an enumerated integer
-
toString()
- To return just the syntax name for display purposes, e.g.
-
toTagString()
- To return the syntax name and description for display purposes, e.g.
name
public String name
- The name of this LeafSyntax instance
description
public String description
- The defining description, e.g. "OCTET STRING (SIZE (0..255))"
type
public byte type
- the SNMP type defined by the SnmpAPI types
equivName
public String equivName
- Equivalent SNMP type name
enumLabel
public String enumLabel[]
- The labels for each of the enumerated integer values
enumInt
public int enumInt[]
- The values for each of the enumerated integer values
size
public int size
- Maximum Size restriction for string
MIN
public long MIN
- Minimum value allowed for integers
MAX
public long MAX
- Maximum value allowed for integers
LeafSyntax
public LeafSyntax(String nam,
byte Type)
- First of two constructors, to help define basic types
LeafSyntax
public LeafSyntax(String nam,
Vector toks,
LeafSyntax syntax) throws MibException
- Second constructor, to define syntax based on Textual Convention,
or OBJECT-TYPE SYNTAX def.
- Throws: MibException
- is thrown on parse errors.
createVariable
public SnmpVar createVariable(String value) throws SnmpException
- This method instantiates and returns an SnmpVar of type specified by this Syntax,
initialized to a value specified in the argument string
- Throws: SnmpException
- is thrown on format errors.
toString
public String toString()
- To return just the syntax name for display purposes, e.g. DisplayString
- Overrides:
- toString in class Object
toTagString
public String toTagString()
- To return the syntax name and description for display purposes, e.g. DisplayString (SIZE (0..255))
getLabel
public String getLabel(int val)
- Returns the label of the int value argument if an enumerated integer
getInt
public int getInt(String s)
- Returns the int value of the label argument if an enumerated integer
checkValue
public boolean checkValue(int i)
- Checks to see if the int value argument is in the defined range for this syntax definition
checkValue
public boolean checkValue(String s)
- Checks to see if the String value argument is in the defined range for this syntax definition
All Packages Class Hierarchy This Package Previous Next Index