net.sf.oval.internal
Class ClassChecks

java.lang.Object
  extended by net.sf.oval.internal.ClassChecks

public final class ClassChecks
extends Object

This class holds the instantiated checks for a single class. Note: For performance reasons the collections are made public (intended for read-access only). Modifications to the collections should be done through the appropriate methods addXXX, removeXXX, clearXXX methods.

Author:
Sebastian Thomschke

Field Summary
 Map<Constructor<?>,Map<Integer,ParameterChecks>> checksForConstructorParameters
          checks on constructors' parameter values
 Map<Field,Set<Check>> checksForFields
          checks on fields' value
 Map<Method,Map<Integer,ParameterChecks>> checksForMethodParameters
          checks on methods' parameter values
 Map<Method,Set<Check>> checksForMethodReturnValues
          checks on methods' return value
 Map<Method,Set<PostCheck>> checksForMethodsPostExcecution
           
 Map<Method,Set<PreCheck>> checksForMethodsPreExecution
           
 Set<Check> checksForObject
          compound constraints / object level invariants
 Class<?> clazz
           
 Set<Field> constrainedFields
          all non-static fields that have value constraints.
 Set<Method> constrainedMethods
          all non-static non-void, non-parameterized methods marked as invariant that have return value constraints.
 Set<Field> constrainedStaticFields
          all non-static fields that have value constraints.
 Set<Method> constrainedStaticMethods
          all static non-void, non-parameterized methods marked as invariant that have return value constraints.
 boolean isCheckInvariants
           
 Set<AccessibleObject> methodsWithCheckInvariantsPost
           
 Set<Method> methodsWithCheckInvariantsPre
           
 
Constructor Summary
ClassChecks(Class<?> clazz, ParameterNameResolver parameterNameResolver)
          package constructor used by the Validator class
 
Method Summary
 void addConstructorParameterCheckExclusions(Constructor<?> constructor, int parameterIndex, CheckExclusion... exclusions)
          adds constraint check exclusions to a constructor parameter
 void addConstructorParameterCheckExclusions(Constructor<?> constructor, int parameterIndex, Collection<CheckExclusion> exclusions)
          adds constraint check exclusions to a constructor parameter
 void addConstructorParameterChecks(Constructor<?> constructor, int parameterIndex, Check... checks)
          adds constraint checks to a constructor parameter
 void addConstructorParameterChecks(Constructor<?> constructor, int parameterIndex, Collection<Check> checks)
          adds constraint checks to a constructor parameter
 void addFieldChecks(Field field, Check... checks)
          adds check constraints to a field
 void addFieldChecks(Field field, Collection<Check> checks)
          adds check constraints to a field
 void addMethodParameterCheckExclusions(Method method, int parameterIndex, CheckExclusion... exclusions)
          adds constraint check exclusions to a method parameter
 void addMethodParameterCheckExclusions(Method method, int parameterIndex, Collection<CheckExclusion> exclusions)
          adds constraint check exclusions to a method parameter
 void addMethodParameterChecks(Method method, int parameterIndex, Check... checks)
          adds constraint checks to a method parameter
 void addMethodParameterChecks(Method method, int parameterIndex, Collection<Check> checks)
          adds constraint checks to a method parameter
 void addMethodPostChecks(Method method, Collection<PostCheck> checks)
          adds constraint checks to a method's return value
 void addMethodPostChecks(Method method, PostCheck... checks)
          adds constraint checks to a method's return value
 void addMethodPreChecks(Method method, Collection<PreCheck> checks)
           
 void addMethodPreChecks(Method method, PreCheck... checks)
           
 void addMethodReturnValueChecks(Method method, Boolean isInvariant, Check... checks)
          adds constraint checks to a method's return value
 void addMethodReturnValueChecks(Method method, Boolean isInvariant, Collection<Check> checks)
          adds constraint checks to a method's return value
 void addObjectChecks(Check... checks)
          adds check constraints on object level (invariants)
 void addObjectChecks(Collection<Check> checks)
          adds check constraints on object level (invariants)
 void clear()
           
 void clearConstructorChecks(Constructor<?> constructor)
           
 void clearConstructorParameterChecks(Constructor<?> constructor)
           
 void clearConstructorParameterChecks(Constructor<?> constructor, int parameterIndex)
           
 void clearFieldChecks(Field field)
           
 void clearMethodChecks(Method method)
           
 void clearMethodParameterChecks(Method method)
           
 void clearMethodParameterChecks(Method method, int parameterIndex)
           
 void clearMethodPostChecks(Method method)
           
 void clearMethodPreChecks(Method method)
           
 void clearMethodReturnValueChecks(Method method)
           
 void clearObjectChecks()
           
 void removeConstructorParameterCheckExclusions(Constructor<?> constructor, int parameterIndex, CheckExclusion... exclusions)
           
 void removeConstructorParameterChecks(Constructor<?> constructor, int parameterIndex, Check... checks)
           
 void removeFieldChecks(Field field, Check... checks)
           
 void removeMethodParameterCheckExclusions(Method method, int parameterIndex, CheckExclusion... exclusions)
           
 void removeMethodParameterChecks(Method method, int parameterIndex, Check... checks)
           
 void removeMethodPostChecks(Method method, PostCheck... checks)
           
 void removeMethodPreChecks(Method method, PreCheck... checks)
           
 void removeMethodReturnValueChecks(Method method, Check... checks)
           
 void removeObjectChecks(Check... checks)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

