net.sf.oval.guard
Class Guard

java.lang.Object
  extended by net.sf.oval.Validator
      extended by net.sf.oval.guard.Guard
All Implemented Interfaces:
IValidator

public class Guard
extends Validator

Extended version of the validator to realize programming by contract.

Author:
Sebastian Thomschke

Nested Class Summary
protected static class Guard.GuardMethodPreResult
          Note: Only required until AspectJ allows throwing of checked exceptions
 
Nested classes/interfaces inherited from class net.sf.oval.Validator
Validator.DelegatingParameterNameResolver
 
Field Summary
protected static Guard.GuardMethodPreResult DO_NOT_PROCEED
          Note: Only required until AspectJ allows throwing of checked exceptions
 
Fields inherited from class net.sf.oval.Validator
currentlyValidatedObjects, currentViolations, expressionLanguageRegistry, ognRegistry, parameterNameResolver
 
Constructor Summary
Guard()
          Constructs a new guard object and uses a new instance of AnnotationsConfigurer
Guard(Collection<Configurer> configurers)
           
Guard(Configurer... configurers)
           
 
Method Summary
 void addCheckExclusions(Constructor<?> ctor, int paramIndex, CheckExclusion... exclusions)
          Registers constraint checks for the given constructor parameter
 void addCheckExclusions(Method method, int paramIndex, CheckExclusion... exclusions)
          Registers constraint checks for the given method parameter
 void addChecks(Constructor<?> ctor, int paramIndex, Check... checks)
          Registers constraint checks for the given constructor parameter
 void addChecks(Method method, Check... checks)
          Registers constraint checks for the given method's return value
 void addChecks(Method method, int paramIndex, Check... checks)
          Registers constraint checks for the given method parameter
 void addChecks(Method method, PostCheck... checks)
          Registers post condition checks to a method's return value
 void addChecks(Method method, PreCheck... checks)
          Registers pre condition checks to a method's return value
 boolean addListener(ConstraintsViolatedListener listener)
          Registers the given listener for all thrown ConstraintViolationExceptions
 boolean addListener(ConstraintsViolatedListener listener, Class<?> guardedClass)
          Registers the given listener for all thrown ConstraintViolationExceptions on objects of the given class
 boolean addListener(ConstraintsViolatedListener listener, Object guardedObject)
          Registers the given listener for all thrown ConstraintViolationExceptions on objects of the given object
protected  Map<PostCheck,Object> calculateMethodPostOldValues(Object validatedObject, Method method, Object[] args)
          Evaluates the old expression
 ProbeModeListener disableProbeMode(Object guardedObject)
          Disables the probe mode for the given object in the current thread.
 void enableProbeMode(Object guardedObject)
          Enables the probe mode for the given object in the current thread.
 Check[] getChecks(Method method, int paramIndex)
          Returns the registers constraint pre condition checks for the given method parameter
 PostCheck[] getChecksPost(Method method)
          Returns the registered post condition checks for the given method
 PreCheck[] getChecksPre(Method method)
          Returns the registered pre condition checks for the given method.
 ParameterNameResolver getParameterNameResolver()
           
protected  void guardConstructorPost(Object guardedObject, Constructor<?> ctor, Object[] args)
          This method is provided for use by guard aspects.
protected  void guardConstructorPre(Object guardedObject, Constructor<?> ctor, Object[] args)
          This method is provided for use by guard aspects.
protected  Object guardMethod(Object guardedObject, Method method, Object[] args, Invocable invocable)
          This method is provided for use by guard aspects.
protected  void guardMethodPost(Object returnValue, Guard.GuardMethodPreResult preResult)
          Note: Only required until AspectJ allows throwing of checked exceptions, then guardMethod(Object, Method, Object[], Invocable) can be used instead This method is provided for use by guard aspects.
protected  Guard.GuardMethodPreResult guardMethodPre(Object guardedObject, Method method, Object[] args)
          Note: Only required until AspectJ allows throwing of checked exceptions, then guardMethod(Object, Method, Object[], Invocable) can be used instead This method is provided for use by guard aspects.
 boolean hasListener(ConstraintsViolatedListener listener)
           
 boolean hasListener(ConstraintsViolatedListener listener, Class<?> guardedClass)
           
 boolean hasListener(ConstraintsViolatedListener listener, Object guardedObject)
           
 boolean isActivated()
           
 boolean isInProbeMode(Object guardedObject)
          Determines if the probe mode is enabled for the given object in the current thread.
 boolean isInvariantsEnabled()
          Determines if invariants are checked prior and after every call to a non-private method or constructor.
 boolean isInvariantsEnabled(Class<?> guardedClass)
          Determines if invariants are checked prior and after every call to a non-private method or constructor.
 boolean isPostConditionsEnabled()
           
 boolean isPreConditionsEnabled()
           
protected  void notifyListeners(Object guardedObject, ConstraintsViolatedException ex)
          notifies all registered validation listener about the occurred constraint violation exception
 void removeCheckExclusions(Constructor<?> ctor, int paramIndex, CheckExclusion... exclusions)
          Removes constraint check exclusions from the given constructor parameter
 void removeCheckExclusions(Method method, int paramIndex, CheckExclusion... exclusions)
          Removes constraint check exclusions from the given method parameter
 void removeChecks(Constructor<?> ctor, int paramIndex, Check... checks)
          Removes constraint checks from the given constructor parameter
 void removeChecks(Method method, int paramIndex, Check... checks)
          Removes constraint checks for the given method parameter
 void removeChecks(Method method, PostCheck... checks)
          Registers post condition checks to a method's return value
 void removeChecks(Method method, PreCheck... checks)
          Registers pre condition checks to a method's return value
 boolean removeListener(ConstraintsViolatedListener listener)
          Removes the given listener
 boolean removeListener(ConstraintsViolatedListener listener, Class<?> guardedClass)
          Removes the given listener
 boolean removeListener(ConstraintsViolatedListener listener, Object guardedObject)
          Removes the given listener
 void setActivated(boolean isActivated)
          If set to false OVal's programming by contract features are disabled and constraints are not checked automatically during runtime.
 void setInvariantsEnabled(boolean isEnabled)
          Specifies if invariants are checked prior and after calls to non-private methods and constructors.
 void setInvariantsEnabled(Class<?> guardedClass, boolean isEnabled)
          Specifies if invariants are checked prior and after calls to non-private methods and constructors.
 void setParameterNameResolver(ParameterNameResolver parameterNameResolver)
           
 void setPostConditionsEnabled(boolean isEnabled)
           
 void setPreConditionsEnabled(boolean isEnabled)
           
protected  List<ConstraintViolation> validateConstructorParameters(Object validatedObject, Constructor<?> constructor, Object[] argsToValidate)
          Validates the give arguments against the defined constructor parameter constraints.
protected  void validateInvariants(Object guardedObject, List<ConstraintViolation> violations, String[] profiles)
          validates the field and getter constrains of the given object.
protected  void validateMethodParameters(Object validatedObject, Method method, Object[] args, List<ConstraintViolation> violations)
          Validates the pre conditions for a method call.
protected  void validateMethodPost(Object validatedObject, Method method, Object[] args, Object returnValue, Map<PostCheck,Object> oldValues, List<ConstraintViolation> violations)
          Validates the post conditions for a method call.
protected  void validateMethodPre(Object validatedObject, Method method, Object[] args, List<ConstraintViolation> violations)
          Validates the @Pre conditions for a method call.
protected  void validateMethodReturnValue(Object validatedObject, Method method, Object returnValue, List<ConstraintViolation> violations)
          Validates the return value checks for a method call.
 
Methods inherited from class net.sf.oval.Validator
addChecks, addChecks, addConstraintSet, assertValid, assertValidFieldValue, checkConstraint, checkConstraintAssertConstraintSet, checkConstraintAssertFieldConstraints, checkConstraintAssertValid, disableAllProfiles, disableProfile, enableAllProfiles, enableProfile, getChecks, getChecks, getChecks, getClassChecks, getCollectionFactory, getConfigurers, getConstraintSet, getContextRenderer, getExceptionTranslator, getExpressionLanguageRegistry, getLocaleProvider, getLoggerFactory, getMessageResolver, getMessageValueFormatter, getObjectGraphNavigatorRegistry, isAnyProfileEnabled, isCurrentlyValidated, isProfileEnabled, reconfigureChecks, removeChecks, removeChecks, removeChecks, removeConstraintSet, renderMessage, reportConstraintViolation, resolveValue, resolveValue, setCollectionFactory, setContextRenderer, setExceptionTranslator, setLocaleProvider, setLoggerFactory, setMessageResolver, setMessageValueFormatter, translateException, validate, validate, validateFieldValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DO_NOT_PROCEED

protected static final Guard.GuardMethodPreResult DO_NOT_PROCEED
Note: Only required until AspectJ allows throwing of checked exceptions

Constructor Detail

Guard

public Guard()
Constructs a new guard object and uses a new instance of AnnotationsConfigurer


Guard

public Guard(Collection<Configurer> configurers)

Guard

public Guard(Configurer... configurers)
Method Detail

addCheckExclusions

public void addCheckExclusions(Constructor<?> ctor,
                               int paramIndex,
                               CheckExclusion... exclusions)
                        throws IllegalArgumentException,
                               InvalidConfigurationException
Registers constraint checks for the given constructor parameter

Parameters:
ctor -
paramIndex -
exclusions -
Throws:
IllegalArgumentException - if method == null or exclusions == null or exclusions is empty
InvalidConfigurationException - if the declaring class is not guarded or the parameterIndex is out of range

addCheckExclusions

public void addCheckExclusions(Method method,
                               int paramIndex,
                               CheckExclusion... exclusions)
                        throws IllegalArgumentException,
                               InvalidConfigurationException
Registers constraint checks for the given method parameter

Parameters:
method -
paramIndex -
exclusions -
Throws:
IllegalArgumentException - if method == null or exclusions == null or exclusions is empty
InvalidConfigurationException - if the declaring class is not guarded or the parameterIndex is out of range

addChecks

public void addChecks(Constructor<?> ctor,
                      int paramIndex,
                      Check... checks)
               throws IllegalArgumentException,
                      InvalidConfigurationException
Registers constraint checks for the given constructor parameter

Parameters:
ctor -
paramIndex -
checks -
Throws:
IllegalArgumentException - if constructor == null or checks == null or checks is empty
InvalidConfigurationException - if the declaring class is not guarded or the parameterIndex is out of range

addChecks

public void addChecks(Method method,
                      Check... checks)
               throws IllegalArgumentException,
                      InvalidConfigurationException
Registers constraint checks for the given method's return value

Overrides:
addChecks in class Validator
Parameters:
method -
checks -
Throws:
IllegalArgumentException - if getter == null or checks == null or checks is empty
InvalidConfigurationException - if method does not declare a return type (void), or the declaring class is not guarded

addChecks

public void addChecks(Method method,
                      int paramIndex,
                      Check... checks)
               throws IllegalArgumentException,
                      InvalidConfigurationException
Registers constraint checks for the given method parameter

Parameters:
method -
paramIndex -
checks -
Throws:
IllegalArgumentException - if method == null or checks == null or checks is empty
InvalidConfigurationException - if the declaring class is not guarded or the parameterIndex is out of range

addChecks

public void addChecks(Method method,
                      PostCheck... checks)
               throws IllegalArgumentException,
                      InvalidConfigurationException
Registers post condition checks to a method's return value

Parameters:
method -
checks -
Throws:
IllegalArgumentException - if method == null or checks == null or checks is empty
InvalidConfigurationException - if the declaring class is not guarded

addChecks

public void addChecks(Method method,
                      PreCheck... checks)
               throws IllegalArgumentException,
                      InvalidConfigurationException
Registers pre condition checks to a method's return value

Parameters:
method -
checks -
Throws:
IllegalArgumentException - if method == null or checks == null or checks is empty
InvalidConfigurationException - if the declaring class is not guarded

addListener

public boolean addListener(ConstraintsViolatedListener listener)
                    throws IllegalArgumentException
Registers the given listener for all thrown ConstraintViolationExceptions

Parameters:
listener - the listener to register
Returns:
true if the listener was not yet registered
Throws:
IllegalArgumentException - if listener == null

addListener

public boolean addListener(ConstraintsViolatedListener listener,
                           Class<?> guardedClass)
                    throws IllegalArgumentException
Registers the given listener for all thrown ConstraintViolationExceptions on objects of the given class

Parameters:
listener - the listener to register
guardedClass - guarded class or interface
Returns:
true if the listener was not yet registered
Throws:
IllegalArgumentException - if listener == null or guardedClass == null

addListener

public boolean addListener(ConstraintsViolatedListener listener,
                           Object guardedObject)
Registers the given listener for all thrown ConstraintViolationExceptions on objects of the given object

Parameters:
listener - the listener to register
guardedObject -
Returns:
true if the listener was not yet registered
Throws:
IllegalArgumentException - if listener == null or guardedObject == null

calculateMethodPostOldValues

protected Map<PostCheck,Object> calculateMethodPostOldValues(Object validatedObject,
                                                             Method method,
                                                             Object[] args)
                                                      throws ValidationFailedException
Evaluates the old expression

Parameters:
validatedObject -
method -
args -
Returns:
null if no violation, otherwise a list
Throws:
ValidationFailedException

disableProbeMode

public ProbeModeListener disableProbeMode(Object guardedObject)
                                   throws IllegalArgumentException,
                                          IllegalStateException
Disables the probe mode for the given object in the current thread.

Parameters:
guardedObject - the object to disable the probe mode for
Throws:
IllegalArgumentException - if guardedObject == null
IllegalStateException - in case probe mode was not enabled for the given object

enableProbeMode

public void enableProbeMode(Object guardedObject)
                     throws IllegalArgumentException,
                            IllegalStateException
Enables the probe mode for the given object in the current thread. In probe mode calls to methods of an object are not actually executed. OVal only validates method pre-conditions and notifies ConstraintViolationListeners but does not throw ConstraintViolationExceptions. Methods with return values will return null.

Parameters:
guardedObject - the object to enable the probe mode for
Throws:
IllegalArgumentException - if guardedObject == null
IllegalStateException - if the probe mode is already enabled

getChecks

public Check[] getChecks(Method method,
                         int paramIndex)
                  throws InvalidConfigurationException
Returns the registers constraint pre condition checks for the given method parameter

Parameters:
method -
paramIndex -
Throws:
IllegalArgumentException - if method == null
InvalidConfigurationException

getChecksPost

public PostCheck[] getChecksPost(Method method)
                          throws IllegalArgumentException
Returns the registered post condition checks for the given method

Parameters:
method -
Throws:
IllegalArgumentException - if method == null

getChecksPre

public PreCheck[] getChecksPre(Method method)
                        throws IllegalArgumentException
Returns the registered pre condition checks for the given method.

Parameters:
method -
Throws:
IllegalArgumentException - if method == null

getParameterNameResolver

public ParameterNameResolver getParameterNameResolver()
Returns:
the parameterNameResolver

guardConstructorPost

protected void guardConstructorPost(Object guardedObject,
                                    Constructor<?> ctor,
                                    Object[] args)
                             throws ConstraintsViolatedException,
                                    ValidationFailedException
This method is provided for use by guard aspects.

Throws:
ConstraintsViolatedException
ValidationFailedException

guardConstructorPre

protected void guardConstructorPre(Object guardedObject,
                                   Constructor<?> ctor,
                                   Object[] args)
                            throws ConstraintsViolatedException,
                                   ValidationFailedException
This method is provided for use by guard aspects.

Throws:
ConstraintsViolatedException - if anything precondition is not satisfied
ValidationFailedException

guardMethod

protected Object guardMethod(Object guardedObject,
                             Method method,
                             Object[] args,
                             Invocable invocable)
                      throws Throwable
This method is provided for use by guard aspects.

Parameters:
guardedObject -
method -
args -
invocable -
Returns:
The method return value or null if the guarded object is in probe mode.
Throws:
ConstraintsViolatedException - if an constraint violation occurs and the validated object is not in probe mode.
ValidationFailedException
Throwable

guardMethodPost

protected void guardMethodPost(Object returnValue,
                               Guard.GuardMethodPreResult preResult)
                        throws ConstraintsViolatedException,
                               ValidationFailedException
Note: Only required until AspectJ allows throwing of checked exceptions, then guardMethod(Object, Method, Object[], Invocable) can be used instead This method is provided for use by guard aspects.

Parameters:
returnValue -
preResult -
Throws:
ConstraintsViolatedException - if an constraint violation occurs and the validated object is not in probe mode.
ValidationFailedException

guardMethodPre

protected Guard.GuardMethodPreResult guardMethodPre(Object guardedObject,
                                                    Method method,
                                                    Object[] args)
                                             throws ConstraintsViolatedException,
                                                    ValidationFailedException
Note: Only required until AspectJ allows throwing of checked exceptions, then guardMethod(Object, Method, Object[], Invocable) can be used instead This method is provided for use by guard aspects.

Parameters:
guardedObject -
method -
args -
Returns:
Null if method guarding is deactivated or a result object that needs to be passed to guardMethodPost(Object, GuardMethodPreResult)
Throws:
ConstraintsViolatedException - if an constraint violation occurs and the validated object is not in probe mode.
ValidationFailedException

hasListener

public boolean hasListener(ConstraintsViolatedListener listener)
                    throws IllegalArgumentException
Parameters:
listener -
Returns:
true if the listener is registered
Throws:
IllegalArgumentException - if listener == null

hasListener

public boolean hasListener(ConstraintsViolatedListener listener,
                           Class<?> guardedClass)
                    throws IllegalArgumentException
Parameters:
listener -
guardedClass - guarded class or interface
Returns:
true if the listener is registered
Throws:
IllegalArgumentException - if listener == null or guardedClass == null

hasListener

public boolean hasListener(ConstraintsViolatedListener listener,
                           Object guardedObject)
                    throws IllegalArgumentException
Parameters:
listener -
guardedObject -
Returns:
true if the listener is registered
Throws:
IllegalArgumentException - if listener == null or guardedObject == null

isActivated

public boolean isActivated()
Returns:
the isEnabled

isInProbeMode

public boolean isInProbeMode(Object guardedObject)
Determines if the probe mode is enabled for the given object in the current thread. In probe mode calls to methods of an object are not actually executed. OVal only validates method pre-conditions and notifies ConstraintViolationListeners but does not throw ConstraintViolationExceptions. Methods with return values will return null.

Parameters:
guardedObject -
Returns:
true if exceptions are suppressed

isInvariantsEnabled

public boolean isInvariantsEnabled()
Determines if invariants are checked prior and after every call to a non-private method or constructor.

Returns:
the isInvariantChecksActivated

isInvariantsEnabled

public boolean isInvariantsEnabled(Class<?> guardedClass)
Determines if invariants are checked prior and after every call to a non-private method or constructor.

Parameters:
guardedClass - the guarded class
Returns:
the isInvariantChecksActivated

isPostConditionsEnabled

public boolean isPostConditionsEnabled()
Returns:
the isPostChecksActivated

isPreConditionsEnabled

public boolean isPreConditionsEnabled()
Returns:
the isPreChecksActivated

notifyListeners

protected void notifyListeners(Object guardedObject,
                               ConstraintsViolatedException ex)
notifies all registered validation listener about the occurred constraint violation exception


removeCheckExclusions

public void removeCheckExclusions(Constructor<?> ctor,
                                  int paramIndex,
                                  CheckExclusion... exclusions)
                           throws InvalidConfigurationException
Removes constraint check exclusions from the given constructor parameter

Parameters:
ctor -
paramIndex -
exclusions -
Throws:
InvalidConfigurationException - if the declaring class is not guarded or the parameterIndex is out of range

removeCheckExclusions

public void removeCheckExclusions(Method method,
                                  int paramIndex,
                                  CheckExclusion... exclusions)
                           throws InvalidConfigurationException
Removes constraint check exclusions from the given method parameter

Parameters:
method -
paramIndex -
exclusions -
Throws:
InvalidConfigurationException - if the declaring class is not guarded or the parameterIndex is out of range

removeChecks

public void removeChecks(Constructor<?> ctor,
                         int paramIndex,
                         Check... checks)
                  throws InvalidConfigurationException
Removes constraint checks from the given constructor parameter

Parameters:
ctor -
paramIndex -
checks -
Throws:
InvalidConfigurationException - if the declaring class is not guarded or the parameterIndex is out of range

removeChecks

public void removeChecks(Method method,
                         int paramIndex,
                         Check... checks)
                  throws InvalidConfigurationException
Removes constraint checks for the given method parameter

Parameters:
method -
paramIndex -
checks -
Throws:
IllegalArgumentException - if constructor == null or checks == null or checks is empty
InvalidConfigurationException - if the parameterIndex is out of range

removeChecks

public void removeChecks(Method method,
                         PostCheck... checks)
                  throws InvalidConfigurationException
Registers post condition checks to a method's return value

Parameters:
method -
checks -
Throws:
IllegalArgumentException - if method == null or checks == null or checks is empty
InvalidConfigurationException - if the declaring class is not guarded

removeChecks

public void removeChecks(Method method,
                         PreCheck... checks)
                  throws InvalidConfigurationException
Registers pre condition checks to a method's return value

Parameters:
method -
checks -
Throws:
IllegalArgumentException - if method == null or checks == null or checks is empty
InvalidConfigurationException - if the declaring class is not guarded

removeListener

public boolean removeListener(ConstraintsViolatedListener listener)
                       throws IllegalArgumentException
Removes the given listener

Parameters:
listener -
Returns:
true if the listener was registered
Throws:
IllegalArgumentException - if listener == null

removeListener

public boolean removeListener(ConstraintsViolatedListener listener,
                              Class<?> guardedClass)
                       throws IllegalArgumentException
Removes the given listener

Parameters:
listener -
guardedClass - guarded class or interface
Returns:
true if the listener was registered
Throws:
IllegalArgumentException - if listener == null or guardedClass == null

removeListener

public boolean removeListener(ConstraintsViolatedListener listener,
                              Object guardedObject)
                       throws IllegalArgumentException
Removes the given listener

Parameters:
listener -
guardedObject -
Returns:
true if the listener was registered
Throws:
IllegalArgumentException - if listener == null or guardedObject == null

setActivated

public void setActivated(boolean isActivated)
If set to false OVal's programming by contract features are disabled and constraints are not checked automatically during runtime.

Parameters:
isActivated - the isActivated to set

setInvariantsEnabled

public void setInvariantsEnabled(boolean isEnabled)
Specifies if invariants are checked prior and after calls to non-private methods and constructors.

Parameters:
isEnabled - the isInvariantsEnabled to set

setInvariantsEnabled

public void setInvariantsEnabled(Class<?> guardedClass,
                                 boolean isEnabled)
Specifies if invariants are checked prior and after calls to non-private methods and constructors.

Parameters:
guardedClass - the guarded class to turn on/off the invariant checking
isEnabled - the isEnabled to set

setParameterNameResolver

public void setParameterNameResolver(ParameterNameResolver parameterNameResolver)
                              throws IllegalArgumentException
Parameters:
parameterNameResolver - the parameterNameResolver to set, cannot be null
Throws:
IllegalArgumentException - if parameterNameResolver == null

setPostConditionsEnabled

public void setPostConditionsEnabled(boolean isEnabled)
Parameters:
isEnabled - the isEnabled to set

setPreConditionsEnabled

public void setPreConditionsEnabled(boolean isEnabled)
Parameters:
isEnabled - the isEnabled to set

validateConstructorParameters

protected List<ConstraintViolation> validateConstructorParameters(Object validatedObject,
                                                                  Constructor<?> constructor,
                                                                  Object[] argsToValidate)
                                                           throws ValidationFailedException
Validates the give arguments against the defined constructor parameter constraints.

Returns:
null if no violation, otherwise a list
Throws:
ValidationFailedException

validateInvariants

protected void validateInvariants(Object guardedObject,
                                  List<ConstraintViolation> violations,
                                  String[] profiles)
                           throws IllegalArgumentException,
                                  ValidationFailedException
validates the field and getter constrains of the given object. if the given object is a class the static fields and getters are validated.

Overrides:
validateInvariants in class Validator
Parameters:
guardedObject - the object to validate, cannot be null
Throws:
IllegalArgumentException - if validatedObject == null
ValidationFailedException

validateMethodParameters

protected void validateMethodParameters(Object validatedObject,
                                        Method method,
                                        Object[] args,
                                        List<ConstraintViolation> violations)
                                 throws ValidationFailedException
Validates the pre conditions for a method call.

Throws:
ValidationFailedException

validateMethodPost

protected void validateMethodPost(Object validatedObject,
                                  Method method,
                                  Object[] args,
                                  Object returnValue,
                                  Map<PostCheck,Object> oldValues,
                                  List<ConstraintViolation> violations)
                           throws ValidationFailedException
Validates the post conditions for a method call.

Throws:
ValidationFailedException

validateMethodPre

protected void validateMethodPre(Object validatedObject,
                                 Method method,
                                 Object[] args,
                                 List<ConstraintViolation> violations)
                          throws ValidationFailedException
Validates the @Pre conditions for a method call.

Throws:
ValidationFailedException

validateMethodReturnValue

protected void validateMethodReturnValue(Object validatedObject,
                                         Method method,
                                         Object returnValue,
                                         List<ConstraintViolation> violations)
                                  throws ValidationFailedException
Validates the return value checks for a method call.

Throws:
ValidationFailedException


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