public class ConstraintsImpl extends Object implements Constraints
ConstraintsImpl class represents a collection of constraints
that are applied to a SNMP value in the order they have been added to this
constraints collection.| Constructor and Description |
|---|
ConstraintsImpl()
Creates a new constraints collection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Constraint sizeConstraint)
Adds a range constraint to the constraints collection.
|
Constraint[] |
getConstraints()
Gets an array with the constraints in this collection ordered by insertion
time.
|
boolean |
isValidSize(long size)
Interpretes the value range constraints contained in this collection as
size restrictions for OCTET STRING values and checks whether the given
size matches these criteria.
|
void |
remove(Constraint sizeContraint)
Removes a constraint.
|
int |
validate(org.snmp4j.smi.Variable variable)
Indicates whether a SNMP value matches this value constraint.
|
public void add(Constraint sizeConstraint)
Constraintsadd in interface ConstraintssizeConstraint - a SNMP integer/long value range constraint.public void remove(Constraint sizeContraint)
Constraintsremove in interface ConstraintssizeContraint - a SNMP integer/long value range constraint.public Constraint[] getConstraints()
ConstraintsgetConstraints in interface ConstraintsConstraint instances.public boolean isValidSize(long size)
ConstraintsisValidSize in interface Constraintssize - a long value representing an OCTET STRING size.true if the size is valid.public int validate(org.snmp4j.smi.Variable variable)
ValueConstraintvalidate in interface ValueConstraintvariable - a SNMP value that has to match the type of SNMP value this
ValueConstraint supports. Otherwise a wrongType error
should be returned instead of throwing a
ClassCastException.Copyright © 2020 SNMP4J.org. All rights reserved.