com.codestreet.messageforge
Class RFldConstraintStringLength

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

public class RFldConstraintStringLength
extends RFldConstraintString

Class to represent a minumum/maximum length constraint on a String message field.

Author:
Jawaid Hakim.

Field Summary
protected  int maxLen_
          Maximum length allowed.
protected  boolean maxValSet_
           
protected  int minLen_
          Minimum length allowed.
protected  boolean minValSet_
           
static int NOTSET
          Constraint not set.
 
Method Summary
 java.lang.String errDesc(java.lang.String fldName)
          Get error description.
 boolean isValid(RFld fld)
          Check if a message field satisfies the constraint.
 boolean isValid(java.lang.String val)
          Check if a value satisfies the constraint.
static RFldConstraintStringLength valueOf(java.lang.String key, java.lang.String fldName, boolean minSet, java.lang.String min, boolean maxSet, java.lang.String max)
          Factory.
 
Methods inherited from class com.codestreet.messageforge.RFldConstraintString
validate, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOTSET

public static final int NOTSET
Constraint not set.

See Also:
Constant Field Values

minLen_

protected int minLen_
Minimum length allowed.


maxLen_

protected int maxLen_
Maximum length allowed.


minValSet_

protected boolean minValSet_

maxValSet_

protected boolean maxValSet_
Method Detail

valueOf

public static RFldConstraintStringLength valueOf(java.lang.String key,
                                                 java.lang.String fldName,
                                                 boolean minSet,
                                                 java.lang.String min,
                                                 boolean maxSet,
                                                 java.lang.String max)
                                          throws FieldValidationException
Factory. Returns a RFldConstraintStringLength instance based on the input parameters.

Parameters:
key - Key to use for caching constraint.
fldName - Name of field to which this constraint is bound.
minSet - Flag to indicate whether the minimum value is set.
min - Minimum length allowed. If this is null then no constraint is placed on the minimum length.
max - Maximum length allowed. If this is null then no constraint is placed on the maximum length.
Throws:
FieldValidationException
See Also:
NOTSET

errDesc

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

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

isValid

public boolean isValid(RFld fld)
Check if a message field satisfies the constraint.

Specified by:
isValid in interface RFldConstraint
Overrides:
isValid in class RFldConstraintString
Parameters:
fld - Field to validate.
Returns:
true if the field satisfied the constraint. Otherwise, false is returned.

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.