org.hibernate.validator.cfg
Class ConstraintDef<C extends ConstraintDef<C,A>,A extends Annotation>

java.lang.Object
  extended by org.hibernate.validator.cfg.ConstraintDef<C,A>
Type Parameters:
C - The type of a concrete sub type. Following to the "self referencing generic type" pattern each sub type has to be parametrized with itself.
A - The constraint annotation type represented by a concrete sub type.
Direct Known Subclasses:
AssertFalseDef, AssertTrueDef, CreditCardNumberDef, DecimalMaxDef, DecimalMinDef, DigitsDef, EmailDef, FutureDef, GenericConstraintDef, LengthDef, MaxDef, MinDef, NotBlankDef, NotEmptyDef, NotNullDef, NullDef, PastDef, PatternDef, RangeDef, ScriptAssertDef, SizeDef, URLDef

public abstract class ConstraintDef<C extends ConstraintDef<C,A>,A extends Annotation>
extends Object

Base class for all constraint definition types. Each sub type represents a single constraint annotation type and allows to add this constraint to a bean class in a programmatic type-safe way with help of the ConstraintMapping API.

Author:
Hardy Ferentschik, Gunnar Morling

Field Summary
protected  Class<A> constraintType
          The constraint annotation type of this definition.
protected  Map<String,Object> parameters
          A map with the annotation parameters of this definition.
 
Constructor Summary
protected ConstraintDef(Class<A> constraintType)
           
protected ConstraintDef(ConstraintDef<?,A> original)
           
 
Method Summary
protected  C addParameter(String key, Object value)
           
 C groups(Class<?>... groups)
           
 C message(String message)
           
 C payload(Class<? extends Payload>... payload)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

constraintType

protected final Class<A extends Annotation> constraintType
The constraint annotation type of this definition.


parameters

protected final Map<String,Object> parameters
A map with the annotation parameters of this definition. Keys are property names of this definition's annotation type, values are annotation parameter values of the appropriate types.

Constructor Detail

ConstraintDef

protected ConstraintDef(Class<A> constraintType)

ConstraintDef

protected ConstraintDef(ConstraintDef<?,A> original)
Method Detail

addParameter

protected C addParameter(String key,
                         Object value)

message

public C message(String message)

groups

public C groups(Class<?>... groups)

payload

public C payload(Class<? extends Payload>... payload)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2007-2011 Red Hat Middleware, LLC. All Rights Reserved