org.hibernate.validator.cfg
Class ConstraintsForType

java.lang.Object
  extended by org.hibernate.validator.cfg.ConstraintsForType

public final class ConstraintsForType
extends Object

Via instances of this class constraints and cascading properties can be configured for a single bean class.

Author:
Hardy Ferentschik

Constructor Summary
ConstraintsForType(Class<?> beanClass, ConstraintMapping mapping)
           
ConstraintsForType(Class<?> beanClass, String property, ElementType type, ConstraintMapping mapping)
           
 
Method Summary
<A extends Annotation,T extends ConstraintDef<A>>
T
constraint(Class<T> definition)
          Add a new constraint.
 ConstraintsForType defaultGroupSequence(Class<?>... defaultGroupSequence)
          Defines the default groups sequence for the bean class of this instance.
 ConstraintsForType property(String property, ElementType type)
          Changes the property for which added constraints apply.
 ConstraintsForType type(Class<?> type)
          Creates a new ConstraintsForType in order to define constraints on a new bean type.
 ConstraintsForType valid(String property, ElementType type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstraintsForType

public ConstraintsForType(Class<?> beanClass,
                          ConstraintMapping mapping)

ConstraintsForType

public ConstraintsForType(Class<?> beanClass,
                          String property,
                          ElementType type,
                          ConstraintMapping mapping)
Method Detail

constraint

public <A extends Annotation,T extends ConstraintDef<A>> T constraint(Class<T> definition)
Add a new constraint.

Parameters:
definition - The constraint definition class
Returns:
A constraint definition class allowing to specify additional constraint parameters.

property

public ConstraintsForType property(String property,
                                   ElementType type)
Changes the property for which added constraints apply. Until this method is called constraints apply on class level. After calling this method constraints apply on the specified property with the given access type.

Parameters:
property - The property on which to apply the following constraints (Java Bean notation)
type - The access type (field/property)
Returns:
Returns itself for method chaining

valid

public ConstraintsForType valid(String property,
                                ElementType type)

defaultGroupSequence

public ConstraintsForType defaultGroupSequence(Class<?>... defaultGroupSequence)
Defines the default groups sequence for the bean class of this instance.

Parameters:
defaultGroupSequence - the default group sequence.
Returns:
Returns itself for method chaining.

type

public ConstraintsForType type(Class<?> type)
Creates a new ConstraintsForType in order to define constraints on a new bean type.

Parameters:
type - the bean type
Returns:
a new ConstraintsForType instance


Copyright © 2011 Oracle Corporation. All Rights Reserved.