net.sf.oval.constraint
Class AssertCheck

java.lang.Object
  extended by net.sf.oval.AbstractCheck
      extended by net.sf.oval.configuration.annotation.AbstractAnnotationCheck<Assert>
          extended by net.sf.oval.constraint.AssertCheck
All Implemented Interfaces:
Serializable, Check, AnnotationCheck<Assert>

public class AssertCheck
extends AbstractAnnotationCheck<Assert>

Author:
Sebastian Thomschke
See Also:
Serialized Form

Constructor Summary
AssertCheck()
           
 
Method Summary
 void configure(Assert constraintAnnotation)
          Configures the check based on the given constraint annotation.
 Map<String,String> createMessageVariables()
          
 String getExpr()
           
 String getLang()
           
 boolean isSatisfied(Object validatedObject, Object valueToValidate, OValContext context, Validator validator)
          This method implements the validation logic
 void setExpr(String expression)
           
 void setLang(String language)
           
 
Methods inherited from class net.sf.oval.AbstractCheck
getAppliesTo, getAppliesToDefault, getContext, getErrorCode, getMessage, getMessageVariables, getProfiles, getSeverity, getTarget, getWhen, isActive, requireMessageVariablesRecreation, setAppliesTo, setContext, setErrorCode, setMessage, setProfiles, setSeverity, setTarget, setWhen
 
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.Check
getAppliesTo, getContext, getErrorCode, getMessage, getMessageVariables, getProfiles, getSeverity, getTarget, getWhen, isActive, setAppliesTo, setContext, setErrorCode, setMessage, setProfiles, setSeverity, setTarget, setWhen
 

Constructor Detail

AssertCheck

public AssertCheck()
Method Detail

configure

public void configure(Assert constraintAnnotation)
Configures the check based on the given constraint annotation.

Specified by:
configure in interface AnnotationCheck<Assert>
Overrides:
configure in class AbstractAnnotationCheck<Assert>
Parameters:
constraintAnnotation - the constraint annotation to use for configuration

createMessageVariables

public Map<String,String> createMessageVariables()

Overrides:
createMessageVariables in class AbstractCheck

getExpr

public String getExpr()
Returns:
the expression

getLang

public String getLang()
Returns:
the expression language

isSatisfied

public boolean isSatisfied(Object validatedObject,
                           Object valueToValidate,
                           OValContext context,
                           Validator validator)
                    throws ExpressionEvaluationException,
                           ExpressionLanguageNotAvailableException
This method implements the validation logic

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
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:
ExpressionEvaluationException
ExpressionLanguageNotAvailableException

setExpr

public void setExpr(String expression)
Parameters:
expression - the expression to set

setLang

public void setLang(String language)
Parameters:
language - the expression language to set


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