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.


Variable Index

 o description
The defining description, e.g.
 o enumInt
The values for each of the enumerated integer values
 o enumLabel
The labels for each of the enumerated integer values
 o equivName
Equivalent SNMP type name
 o MAX
Maximum value allowed for integers
 o MIN
Minimum value allowed for integers
 o name
The name of this LeafSyntax instance
 o size
Maximum Size restriction for string
 o type
the SNMP type defined by the SnmpAPI types

Constructor Index

 o LeafSyntax(String, byte)
First of two constructors, to help define basic types
 o LeafSyntax(String, Vector, LeafSyntax)
Second constructor, to define syntax based on Textual Convention, or OBJECT-TYPE SYNTAX def.

Method Index

 o checkValue(int)
Checks to see if the int value argument is in the defined range for this syntax definition
 o checkValue(String)
Checks to see if the String value argument is in the defined range for this syntax definition
 o createVariable(String)
This method instantiates and returns an SnmpVar of type specified by this Syntax, initialized to a value specified in the argument string
 o getInt(String)
Returns the int value of the label argument if an enumerated integer
 o getLabel(int)
Returns the label of the int value argument if an enumerated integer
 o toString()
To return just the syntax name for display purposes, e.g.
 o toTagString()
To return the syntax name and description for display purposes, e.g.

Variables

 o name
 public String name
The name of this LeafSyntax instance

 o description
 public String description
The defining description, e.g. "OCTET STRING (SIZE (0..255))"

 o type
 public byte type
the SNMP type defined by the SnmpAPI types

 o equivName
 public String equivName
Equivalent SNMP type name

 o enumLabel
 public String enumLabel[]
The labels for each of the enumerated integer values

 o enumInt
 public int enumInt[]
The values for each of the enumerated integer values

 o size
 public int size
Maximum Size restriction for string

 o MIN
 public long MIN
Minimum value allowed for integers

 o MAX
 public long MAX
Maximum value allowed for integers

Constructors

 o LeafSyntax
 public LeafSyntax(String nam,
                   byte Type)
First of two constructors, to help define basic types

 o 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.

Methods

 o 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.
 o toString
 public String toString()
To return just the syntax name for display purposes, e.g. DisplayString

Overrides:
toString in class Object
 o toTagString
 public String toTagString()
To return the syntax name and description for display purposes, e.g. DisplayString (SIZE (0..255))

 o getLabel
 public String getLabel(int val)
Returns the label of the int value argument if an enumerated integer

 o getInt
 public int getInt(String s)
Returns the int value of the label argument if an enumerated integer

 o checkValue
 public boolean checkValue(int i)
Checks to see if the int value argument is in the defined range for this syntax definition

 o 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