com.codestreet.messageforge
Class RFldConstraintStringEnum

java.lang.Object
  extended bycom.codestreet.messageforge.RFldConstraintString
      extended bycom.codestreet.messageforge.RFldConstraintStringEnum
All Implemented Interfaces:
RFldConstraint

public class RFldConstraintStringEnum
extends RFldConstraintString

Class to represent an enumeration constraint on a String message field.

Author:
Jawaid Hakim.

Field Summary
protected  java.lang.String[] enums_
          Enumeration of allowed values.
 
Constructor Summary
RFldConstraintStringEnum(java.lang.String fldName, java.lang.String[] enums)
          Constructor.
RFldConstraintStringEnum(java.lang.String fldName, java.lang.String[] enums, boolean ignoreCase)
          Constructor.
 
Method Summary
 java.lang.String errDesc(java.lang.String fldName)
          Get error description.
 boolean isValid(java.lang.String val)
          Check if a value satisfies the constraint.
 
Methods inherited from class com.codestreet.messageforge.RFldConstraintString
isValid, validate, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enums_

protected java.lang.String[] enums_
Enumeration of allowed values.

Constructor Detail

RFldConstraintStringEnum

public RFldConstraintStringEnum(java.lang.String fldName,
                                java.lang.String[] enums,
                                boolean ignoreCase)
                         throws FieldValidationException
Constructor.

Parameters:
fldName - Name of field to which this constraint is bound.
enums - Enumeration of allowed values.
ignoreCase - If true string compares are case-insensitive. Otherwise, compares are case-sensitive.

RFldConstraintStringEnum

public RFldConstraintStringEnum(java.lang.String fldName,
                                java.lang.String[] enums)
                         throws FieldValidationException
Constructor.

Parameters:
fldName - Name of field to which this constraint is bound.
enums - Enumeration of allowed values.
Method Detail

errDesc

public java.lang.String errDesc(java.lang.String fldName)
Get error description.

Parameters:
fldName - Field name.
Returns:
Error description.

isValid

public boolean isValid(java.lang.String val)
Check if a value satisfies the constraint.

Specified by:
isValid in class RFldConstraintString
Parameters:
val - Value to validate.
Returns:
true if the data satisfies the constraint. Otherwise, false is returned.


Copyright © 2003-2006 CodeStreet. All Rights Reserved.