net.sf.oval
Interface CheckExclusion

All Superinterfaces:
Serializable
All Known Subinterfaces:
AnnotationCheckExclusion<ExclusionAnnotation>
All Known Implementing Classes:
AbstractAnnotationCheckExclusion, AbstractCheckExclusion, NullableExclusion

public interface CheckExclusion
extends Serializable

interface for classes that can exclude the checking of constraints

Author:
Sebastian Thomschke

Method Summary
 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)
           
 boolean isCheckExcluded(Check check, Object validatedObject, Object valueToValidate, OValContext context, Validator validator)
          This method implements the validation logic
 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.
 

Method Detail

getProfiles

String[] getProfiles()
Returns:
the profiles, may return null

getWhen

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)

Returns:
the formula

isActive

boolean isActive(Object validatedObject,
                 Object valueToValidate,
                 Validator validator)
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

isCheckExcluded

boolean isCheckExcluded(Check check,
                        Object validatedObject,
                        Object valueToValidate,
                        OValContext context,
                        Validator validator)
                        throws OValException
This method implements the validation logic

Parameters:
check - a check that OVal is about to validate
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
context - the validation context (e.g. a field, a constructor parameter or a method parameter)
validator - the calling validator
Returns:
true if the value satisfies the checked constraint
Throws:
OValException

setProfiles

void setProfiles(String... profiles)
Parameters:
profiles - the profiles to set

setWhen

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)

Parameters:
when - formula calculating if this check is active


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