net.percederberg.mibble.value
Class ObjectIdentifierValue

java.lang.Object
  extended bynet.percederberg.mibble.MibValue
      extended bynet.percederberg.mibble.value.ObjectIdentifierValue

public class ObjectIdentifierValue
extends 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
 MibValue createReference()
          Creates a value reference to this value.
 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 net.percederberg.mibble.MibValue
getReferenceSymbol, isReferenceTo, isReferenceTo, setReferenceSymbol
 
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. No value information is lost by this operation. This method may modify this object as a side-effect, and will return the basic value.

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

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

createReference

public MibValue createReference()
Creates a value reference to this value. The value reference is normally an identical value. Only certain values support being referenced, and the default implementation of this method throws an exception.

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

Overrides:
createReference in class MibValue
Returns:
the MIB value reference
Since:
2.2

equals

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

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.

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.

Overrides:
getName in class MibValue
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 class 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 ('.').

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