HDIV API 2.0.4

org.hdiv.validator
Class Validation

java.lang.Object
  extended by org.hdiv.validator.Validation
All Implemented Interfaces:
IValidation

public class Validation
extends java.lang.Object
implements IValidation

Validation defined by the user in the hdiv-validation.xml for the editable data (text/textarea).

Since:
HDIV 1.1
Author:
Gorka Vicente

Field Summary
protected  java.util.regex.Pattern acceptedPattern
          Regular expression that values received in the parameter must fit.
protected  java.util.regex.Pattern rejectedPattern
          Regular expression that values received in the parameter can't fit.
 
Constructor Summary
Validation()
           
 
Method Summary
 boolean existComponentType()
          Checks if a component type has been defined to which apply the validation this.
 boolean existIgnoreParameters()
          Checks if there are editable parameters that must be ignored in the validation process.
 boolean isIgnoreParameter(java.lang.String parameter)
          Checks if parameter is a parameter that must be ignored during the validation process of the editable parameters.
 boolean isTheSameComponentType(java.lang.String parameterType)
          Checks if the type parameterType is the same as the one defined in the validation this.
 void setAcceptedPattern(java.lang.String acceptedPattern)
           
 void setComponentType(java.lang.String componentType)
           
 void setIgnoreParameters(java.util.List ignoreParameters)
          It creates a map from the list of ignore parameters defined for a URL.
 void setRejectedPattern(java.lang.String rejectedPattern)
           
 boolean validate(java.lang.String parameter, java.lang.String[] values, java.lang.String dataType)
           Checks if the values values are valid for the editable parameter parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

acceptedPattern

protected java.util.regex.Pattern acceptedPattern
Regular expression that values received in the parameter must fit.


rejectedPattern

protected java.util.regex.Pattern rejectedPattern
Regular expression that values received in the parameter can't fit.

Constructor Detail

Validation

public Validation()
Method Detail

setIgnoreParameters

public void setIgnoreParameters(java.util.List ignoreParameters)
It creates a map from the list of ignore parameters defined for a URL.

Parameters:
ignoreParameters - list of ignore parameters

existIgnoreParameters

public boolean existIgnoreParameters()
Checks if there are editable parameters that must be ignored in the validation process.

Returns:
True if there are editable parameters that must be ignored in the validation process. False otherwise.

isIgnoreParameter

public boolean isIgnoreParameter(java.lang.String parameter)
Checks if parameter is a parameter that must be ignored during the validation process of the editable parameters.

Parameters:
parameter - parameter name
Returns:
True if parameter doesn't need to be validated. False otherwise.

existComponentType

public boolean existComponentType()
Checks if a component type has been defined to which apply the validation this.

Returns:
True if the component type to which apply de validation has been defined. False otherwise.

isTheSameComponentType

public boolean isTheSameComponentType(java.lang.String parameterType)
Checks if the type parameterType is the same as the one defined in the validation this.

Parameters:
parameterType - Component type
Returns:
True if the validation this is the same as parameterType.

validate

public boolean validate(java.lang.String parameter,
                        java.lang.String[] values,
                        java.lang.String dataType)

Checks if the values values are valid for the editable parameter parameter.

There are two types of validations:

  • accepted: the value is valid only if it passes the validation
  • rejected: the value is rejected if doesn't pass the validation
  • Specified by:
    validate in interface IValidation
    Parameters:
    parameter - parameter name
    values - parameter's values
    dataType - editable data type
    Returns:
    True if the values values are valid for the parameter parameter.
    Since:
    HDIV 1.1.1

    setComponentType

    public void setComponentType(java.lang.String componentType)
    Parameters:
    componentType - The comkponent type to set.

    setAcceptedPattern

    public void setAcceptedPattern(java.lang.String acceptedPattern)
    Parameters:
    acceptedPattern - The accepted pattern to set.

    setRejectedPattern

    public void setRejectedPattern(java.lang.String rejectedPattern)
    Parameters:
    rejectedPattern - The rejected pattern to set.

    HDIV 2.0.4

    Copyright © 2008 hdiv.org. All Rights Reserved.