checksForConstructorParameters

public final Map<Constructor<?>,Map<Integer,ParameterChecks>> checksForConstructorParameters
checks on constructors' parameter values


checksForFields

public final Map<Field,Set<Check>> checksForFields
checks on fields' value


checksForMethodParameters

public final Map<Method,Map<Integer,ParameterChecks>> checksForMethodParameters
checks on methods' parameter values


checksForMethodReturnValues

public final Map<Method,Set<Check>> checksForMethodReturnValues
checks on methods' return value


checksForMethodsPostExcecution

public final Map<Method,Set<PostCheck>> checksForMethodsPostExcecution

checksForMethodsPreExecution

public final Map<Method,Set<PreCheck>> checksForMethodsPreExecution

checksForObject

public final Set<Check> checksForObject
compound constraints / object level invariants


clazz

public final Class<?> clazz

constrainedFields

public final Set<Field> constrainedFields
all non-static fields that have value constraints. Validator loops over this set during validation.


constrainedMethods

public final Set<Method> constrainedMethods
all non-static non-void, non-parameterized methods marked as invariant that have return value constraints. Validator loops over this set during validation.


constrainedStaticFields

public final Set<Field> constrainedStaticFields
all non-static fields that have value constraints. Validator loops over this set during validation.


constrainedStaticMethods

public final Set<Method> constrainedStaticMethods
all static non-void, non-parameterized methods marked as invariant that have return value constraints. Validator loops over this set during validation.


isCheckInvariants

public boolean isCheckInvariants

methodsWithCheckInvariantsPost

public final Set<AccessibleObject> methodsWithCheckInvariantsPost

methodsWithCheckInvariantsPre

public final Set<Method> methodsWithCheckInvariantsPre
Constructor Detail

ClassChecks

public ClassChecks(Class<?> clazz,
                   ParameterNameResolver parameterNameResolver)
package constructor used by the Validator class

Parameters:
clazz -
Method Detail

addConstructorParameterCheckExclusions

public void addConstructorParameterCheckExclusions(Constructor<?> constructor,
                                                   int parameterIndex,
                                                   CheckExclusion... exclusions)
                                            throws InvalidConfigurationException
adds constraint check exclusions to a constructor parameter

Parameters:
constructor -
parameterIndex -
exclusions -
Throws:
InvalidConfigurationException - if the declaring class is not guarded by GuardAspect

addConstructorParameterCheckExclusions

public void addConstructorParameterCheckExclusions(Constructor<?> constructor,
                                                   int parameterIndex,
                                                   Collection<CheckExclusion> exclusions)
                                            throws InvalidConfigurationException
adds constraint check exclusions to a constructor parameter

Parameters:
constructor -
parameterIndex -
exclusions -
Throws:
InvalidConfigurationException - if the declaring class is not guarded by GuardAspect

addConstructorParameterChecks

public void addConstructorParameterChecks(Constructor<?> constructor,
                                          int parameterIndex,
                                          Check... checks)
                                   throws InvalidConfigurationException
adds constraint checks to a constructor parameter

Parameters:
constructor -
parameterIndex -
checks -
Throws:
InvalidConfigurationException - if the declaring class is not guarded by GuardAspect

addConstructorParameterChecks

public void addConstructorParameterChecks(Constructor<?> constructor,
                                          int parameterIndex,
                                          Collection<Check> checks)
                                   throws InvalidConfigurationException
adds constraint checks to a constructor parameter

Parameters:
constructor -
parameterIndex -
checks -
Throws:
InvalidConfigurationException - if the declaring class is not guarded by GuardAspect

addFieldChecks

public void addFieldChecks(Field field,
                           Check... checks)
                    throws InvalidConfigurationException
adds check constraints to a field

Parameters:
field -
checks -
Throws:
InvalidConfigurationException

addFieldChecks

public void addFieldChecks(Field field,
                           Collection<Check> checks)
                    throws InvalidConfigurationException
adds check constraints to a field

Parameters:
field -
checks -
Throws:
InvalidConfigurationException

addMethodParameterCheckExclusions

public void addMethodParameterCheckExclusions(Method method,
                                              int parameterIndex,
                                              CheckExclusion... exclusions)
                                       throws InvalidConfigurationException
adds constraint check exclusions to a method parameter

Parameters:
method -
parameterIndex -
exclusions -
Throws:
InvalidConfigurationException - if the declaring class is not guarded by GuardAspect

addMethodParameterCheckExclusions

public void addMethodParameterCheckExclusions(Method method,
                                              int parameterIndex,
                                              Collection<CheckExclusion> exclusions)
                                       throws InvalidConfigurationException
adds constraint check exclusions to a method parameter

