net.percederberg.mibble.value
Class ObjectIdentifierValue

java.lang.Object
  |
  +--net.percederberg.mibble.value.ObjectIdentifierValue
All Implemented Interfaces:
MibValue

public class ObjectIdentifierValue
extends java.lang.Object
implements MibValue

An object identifier value. This class stores the component identifier values in a tree hierarchy.

Since:
2.0

Constructor Summary
ObjectIdentifierValue(ObjectIdentifierValue parent, java.lang.String name, int value)
          Creates a new object identifier value.
ObjectIdentifierValue(java.lang.String name, int value)
          Creates a new root object identifier value.
ObjectIdentifierValue(ValueReference parent, java.lang.String name, int value)
          Creates a new object identifier value.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Checks if this object equals another object.
 ObjectIdentifierValue getChild(int index)
          Returns a child object identifier value.
 int getChildCount()
          Returns the number of child object identifier values.
 java.lang.String getName()
          Returns this object identifier component name.
 ObjectIdentifierValue getParent()
          Returns the parent object identifier value.
 MibValueSymbol getSymbol()
          Returns the symbol connected to this object identifier.
 int getValue()
          Returns this object identifier component value.
 int hashCode()
          Returns a hash code for this object.
 MibValue initialize(MibLoaderLog log)
          Initializes the MIB value.
 void setSymbol(MibValueSymbol symbol)
          Sets the symbol connected to this object identifier.
 java.lang.String toDetailString()
          Returns a detailed string representation of this value.
 java.lang.Object toObject()
          Returns a string representation of this value.
 java.lang.String toString()
          Returns a string representation of this value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectIdentifierValue

public ObjectIdentifierValue(java.lang.String name,
                             int value)
Creates a new root object identifier value.

Parameters:
name - the component name, or null
value - the component value

ObjectIdentifierValue

public ObjectIdentifierValue(ObjectIdentifierValue parent,
                             java.lang.String name,
                             int value)
Creates a new object identifier value.

Parameters:
parent - the component parent
name - the component name, or null
value - the component value

ObjectIdentifierValue

public ObjectIdentifierValue(ValueReference parent,
                             java.lang.String name,
                             int value)
Creates a new object identifier value.

Parameters:
parent - the component parent
name - the component name, or null
value - the component value
Method Detail

initialize

public MibValue initialize(MibLoaderLog log)
                    throws MibException
Initializes the MIB value. This will remove all levels of indirection present, such as references to other values, and returns the basic value. No value information is lost by this operation. This method may modify this object as a side-effect, and will be called by the MIB loader.

Specified by:
initialize in interface MibValue
Parameters:
log - the MIB loader log
Returns:
the basic MIB value
Throws:
MibException - if an error was encountered during the initialization

equals

public boolean equals(java.lang.Object obj)
Checks if this object equals another object. This method will compare the string representations for equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare with
Returns:
true if the objects are equal, or false otherwise

hashCode

public int hashCode()
Returns a hash code for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this object

getParent

public ObjectIdentifierValue getParent()
Returns the parent object identifier value.

Returns:
the parent object identifier value, or null if no parent exists

getName

public java.lang.String getName()
Returns this object identifier component name.

Returns:
the object identifier component name, or null if the component has no name

getValue

public int getValue()
Returns this object identifier component value.

Returns:
the object identifier component value

getSymbol

public MibValueSymbol getSymbol()
Returns the symbol connected to this object identifier.

Returns:
the symbol connected to this object identifier, or null if no value symbol is connected

setSymbol

public void setSymbol(MibValueSymbol symbol)
Sets the symbol connected to this object identifier. This method is called during the value symbol initialization.

Parameters:
symbol - the value symbol

getChildCount

public int getChildCount()
Returns the number of child object identifier values.

Returns:
the number of child object identifier values

getChild

public ObjectIdentifierValue getChild(int index)
Returns a child object identifier value.

Parameters:
index - the child position, 0 <= index < count
Returns:
the child object identifier value, or null if not found

toObject

public java.lang.Object toObject()
Returns a string representation of this value. The string will contain the full numeric object identifier value with each component separated with a dot ('.').

Specified by:
toObject in interface MibValue
Returns:
a string representation of this value

toString

public java.lang.String toString()
Returns a string representation of this value. The string will contain the full numeric object identifier value with each component separated with a dot ('.').

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

toDetailString

public java.lang.String toDetailString()
Returns a detailed string representation of this value. The string will contain the full numeric object identifier value with optional names for each component.

Returns:
a detailed string representation of this value