org.snmp4j.agent.mo.snmp.smi
Class EnumerationConstraint

java.lang.Object
  extended by org.snmp4j.agent.mo.snmp.smi.EnumerationConstraint
All Implemented Interfaces:
ValueConstraint

public class EnumerationConstraint
extends java.lang.Object
implements ValueConstraint

The EnumerationConstraint class checks an Integer32 value to match a set of (enumerated) values or a OctetString value to match a set of bit values for the BITS SMI type.

Version:
1.2
Author:
Frank Fock

Constructor Summary
EnumerationConstraint(int[] allowedValues)
          Creates an EnumerationConstraint based on the specified array of integer values.
 
Method Summary
 int validate(org.snmp4j.smi.Variable variable)
          Indicates whether a SNMP value matches this value constraint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumerationConstraint

public EnumerationConstraint(int[] allowedValues)
Creates an EnumerationConstraint based on the specified array of integer values.

Parameters:
allowedValues - an array of allowed values.
Method Detail

validate

public int validate(org.snmp4j.smi.Variable variable)
Description copied from interface: ValueConstraint
Indicates whether a SNMP value matches this value constraint.

Specified by:
validate in interface ValueConstraint
Parameters:
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.
Returns:
a SNMP error status (e.g. wrongValue) if the value does not match the constraint, or zero if it matches.

Copyright 2005-2010 Frank Fock (SNMP4J.org)

Copyright © 2011 SNMP4J.org. All Rights Reserved.