|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.percederberg.mibble.MibType
The base MIB type class. There are two categories of MIB types extending this class, primitive ASN.1 type and SNMP macro types. The primitive types are used in SNMP for transferring data on the wire. The SNMP macro types are used in the MIB files for adding additional information to the primitive types or values, such as descriptions and similar. Most of the SNMP macro types only support object identifier values, and can only be used at the top level. The primitive types support whatever values are appropriate for the specific type, and are normally used inside the SNMP macro types in a MIB file.
The best way to extract the specific type information from a MIB type is to check the type instance and then cast the MibType object to the corresponding subtype. Each subtype have very different properties, which is why the API in this class is rather limited. Another way to check which type is at hand, is to query the type tags with the hasTag() method. In this way it is possible to distinguish between types using the same or a similar primitive ASN.1 type representation (such as DisplayString and IpAddress).
Constructor Summary | |
protected |
MibType(java.lang.String name,
boolean primitive)
Creates a new MIB type instance. |
Method Summary | |
MibType |
createReference()
Creates a type reference to this type. |
MibType |
createReference(java.util.ArrayList values)
Creates a constrained type reference to this type. |
MibType |
createReference(Constraint constraint)
Creates a constrained type reference to this type. |
java.lang.String |
getName()
Returns the type name. |
MibTypeSymbol |
getReferenceSymbol()
Returns the type reference symbol. |
MibTypeTag |
getTag()
Returns the type tag. |
boolean |
hasReferenceTo(java.lang.String name)
Checks if this type referenced the specified type symbol. |
boolean |
hasReferenceTo(java.lang.String module,
java.lang.String name)
Checks if this type referenced the specified type symbol. |
boolean |
hasTag(int category,
int value)
Checks if this type has a specific type tag. |
boolean |
hasTag(MibTypeTag tag)
Checks if this type has a specific type tag. |
abstract MibType |
initialize(MibSymbol symbol,
MibLoaderLog log)
Initializes the MIB type. |
abstract boolean |
isCompatible(MibValue value)
Checks if the specified value is compatible with this type. |
boolean |
isPrimitive()
Checks if this type represents a primitive type. |
void |
setReferenceSymbol(MibTypeSymbol symbol)
Sets the type reference symbol. |
void |
setTag(boolean implicit,
MibTypeTag tag)
Sets the type tag. |
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 |
protected MibType(java.lang.String name, boolean primitive)
name
- the type nameprimitive
- the primitive type flagMethod Detail |
public abstract MibType initialize(MibSymbol symbol, MibLoaderLog log) throws MibException
NOTE: This is an internal method that should only be called by the MIB loader.
symbol
- the MIB symbol containing this typelog
- the MIB loader log
MibException
- if an error was encountered during the
initializationpublic MibType createReference() throws java.lang.UnsupportedOperationException
NOTE: This is an internal method that should only be called by the MIB loader.
java.lang.UnsupportedOperationException
- if a type reference
couldn't be createdpublic MibType createReference(Constraint constraint) throws java.lang.UnsupportedOperationException
NOTE: This is an internal method that should only be called by the MIB loader.
constraint
- the type constraint
java.lang.UnsupportedOperationException
- if a type reference
couldn't be created with constraintspublic MibType createReference(java.util.ArrayList values) throws java.lang.UnsupportedOperationException
NOTE: This is an internal method that should only be called by the MIB loader.
values
- the type value symbols
java.lang.UnsupportedOperationException
- if a type reference
couldn't be created with value constraintspublic abstract boolean isCompatible(MibValue value)
value
- the value to check
public boolean isPrimitive()
public boolean hasTag(MibTypeTag tag)
tag
- the type tag to search for
public boolean hasTag(int category, int value)
category
- the tag category to search forvalue
- the tag value to search for
public boolean hasReferenceTo(java.lang.String name)
name
- the type symbol name
getReferenceSymbol()
public boolean hasReferenceTo(java.lang.String module, java.lang.String name)
module
- the type symbol module (MIB) namename
- the type symbol name
getReferenceSymbol()
public java.lang.String getName()
public MibTypeTag getTag()
public void setTag(boolean implicit, MibTypeTag tag)
NOTE: This is an internal method that should only be called by the MIB loader.
implicit
- the implicit inheritance flagtag
- the new type tagpublic MibTypeSymbol getReferenceSymbol()
public void setReferenceSymbol(MibTypeSymbol symbol)
NOTE: This is an internal method that should only be called by the MIB loader.
symbol
- the referenced type symbolpublic java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |