jodd.vtor
Class ValidationContext

java.lang.Object
  extended by jodd.vtor.ValidationContext

public class ValidationContext
extends java.lang.Object

Validation context is set of all checks that can be applied on one target. Checks can be added manually or by parsing the class.


Field Summary
protected  java.util.Map<java.lang.String,java.util.List<Check>> map
           
 
Constructor Summary
ValidationContext()
           
 
Method Summary
 void add(Check check)
          Adds validation checks.
 void addAll(java.util.List<Check> checkList)
          Adds all checks from provided list.
 void addClassChecks(java.lang.Class target)
          Parses class annotations and adds all checks.
protected  void collectAnnotationChecks(java.util.List<Check> annChecks, java.lang.Class targetType, java.lang.String targetName, java.lang.annotation.Annotation[] annotations)
          Collect annotations for some target.
protected  void collectFieldAnnotationChecks(java.util.List<Check> annChecks, java.lang.reflect.Field field)
          Process all annotations of provided field.
protected  void copyDefaultCheckProperties(Check destCheck, java.lang.annotation.Annotation annotation)
          Copies default properties from annotation to the check.
protected
<V extends ValidationConstraint>
V
newConstraint(java.lang.Class<V> constraint, java.lang.Class targetType)
          Create new constraint.
static ValidationContext resolveFor(java.lang.Class<?> target)
          Resolve validation context for provided target class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected final java.util.Map<java.lang.String,java.util.List<Check>> map
Constructor Detail

ValidationContext

public ValidationContext()
Method Detail

add

public void add(Check check)
Adds validation checks.


addAll

public void addAll(java.util.List<Check> checkList)
Adds all checks from provided list.


resolveFor

public static ValidationContext resolveFor(java.lang.Class<?> target)
Resolve validation context for provided target class.

See Also:
addClassChecks(Class)

addClassChecks

public void addClassChecks(java.lang.Class target)
Parses class annotations and adds all checks.

See Also:
resolveFor(Class)

collectFieldAnnotationChecks

protected void collectFieldAnnotationChecks(java.util.List<Check> annChecks,
                                            java.lang.reflect.Field field)
Process all annotations of provided field.


collectAnnotationChecks

protected void collectAnnotationChecks(java.util.List<Check> annChecks,
                                       java.lang.Class targetType,
                                       java.lang.String targetName,
                                       java.lang.annotation.Annotation[] annotations)
Collect annotations for some target.


newConstraint

protected <V extends ValidationConstraint> V newConstraint(java.lang.Class<V> constraint,
                                                           java.lang.Class targetType)
                                                throws java.lang.Exception
Create new constraint. The following rules are used:
  • use default constructor if exist.
  • otherwise, use constructor with ValidationContext parameter.

    Throws:
    java.lang.Exception

  • copyDefaultCheckProperties

    protected void copyDefaultCheckProperties(Check destCheck,
                                              java.lang.annotation.Annotation annotation)
    Copies default properties from annotation to the check.



    Copyright © 2003-2011 Jodd Team