org.hibernate.validator.cfg
Class ConstraintDef<C extends ConstraintDef<C,A>,A extends java.lang.annotation.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 java.lang.annotation.Annotation>
extends java.lang.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  java.lang.Class<A> constraintType
          The constraint annotation type of this definition.
protected  java.util.Map<java.lang.String,java.lang.Object> parameters
          A map with the annotation parameters of this definition.
 
Constructor Summary
protected ConstraintDef(java.lang.Class<A> constraintType)
           
protected ConstraintDef(ConstraintDef<?,A> original)
           
 
Method Summary
protected  C addParameter(java.lang.String key, java.lang.Object value)
           
 C groups(java.lang.Class<?>... groups)
           
 C message(java.lang.String message)
           
 C payload(java.lang.Class<? extends javax.validation.Payload>... payload)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

constraintType

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


parameters

protected final java.util.Map<java.lang.String,java.lang.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(java.lang.Class<A> constraintType)

ConstraintDef

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

addParameter

protected C addParameter(java.lang.String key,
                         java.lang.Object value)

message

public C message(java.lang.String message)

groups

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

payload

public C payload(java.lang.Class<? extends javax.validation.Payload>... payload)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2011 Oracle Corporation. All Rights Reserved.