pt.digitalis.dif.dem.objects.parameters.constraints.impl
Class ParameterConstraintRegexImpl

java.lang.Object
  extended by pt.digitalis.dif.dem.objects.parameters.constraints.AbstractParameterConstraint
      extended by pt.digitalis.dif.dem.objects.parameters.constraints.impl.ParameterConstraintRegexImpl
All Implemented Interfaces:
IParameterConstraint
Direct Known Subclasses:
ParameterConstraintEmailImpl

public class ParameterConstraintRegexImpl
extends AbstractParameterConstraint

Author:
Galaio da Silva jgalaio@digitalis.pt
Created on:
Jul 27, 2010

Field Summary
static String REGEXP_COMMA
          the separator for multiple regular expressions (Java & JavaScript)
static String REGEXP_LIST_END
          the end delimiter for multiple regular expressions (Java & JavaScript)
static String REGEXP_LIST_SEPARATOR
          the separator for multiple regular expressions (Java & JavaScript)
static String REGEXP_LIST_START
          the start delimiter for multiple regular expressions (Java & JavaScript)
 
Constructor Summary
ParameterConstraintRegexImpl()
           
 
Method Summary
 void configureConstraint(String configurationString)
          Configures the constraint.
protected  Map<String,String> getErrorMessageValues(boolean parseValues)
          Compiles all values to be parsed in the error message to be generated on request
 String getJavaScriptValidationCondition()
          Builds a JavaScript boolean expression to check this constraint.
 boolean isSupportedClass(Class<?> clazz)
          Checks if the parameter attribute is of a supported class for this constraint to be used
 boolean validateConstraint(String value, IStageInstance stageInstance)
          Validates the parameter value passed as a String
 
Methods inherited from class pt.digitalis.dif.dem.objects.parameters.constraints.AbstractParameterConstraint
getErrorIDs, getMessages, getValidationResult, validateConstraint, validationErrorMessage, validationErrorMessage, validationErrorMessage, validationErrorMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REGEXP_COMMA

public static final String REGEXP_COMMA
the separator for multiple regular expressions (Java & JavaScript)

See Also:
Constant Field Values

REGEXP_LIST_END

public static final String REGEXP_LIST_END
the end delimiter for multiple regular expressions (Java & JavaScript)

See Also:
Constant Field Values

REGEXP_LIST_SEPARATOR

public static final String REGEXP_LIST_SEPARATOR
the separator for multiple regular expressions (Java & JavaScript)

See Also:
Constant Field Values

REGEXP_LIST_START

public static final String REGEXP_LIST_START
the start delimiter for multiple regular expressions (Java & JavaScript)

See Also:
Constant Field Values
Constructor Detail

ParameterConstraintRegexImpl

public ParameterConstraintRegexImpl()
Method Detail

configureConstraint

public void configureConstraint(String configurationString)
Description copied from interface: IParameterConstraint
Configures the constraint. Optional. The maximum value for max, or maskString for mask.

See Also:
IParameterConstraint.configureConstraint(java.lang.String)

getErrorMessageValues

protected Map<String,String> getErrorMessageValues(boolean parseValues)
Description copied from class: AbstractParameterConstraint
Compiles all values to be parsed in the error message to be generated on request

Specified by:
getErrorMessageValues in class AbstractParameterConstraint
Parameters:
parseValues - if T will replace the current parameter value in the message. Otherwise return the untouched message for custom parsing
Returns:
the list of key/values to replace in the error message
See Also:
AbstractParameterConstraint.getErrorMessageValues(boolean)

getJavaScriptValidationCondition

public String getJavaScriptValidationCondition()
Description copied from interface: IParameterConstraint
Builds a JavaScript boolean expression to check this constraint. Will assume there is a "value" variable with the current parameter value in context to get the parameter value from.

Returns:
the JS code to validate
See Also:
IParameterConstraint.getJavaScriptValidationCondition()

isSupportedClass

public boolean isSupportedClass(Class<?> clazz)
Description copied from interface: IParameterConstraint
Checks if the parameter attribute is of a supported class for this constraint to be used

Parameters:
clazz - the class of the attribute on witch the constraint has been applied
Returns:
T is it is a supported class
See Also:
IParameterConstraint.isSupportedClass(java.lang.Class)

validateConstraint

public boolean validateConstraint(String value,
                                  IStageInstance stageInstance)
Description copied from interface: IParameterConstraint
Validates the parameter value passed as a String

Parameters:
value - the value to validate
stageInstance - the current stage in execution
Returns:
T if the validation succeded
See Also:
IParameterConstraint.validateConstraint(java.lang.String, pt.digitalis.dif.dem.interfaces.IStageInstance)


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.