net.sf.oval
Class AbstractCheckExclusion

java.lang.Object
  extended by net.sf.oval.AbstractCheckExclusion
All Implemented Interfaces:
Serializable, CheckExclusion
Direct Known Subclasses:
AbstractAnnotationCheckExclusion

public abstract class AbstractCheckExclusion
extends Object
implements CheckExclusion

Partial implementation of exclusion classes.

Author:
Sebastian Thomschke
See Also:
Serialized Form

Constructor Summary
AbstractCheckExclusion()
           
 
Method Summary
 Map<String,String> getMessageVariables()
           
 String[] getProfiles()
          
 String getWhen()
          Formula returning true if this constraint shall be evaluated and false if it shall be ignored for the current validation.
 boolean isActive(Object validatedObject, Object valueToValidate, Validator validator)
          
 void setProfiles(String... profiles)
          
 void setWhen(String when)
          Sets the formula returning true if this constraint shall be evaluated and false if it shall be ignored for the current validation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.oval.CheckExclusion
isCheckExcluded
 

Constructor Detail

AbstractCheckExclusion

public AbstractCheckExclusion()
Method Detail

getMessageVariables

public Map<String,String> getMessageVariables()

getProfiles

public String[] getProfiles()

Specified by:
getProfiles in interface CheckExclusion
Returns:
the profiles, may return null

getWhen

public String getWhen()
Formula returning true if this constraint shall be evaluated and false if it shall be ignored for the current validation.

Important: The formula must be prefixed with the name of the scripting language that is used. E.g. groovy:_this.amount > 10

Available context variables are:
_this -> the validated bean
_value -> the value to validate (e.g. the field value, parameter value, method return value, or the validated bean for object level constraints)

Specified by:
getWhen in interface CheckExclusion
Returns:
the formula

isActive

public boolean isActive(Object validatedObject,
                        Object valueToValidate,
                        Validator validator)

Specified by:
isActive in interface CheckExclusion
Parameters:
validatedObject - the object/bean to validate the value against, for static fields or methods this is the class
valueToValidate - the value to validate, may be null when validating pre conditions for static methods
validator - the calling validator
Returns:
true if this check exclusion is active and must be satisfied

setProfiles

public void setProfiles(String... profiles)

Specified by:
setProfiles in interface CheckExclusion
Parameters:
profiles - the profiles to set

setWhen

public void setWhen(String when)
Sets the formula returning true if this constraint shall be evaluated and false if it shall be ignored for the current validation.

Important: The formula must be prefixed with the name of the scripting language that is used. E.g. groovy:_this.amount > 10

Available context variables are:
_this -> the validated bean
_value -> the value to validate (e.g. the field value, parameter value, method return value, or the validated bean for object level constraints)

Specified by:
setWhen in interface CheckExclusion
Parameters:
when - formula calculating if this check is active


Copyright © 2005–2015 The OVal Development Team. All rights reserved.