com.codestreet.messageforge
Class RFldConstraintI8MinMax

java.lang.Object
  extended bycom.codestreet.messageforge.RFldConstraintI8
      extended bycom.codestreet.messageforge.RFldConstraintI8MinMax
All Implemented Interfaces:
RFldConstraint, RFldConstraintNumeric

public class RFldConstraintI8MinMax
extends RFldConstraintI8

Class to represent a minimum/maximum value constraint on a byte numeric message field.

Author:
Jawaid Hakim.

Field Summary
protected  int maxVal_
          Maximum value allowed.
protected  boolean maxValSet_
          Flag to indicate if maximum value constraint is set.
protected  int minVal_
          Minimum value allowed.
protected  boolean minValSet_
          Flag to indicate if minimum value constraint is set.
 
Method Summary
 java.lang.String errDesc(java.lang.String fldName)
          Get error description.
 boolean isValid(byte val)
          Check if a value satisfies the constraint.
static RFldConstraintI8MinMax valueOf(java.lang.String key, java.lang.String fldName, boolean minSet, java.lang.Byte min, boolean maxSet, java.lang.Byte max)
          Factory.
static RFldConstraintI8MinMax 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.RFldConstraintI8
isValid, validate, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minValSet_

protected boolean minValSet_
Flag to indicate if minimum value constraint is set.


maxValSet_

protected boolean maxValSet_
Flag to indicate if maximum value constraint is set.


minVal_

protected int minVal_
Minimum value allowed.


maxVal_

protected int maxVal_
Maximum value allowed.

Method Detail

valueOf

public static RFldConstraintI8MinMax valueOf(java.lang.String key,
                                             java.lang.String fldName,
                                             boolean minSet,
                                             java.lang.Byte min,
                                             boolean maxSet,
                                             java.lang.Byte max)
                                      throws FieldValidationException
Factory. Returns a RFldConstraintF32MinMax 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 min value is set.
min - Minimum length allowed. If this is null then no constraint is placed on the minimum length.
maxSet - Flag to indicate whether max value is set.
max - Maximum length allowed. If this is null then no constraint is placed on the maximum length.
Throws:
FieldValidationException

valueOf

public static RFldConstraintI8MinMax 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 RFldConstraintI8MinMax 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 min value is set.
min - Minimum length allowed. If this is null then no constraint is placed on the minimum length.
maxSet - Flag to indicate whether max value is set.
max - Maximum length allowed. If this is null then no constraint is placed on the maximum length.
Throws:
FieldValidationException

errDesc

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

Specified by:
errDesc in interface RFldConstraint
Specified by:
errDesc in class RFldConstraintI8
Parameters:
fldName - Field name.
Returns:
Error description.

isValid

public boolean isValid(byte val)
Check if a value satisfies the constraint.

Specified by:
isValid in class RFldConstraintI8
Parameters:
val - Field value to validate.
Returns:
true if the field satisfied the constraint. Otherwise, false is returned.
See Also:
RFld


Copyright © 2003-2006 CodeStreet. All Rights Reserved.