net.sf.oval.constraint
Class AssertConstraintSetCheck

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

public class AssertConstraintSetCheck
extends AbstractAnnotationCheck<AssertConstraintSet>

Author:
Sebastian Thomschke
See Also:
Serialized Form

Constructor Summary
AssertConstraintSetCheck()
           
 
Method Summary
 void configure(AssertConstraintSet constraintAnnotation)
          Configures the check based on the given constraint annotation.
 String getErrorCode()
          
 String getId()
           
 String getMessage()
          gets the default message that is displayed if a corresponding message key is not found in the messages properties file
default processed place holders are:
  • {context} => specifies which getter, method parameter or field was validated
  • {invalidValue} => string representation of the validated value
 int getSeverity()
          
 boolean isSatisfied(Object validatedObject, Object valueToValidate, OValContext context, Validator validator)
          This method is not used.
 void setErrorCode(String errorCode)
          
 void setId(String id)
           
 void setMessage(String message)
          sets the default message that is displayed if a corresponding message key is not found in the messages properties file
default processed place holders are:
  • {context} => specifies which getter, method parameter or field was validated
  • {invalidValue} => string representation of the validated value
 void setSeverity(int severity)
          
 
Methods inherited from class net.sf.oval.AbstractCheck
createMessageVariables, getAppliesTo, getAppliesToDefault, getContext, getMessageVariables, getProfiles, getTarget, getWhen, isActive, requireMessageVariablesRecreation, setAppliesTo, setContext, setProfiles, 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, getMessageVariables, getProfiles, getTarget, getWhen, isActive, setAppliesTo, setContext, setProfiles, setTarget, setWhen
 

Constructor Detail

AssertConstraintSetCheck

public AssertConstraintSetCheck()
Method Detail

configure

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

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

getErrorCode

public String getErrorCode()
                    throws UnsupportedOperationException

Specified by:
getErrorCode in interface Check
Overrides:
getErrorCode in class AbstractCheck
Returns:
the error code that will be used in a corresponding ConstraintViolation object
Throws:
UnsupportedOperationException

getId

public String getId()

getMessage

public String getMessage()
                  throws UnsupportedOperationException
gets the default message that is displayed if a corresponding message key is not found in the messages properties file
default processed place holders are:

Specified by:
getMessage in interface Check
Overrides:
getMessage in class AbstractCheck
Throws:
UnsupportedOperationException

getSeverity

public int getSeverity()
                throws UnsupportedOperationException

Specified by:
getSeverity in interface Check
Overrides:
getSeverity in class AbstractCheck
Returns:
the severity
Throws:
UnsupportedOperationException

isSatisfied

public boolean isSatisfied(Object validatedObject,
                           Object valueToValidate,
                           OValContext context,
                           Validator validator)
                    throws UnsupportedOperationException
This method is not used.
The validation of this special constraint is directly performed by the Validator class

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:
UnsupportedOperationException - always thrown if this method is invoked

setErrorCode

public void setErrorCode(String errorCode)
                  throws UnsupportedOperationException

Specified by:
setErrorCode in interface Check
Overrides:
setErrorCode in class AbstractCheck
Parameters:
errorCode - the error code to set
Throws:
UnsupportedOperationException

setId

public void setId(String id)

setMessage

public void setMessage(String message)
                throws UnsupportedOperationException
sets the default message that is displayed if a corresponding message key is not found in the messages properties file
default processed place holders are:

Specified by:
setMessage in interface Check
Overrides:
setMessage in class AbstractCheck
Throws:
UnsupportedOperationException

setSeverity

public void setSeverity(int severity)
                 throws UnsupportedOperationException

Specified by:
setSeverity in interface Check
Overrides:
setSeverity in class AbstractCheck
Parameters:
severity - the severity to set
Throws:
UnsupportedOperationException


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