public class MOTableIndex extends Object implements MOTableIndexValidator
MOTableIndex
class represents a index definition of a
conceptual table. An index always has to implement also the
MOTableIndexValidator
interface for validation of index values
for newly created rows.Modifier and Type | Field and Description |
---|---|
static int |
MAX_INDEX_OID_LENGTH |
Constructor and Description |
---|
MOTableIndex(MOTableSubIndex[] subIndexes)
Creates a index definition from an array of sub-index definitions.
|
MOTableIndex(MOTableSubIndex[] subIndexes,
boolean impliedLength)
Creates a index definition from an array of sub-index definitions where
the last sub-index may have an implied length.
|
MOTableIndex(MOTableSubIndex[] subIndexes,
boolean impliedLength,
MOTableIndexValidator validator)
Creates a index definition from an array of sub-index definitions where
the last sub-index may have an implied length.
|
Modifier and Type | Method and Description |
---|---|
MOTableSubIndex |
getIndex(int index)
Gets the sub-index definition at the specified index.
|
org.snmp4j.smi.OID |
getIndexOID(org.snmp4j.smi.Variable[] indexValues)
Gets the index OID from an array of index values.
|
org.snmp4j.smi.OID[] |
getIndexOIDs(org.snmp4j.smi.OID index)
Split a table index into an array of object IDs each representing the
value of its corresponding index object.
|
org.snmp4j.smi.Variable[] |
getIndexValues(org.snmp4j.smi.OID index)
Gets the index values contained in an index OID.
|
MOTableIndexValidator |
getValidator()
Gets the index validator (if present).
|
boolean |
isImpliedLength() |
boolean |
isValidIndex(org.snmp4j.smi.OID index)
Checks whether an index OID is a valid index for this index definition
or not.
|
void |
setValidator(MOTableIndexValidator validator)
Sets the index validator associated with this index definition.
|
int |
size()
Gets the number of sub-index definitions in this index definition.
|
public static final int MAX_INDEX_OID_LENGTH
public MOTableIndex(MOTableSubIndex[] subIndexes)
subIndexes
- an array of sub-index definitions with at least one element.public MOTableIndex(MOTableSubIndex[] subIndexes, boolean impliedLength)
subIndexes
- an array of sub-index definitions with at least one element.impliedLength
- if true
the last sub-index has an implied length if at has
a variable length at all.public MOTableIndex(MOTableSubIndex[] subIndexes, boolean impliedLength, MOTableIndexValidator validator)
subIndexes
- an array of sub-index definitions with at least one element.impliedLength
- if true
the last sub-index has an implied length if at has
a variable length at all.validator
- an index validator that is called whenever a new index value needs to
validated.public MOTableSubIndex getIndex(int index)
index
- a valid sub-index index (zero-based).MOTableSubIndex
.public boolean isImpliedLength()
public MOTableIndexValidator getValidator()
MOTableIndexValidator
associated with this index or
null
.public void setValidator(MOTableIndexValidator validator)
validator
- a MOTableIndexValidator
instance.public int size()
public boolean isValidIndex(org.snmp4j.smi.OID index)
isValidIndex
in interface MOTableIndexValidator
index
- an OID (possibly zero length).true
if the index is valid or false
otherwise.public org.snmp4j.smi.OID[] getIndexOIDs(org.snmp4j.smi.OID index)
index
- an OID denoting a table's index value.size()
. If the given index is not a valid object ID
null
is returned.public org.snmp4j.smi.Variable[] getIndexValues(org.snmp4j.smi.OID index)
index
- the index OID.getIndexOID(org.snmp4j.smi.Variable[])
public org.snmp4j.smi.OID getIndexOID(org.snmp4j.smi.Variable[] indexValues)
indexValues
- an array of Variable instances that has to match the number and type
of sub-indexes in this index.getIndexValues(org.snmp4j.smi.OID)
Copyright © 2018 SNMP4J.org. All rights reserved.