net.percederberg.mibble.type
Class ValueConstraint

java.lang.Object
  |
  +--net.percederberg.mibble.type.ValueConstraint
All Implemented Interfaces:
Constraint

public class ValueConstraint
extends java.lang.Object
implements Constraint

A MIB type value constraint. This class represents a single value in a set of value constraints.

Since:
2.0

Constructor Summary
ValueConstraint(MibValue value)
          Creates a new value constraint.
 
Method Summary
 MibValue getValue()
          Returns the constraint value.
 void initialize(MibLoaderLog log)
          Initializes the constraint.
 boolean isCompatible(MibType type)
          Checks if the specified type is compatible with this constraint.
 boolean isCompatible(MibValue value)
          Checks if the specified value is compatible with this constraint.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueConstraint

public ValueConstraint(MibValue value)
Creates a new value constraint.

Parameters:
value - the constraint value
Method Detail

initialize

public void initialize(MibLoaderLog log)
                throws MibException
Initializes the constraint. This will remove all levels of indirection present, such as references to types or values. No constraint 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 Constraint
Parameters:
log - the MIB loader log
Throws:
MibException - if an error was encountered during the initialization

isCompatible

public boolean isCompatible(MibType type)
Checks if the specified type is compatible with this constraint.

Specified by:
isCompatible in interface Constraint
Parameters:
type - the type to check
Returns:
true if the type is compatible, or false otherwise

isCompatible

public boolean isCompatible(MibValue value)
Checks if the specified value is compatible with this constraint.

Specified by:
isCompatible in interface Constraint
Parameters:
value - the value to check
Returns:
true if the value is compatible, or false otherwise

getValue

public MibValue getValue()
Returns the constraint value.

Returns:
the constraint value

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