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)
Constraints
add
in interface Constraints
sizeConstraint
- a SNMP integer/long value range constraint.public void remove(Constraint sizeContraint)
Constraints
remove
in interface Constraints
sizeContraint
- a SNMP integer/long value range constraint.public Constraint[] getConstraints()
Constraints
getConstraints
in interface Constraints
Constraint
instances.public boolean isValidSize(long size)
Constraints
isValidSize
in interface Constraints
size
- a long value representing an OCTET STRING size.true
if the size is valid.public int validate(org.snmp4j.smi.Variable variable)
ValueConstraint
validate
in interface ValueConstraint
variable
- 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 © 2016 SNMP4J.org. All rights reserved.