net.sf.oval.constraint
Class EqualToFieldCheck

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

public class EqualToFieldCheck
extends AbstractAnnotationCheck<EqualToField>

Author:
Sebastian Thomschke
See Also:
Serialized Form

Constructor Summary
EqualToFieldCheck()
           
 
Method Summary
 void configure(EqualToField constraintAnnotation)
          Configures the check based on the given constraint annotation.
protected  Map<String,String> createMessageVariables()
          
 Class<?> getDeclaringClass()
           
 String getFieldName()
           
 boolean isSatisfied(Object validatedObject, Object valueToValidate, OValContext context, Validator validator)
          This method implements the validation logic
 boolean isUseGetter()
           
 void setDeclaringClass(Class<?> declaringClass)
           
 void setFieldName(String fieldName)
           
 void setUseGetter(boolean useGetter)
           
 
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

EqualToFieldCheck

public EqualToFieldCheck()
Method Detail

configure

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

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

createMessageVariables

protected Map<String,String> createMessageVariables()

Overrides:
createMessageVariables in class AbstractCheck

getDeclaringClass

public Class<?> getDeclaringClass()
Returns:
the declaringClass

getFieldName

public String getFieldName()
Returns:
the fieldName

isSatisfied

public boolean isSatisfied(Object validatedObject,
                           Object valueToValidate,
                           OValContext context,
                           Validator validator)
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

isUseGetter

public boolean isUseGetter()
Returns:
the useGetter

setDeclaringClass

public void setDeclaringClass(Class<?> declaringClass)
Parameters:
declaringClass - the declaringClass to set

setFieldName

public void setFieldName(String fieldName)
Parameters:
fieldName - the fieldName to set

setUseGetter

public void setUseGetter(boolean useGetter)
Parameters:
useGetter - the useGetter to set


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