Parameters:
method -
parameterIndex -
exclusions -
Throws:
InvalidConfigurationException - if the declaring class is not guarded by GuardAspect

addMethodParameterChecks

public void addMethodParameterChecks(Method method,
                                     int parameterIndex,
                                     Check... checks)
                              throws InvalidConfigurationException
adds constraint checks to a method parameter

Parameters:
method -
parameterIndex -
checks -
Throws:
InvalidConfigurationException - if the declaring class is not guarded by GuardAspect

addMethodParameterChecks

public void addMethodParameterChecks(Method method,
                                     int parameterIndex,
                                     Collection<Check> checks)
                              throws InvalidConfigurationException
adds constraint checks to a method parameter

Parameters:
method -
parameterIndex -
checks -
Throws:
InvalidConfigurationException - if the declaring class is not guarded by GuardAspect

addMethodPostChecks

public void addMethodPostChecks(Method method,
                                Collection<PostCheck> checks)
                         throws InvalidConfigurationException
adds constraint checks to a method's return value

Parameters:
method -
checks -
Throws:
InvalidConfigurationException - if the declaring class is not guarded by GuardAspect

addMethodPostChecks

public void addMethodPostChecks(Method method,
                                PostCheck... checks)
                         throws InvalidConfigurationException
adds constraint checks to a method's return value

Parameters:
method -
checks -
Throws:
InvalidConfigurationException - if the declaring class is not guarded by GuardAspect

addMethodPreChecks

public void addMethodPreChecks(Method method,
                               Collection<PreCheck> checks)
                        throws InvalidConfigurationException
Parameters:
method -
checks -
Throws:
InvalidConfigurationException - if the declaring class is not guarded by GuardAspect

addMethodPreChecks

public void addMethodPreChecks(Method method,
                               PreCheck... checks)
                        throws InvalidConfigurationException
Parameters:
method -
checks -
Throws:
InvalidConfigurationException - if the declaring class is not guarded by GuardAspect

addMethodReturnValueChecks

public void addMethodReturnValueChecks(Method method,
                                       Boolean isInvariant,
                                       Check... checks)
                                throws InvalidConfigurationException
adds constraint checks to a method's return value

Parameters:
method -
isInvariant - determines if the return value should be checked when the object is validated, can be null
checks -
Throws:
InvalidConfigurationException

addMethodReturnValueChecks

public void addMethodReturnValueChecks(Method method,
                                       Boolean isInvariant,
                                       Collection<Check> checks)
                                throws InvalidConfigurationException
adds constraint checks to a method's return value

Parameters:
method -
isInvariant - determines if the return value should be checked when the object is validated, can be null
checks -
Throws:
InvalidConfigurationException

addObjectChecks

public void addObjectChecks(Check... checks)
adds check constraints on object level (invariants)

Parameters:
checks -

addObjectChecks

public void addObjectChecks(Collection<Check> checks)
adds check constraints on object level (invariants)

Parameters:
checks -

clear

public void clear()

clearConstructorChecks

public void clearConstructorChecks(Constructor<?> constructor)

clearConstructorParameterChecks

public void clearConstructorParameterChecks(Constructor<?> constructor)

clearConstructorParameterChecks

public void clearConstructorParameterChecks(Constructor<?> constructor,
                                            int parameterIndex)

clearFieldChecks

public void clearFieldChecks(Field field)

clearMethodChecks

public void clearMethodChecks(Method method)

clearMethodParameterChecks

public void clearMethodParameterChecks(Method method)

clearMethodParameterChecks

public void clearMethodParameterChecks(Method method,
                                       int parameterIndex)

clearMethodPostChecks

public void clearMethodPostChecks(Method method)

clearMethodPreChecks

public void clearMethodPreChecks(Method method)

clearMethodReturnValueChecks

public void clearMethodReturnValueChecks(Method method)

clearObjectChecks

public void clearObjectChecks()

removeConstructorParameterCheckExclusions

public void removeConstructorParameterCheckExclusions(Constructor<?> constructor,
                                                      int parameterIndex,
                                                      CheckExclusion... exclusions)

removeConstructorParameterChecks

public void removeConstructorParameterChecks(Constructor<?> constructor,
                                             int parameterIndex,
                                             Check... checks)

removeFieldChecks

public void removeFieldChecks(Field field,
                              Check... checks)

removeMethodParameterCheckExclusions

public void removeMethodParameterCheckExclusions(Method method,
                                                 int parameterIndex,
                                                 CheckExclusion... exclusions)

removeMethodParameterChecks

public void removeMethodParameterChecks(Method method,
                                        int parameterIndex,
                                        Check... checks)
                                 throws InvalidConfigurationException
Throws:
InvalidConfigurationException

removeMethodPostChecks

public void removeMethodPostChecks(Method method,
                                   PostCheck... checks)

removeMethodPreChecks

public void removeMethodPreChecks(Method method,
                                  PreCheck... checks)

removeMethodReturnValueChecks

public void removeMethodReturnValueChecks(Method method,
                                          Check... checks)

removeObjectChecks

public void removeObjectChecks(Check... checks)


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