oracle.clex.util
Class AttributeValidator

java.lang.Object
  |
  +--oracle.clex.util.AttributeValidator
All Implemented Interfaces:
java.lang.Cloneable

public class AttributeValidator
extends java.lang.Object
implements java.lang.Cloneable

Contains the rules for an attribute and performs the validation. Used to validate values against a particular attribute rule


Field Summary
static java.lang.String DATATYPE_DATE
          The date datatype
static java.lang.String DATATYPE_DECIMAL
          The decimal datatype
static java.lang.String DATATYPE_INT
          The int datatype
static java.lang.String DEFAULT_DATEFORMAT
          The default date format rule.
static java.lang.String DEPENDENT_RULE_DEFAULT_KEY
          The default key for dependent rule
static java.lang.String DEPENDENT_RULE_NULL_VALUE
          The value to represent a null value for dependents.
static java.lang.String DEPENDENT_RULE_REQUIRES_ONE_VALUE
          The value to specify that atleast one dependent value is required.
static java.lang.String RULE_DATATYPE
          The tag for datatype rule
static java.lang.String RULE_DATEFORMAT
          The tag for the date format rule
static java.lang.String RULE_LENGTH
          The tag for the length rule
static java.lang.String RULE_MANDATORY
          The tag for the mandatory rule
static java.lang.String RULE_MAX
          The tag for the max rule
static java.lang.String RULE_MIN
          The tag for the min rule
static java.lang.String RULE_REGEXP
          The tag for the regexp rule
 
Constructor Summary
AttributeValidator()
          Default Constructor
 
Method Summary
 void addDependentRule(java.lang.String dependentRule, java.util.Hashtable dependents)
           
protected  void addErrorMessage(java.lang.String errorMessage)
          Add a error message for the attribute
 void addRule(java.lang.String ruleName, java.lang.String ruleValue)
          Add a rule to the attribute
 void addRuleMessage(java.lang.String ruleName, java.lang.String ruleMessage)
          Add a custom rule message for attribute
 void clear()
           
 java.lang.Object clone()
           
 java.util.Vector getDependents()
           
 java.lang.String getDescriptiveName()
          Returns the descriptive name of the attribute
 java.util.Vector getErrorMessages()
          Returns the the error messages as a result of the validating a value with the attribute rules.
 java.lang.String getName()
          Returns the name of the attribute
 java.lang.String getRuleValue(java.lang.String ruleName)
          Returns the value of a rule
 boolean hasDependentRules()
           
 boolean hasErrors()
          Returns a boolean determining if there were any error messages as a result of the validate()
 void setDescriptiveName(java.lang.String aDescriptiveName)
          Sets the descriptive name of the attribute which will use in the error messages
 void setName(java.lang.String attributeName)
          Sets the name of the attribute
 void validate(java.lang.String value, java.util.Hashtable dependentValues)
          Validates the value using the rules of the attributes If Dependent rules present, then validated against dependentValues
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RULE_DATATYPE

public static final java.lang.String RULE_DATATYPE
The tag for datatype rule

RULE_DATEFORMAT

public static final java.lang.String RULE_DATEFORMAT
The tag for the date format rule

RULE_LENGTH

public static final java.lang.String RULE_LENGTH
The tag for the length rule

RULE_MIN

public static final java.lang.String RULE_MIN
The tag for the min rule

RULE_MAX

public static final java.lang.String RULE_MAX
The tag for the max rule

RULE_MANDATORY

public static final java.lang.String RULE_MANDATORY
The tag for the mandatory rule

RULE_REGEXP

public static final java.lang.String RULE_REGEXP
The tag for the regexp rule

DEPENDENT_RULE_DEFAULT_KEY

public static final java.lang.String DEPENDENT_RULE_DEFAULT_KEY
The default key for dependent rule

DEPENDENT_RULE_NULL_VALUE

public static final java.lang.String DEPENDENT_RULE_NULL_VALUE
The value to represent a null value for dependents. Value is NULL

DEPENDENT_RULE_REQUIRES_ONE_VALUE

public static final java.lang.String DEPENDENT_RULE_REQUIRES_ONE_VALUE
The value to specify that atleast one dependent value is required. Value is REQUIRESONE

DEFAULT_DATEFORMAT

public static final java.lang.String DEFAULT_DATEFORMAT
The default date format rule. Value is MM/DD/YYYY

DATATYPE_DATE

public static final java.lang.String DATATYPE_DATE
The date datatype

DATATYPE_DECIMAL

public static final java.lang.String DATATYPE_DECIMAL
The decimal datatype

DATATYPE_INT

public static final java.lang.String DATATYPE_INT
The int datatype
Constructor Detail

AttributeValidator

public AttributeValidator()
Default Constructor
Method Detail

getName

public java.lang.String getName()
Returns the name of the attribute
Returns:
java.lang.String

getDescriptiveName

public java.lang.String getDescriptiveName()
Returns the descriptive name of the attribute
Returns:
java.lang.String

getRuleValue

public java.lang.String getRuleValue(java.lang.String ruleName)
Returns the value of a rule
Returns:
java.lang.String

clear

public void clear()

getErrorMessages

public java.util.Vector getErrorMessages()
Returns the the error messages as a result of the validating a value with the attribute rules. Will not contain anything to prior to to invoking validate()
Returns:
java.util.Vector

getDependents

public java.util.Vector getDependents()

hasErrors

public boolean hasErrors()
Returns a boolean determining if there were any error messages as a result of the validate()
Returns:
boolean

hasDependentRules

public boolean hasDependentRules()

setName

public void setName(java.lang.String attributeName)
Sets the name of the attribute
Parameters:
java.lang.String - the attribute name

setDescriptiveName

public void setDescriptiveName(java.lang.String aDescriptiveName)
Sets the descriptive name of the attribute which will use in the error messages
Parameters:
java.lang.String - The descriptive name

addRule

public void addRule(java.lang.String ruleName,
                    java.lang.String ruleValue)
Add a rule to the attribute
Parameters:
java.lang.String - The name of the rule
java.lang.String - The value of the rule

addRuleMessage

public void addRuleMessage(java.lang.String ruleName,
                           java.lang.String ruleMessage)
Add a custom rule message for attribute
Parameters:
java.lang.String - The name of the rule
java.lang.String - The value of the custom message

addDependentRule

public void addDependentRule(java.lang.String dependentRule,
                             java.util.Hashtable dependents)

addErrorMessage

protected void addErrorMessage(java.lang.String errorMessage)
Add a error message for the attribute
Parameters:
java.lang.String - The error message

validate

public void validate(java.lang.String value,
                     java.util.Hashtable dependentValues)
Validates the value using the rules of the attributes If Dependent rules present, then validated against dependentValues
Parameters:
java.lang.String -  
java.util.Hashtable -  

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object


Copyright © 2003 ORACLE Corp. All Rights Reserved.