net.percederberg.mibble
Class MibValueSymbol

java.lang.Object
  extended by net.percederberg.mibble.MibSymbol
      extended by net.percederberg.mibble.MibValueSymbol

public class MibValueSymbol
extends MibSymbol

A MIB value symbol. This class holds information relevant to a MIB value assignment, i.e. a type and a value. Normally the value is an object identifier.

Since:
2.0

Constructor Summary
MibValueSymbol(FileLocation location, Mib mib, java.lang.String name, MibType type, MibValue value)
          Creates a new value symbol.
 
Method Summary
 MibValueSymbol getChild(int index)
          Returns a specific child symbol in the OID tree.
 int getChildCount()
          Returns the number of child symbols in the OID tree.
 MibValueSymbol[] getChildren()
          Returns all child symbols in the OID tree.
 MibValueSymbol getParent()
          Returns the parent symbol in the OID tree.
 MibType getType()
          Returns the symbol type.
 MibValue getValue()
          Returns the symbol value.
 void initialize(MibLoaderLog log)
          Initializes the MIB symbol.
 boolean isScalar()
          Checks if this symbol corresponds to a scalar.
 boolean isTable()
          Checks if this symbol corresponds to a table.
 boolean isTableColumn()
          Checks if this symbol corresponds to a table column.
 boolean isTableRow()
          Checks if this symbol corresponds to a table row (or entry).
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class net.percederberg.mibble.MibSymbol
getComment, getLocation, getMib, getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MibValueSymbol

public MibValueSymbol(FileLocation location,
                      Mib mib,
                      java.lang.String name,
                      MibType type,
                      MibValue value)
Creates a new value symbol.

NOTE: This is an internal constructor that should only be called by the MIB loader.

Parameters:
location - the symbol location
mib - the symbol MIB file
name - the symbol name
type - the symbol type
value - the symbol value
Since:
2.2
Method Detail

initialize

public void initialize(MibLoaderLog log)
                throws MibException
Initializes the MIB symbol. This will remove all levels of indirection present, such as references to types or values. No information is lost by this operation. This method may modify this object as a side-effect.

NOTE: This is an internal method that should only be called by the MIB loader.

Specified by:
initialize in class MibSymbol
Parameters:
log - the MIB loader log
Throws:
MibException - if an error was encountered during the initialization

isScalar

public boolean isScalar()
Checks if this symbol corresponds to a scalar. A symbol is considered a scalar if it has an SnmpObjectType type and does not represent or reside within a table.

Returns:
true if this symbol is a scalar, or false otherwise
Since:
2.5
See Also:
isTable(), isTableRow(), isTableColumn(), SnmpObjectType

isTable

public boolean isTable()
Checks if this symbol corresponds to a table. A symbol is considered a table if it has an SnmpObjectType type with SEQUENCE OF syntax.

Returns:
true if this symbol is a table, or false otherwise
Since:
2.5
See Also:
isScalar(), isTableRow(), isTableColumn(), SnmpObjectType

isTableRow

public boolean isTableRow()
Checks if this symbol corresponds to a table row (or entry). A symbol is considered a table row if it has an SnmpObjectType type with SEQUENCE syntax.

Returns:
true if this symbol is a table row, or false otherwise
Since:
2.5
See Also:
isScalar(), isTable(), isTableColumn(), SnmpObjectType

isTableColumn

public boolean isTableColumn()
Checks if this symbol corresponds to a table column. A symbol is considered a table column if it has an SnmpObjectType type and a parent symbol that is a table row.

Returns:
true if this symbol is a table column, or false otherwise
Since:
2.5
See Also:
isScalar(), isTable(), isTableRow(), SnmpObjectType

getType

public MibType getType()
Returns the symbol type.

Returns:
the symbol type

getValue

public MibValue getValue()
Returns the symbol value.

Returns:
the symbol value

getParent

public MibValueSymbol getParent()
Returns the parent symbol in the OID tree. This is a convenience method for value symbols that have object identifier values.

Returns:
the parent symbol in the OID tree, or null for none or if not applicable
Since:
2.5
See Also:
ObjectIdentifierValue

getChildCount

public int getChildCount()
Returns the number of child symbols in the OID tree. This is a convenience method for value symbols that have object identifier values.

Returns:
the number of child symbols in the OID tree, or zero (0) if not applicable
Since:
2.6
See Also:
ObjectIdentifierValue

getChild

public MibValueSymbol getChild(int index)
Returns a specific child symbol in the OID tree. This is a convenience method for value symbols that have object identifier values.

Parameters:
index - the child position, 0 <= index < count
Returns:
the child symbol in the OID tree, or null if not found or not applicable
Since:
2.6
See Also:
ObjectIdentifierValue

getChildren

public MibValueSymbol[] getChildren()
Returns all child symbols in the OID tree. This is a convenience method for value symbols that have object identifier values.

Returns:
the array of child symbols in the OID tree, or an empty array if not applicable
Since:
2.6
See Also:
ObjectIdentifierValue

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object