Class TypeConstraintMappingContextImpl<C>
- java.lang.Object
-
- org.hibernate.validator.internal.cfg.context.TypeConstraintMappingContextImpl<C>
-
- Type Parameters:
C- The type represented by this creational context.
- All Implemented Interfaces:
AnnotationIgnoreOptions<TypeConstraintMappingContext<C>>,AnnotationProcessingOptions<TypeConstraintMappingContext<C>>,Constrainable<TypeConstraintMappingContext<C>>,ConstraintDefinitionTarget,ConstraintMappingTarget,ConstructorTarget,MethodTarget,PropertyTarget,TypeConstraintMappingContext<C>,TypeTarget
public final class TypeConstraintMappingContextImpl<C> extends Object implements TypeConstraintMappingContext<C>
Constraint mapping creational context which allows to configure the class-level constraints for one bean.- Author:
- Hardy Ferentschik, Gunnar Morling, Kevin Pollet <kevin.pollet@serli.com> (C) 2011 SERLI, Marko Bekhta
-
-
Field Summary
Fields Modifier and Type Field Description protected DefaultConstraintMappingmapping
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddConstraint(org.hibernate.validator.internal.cfg.context.ConfiguredConstraint<?> constraint)Adds a constraint to the set of constraints managed by this creational context.TypeConstraintMappingContext<C>constraint(ConstraintDef<?,?> definition)Adds a new constraint.<A extends Annotation>
ConstraintDefinitionContext<A>constraintDefinition(Class<A> annotationClass)ConstructorConstraintMappingContextconstructor(Class<?>... parameterTypes)Selects a constructor to which the next operations shall apply.TypeConstraintMappingContext<C>defaultGroupSequence(Class<?>... defaultGroupSequence)Defines the default group sequence for current type.TypeConstraintMappingContext<C>defaultGroupSequenceProviderClass(Class<? extends DefaultGroupSequenceProvider<? super C>> defaultGroupSequenceProviderClass)Defines the default group sequence provider for the current type.PropertyConstraintMappingContextfield(String property)Selects a field to which the next operations shall apply.protected DefaultConstraintMappinggetConstraintMapping()protected Set<MetaConstraint<?>>getConstraints(ConstraintCreationContext constraintCreationContext)protected ConstraintDescriptorImpl.ConstraintTypegetConstraintType()Returns the type of constraints hosted on the element configured by this creational context.PropertyConstraintMappingContextgetter(String property)Selects a getter to which the next operations shall apply.TypeConstraintMappingContext<C>ignoreAllAnnotations()Defines that all annotations for this type should be ignored.TypeConstraintMappingContext<C>ignoreAnnotations()Deprecated.TypeConstraintMappingContext<C>ignoreAnnotations(boolean ignoreAnnotations)Specifies whether annotations at the given element should be ignored or not, overriding any setting given for parent elements.MethodConstraintMappingContextmethod(String name, Class<?>... parameterTypes)Selects a method to which the next operations shall apply.PropertyConstraintMappingContextproperty(String property, ElementType elementType)Deprecated.<C> TypeConstraintMappingContext<C>type(Class<C> type)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.validator.cfg.context.ConstraintDefinitionTarget
constraintDefinition
-
Methods inherited from interface org.hibernate.validator.cfg.context.TypeTarget
type
-
-
-
-
Field Detail
-
mapping
protected final DefaultConstraintMapping mapping
-
-
Method Detail
-
constraint
public TypeConstraintMappingContext<C> constraint(ConstraintDef<?,?> definition)
Description copied from interface:ConstrainableAdds a new constraint.- Specified by:
constraintin interfaceConstrainable<C>- Parameters:
definition- The constraint to add.- Returns:
- The current creational context following the method chaining pattern.
-
ignoreAnnotations
@Deprecated public TypeConstraintMappingContext<C> ignoreAnnotations()
Deprecated.- Specified by:
ignoreAnnotationsin interfaceAnnotationProcessingOptions<C>
-
ignoreAnnotations
public TypeConstraintMappingContext<C> ignoreAnnotations(boolean ignoreAnnotations)
Description copied from interface:AnnotationIgnoreOptionsSpecifies whether annotations at the given element should be ignored or not, overriding any setting given for parent elements. E.g. the setting given for a method parameter overrides the setting given for the method declaring that parameter.- Specified by:
ignoreAnnotationsin interfaceAnnotationIgnoreOptions<C>- Parameters:
ignoreAnnotations- Whether to ignore annotation-based constraints or not.- Returns:
- This context for method chaining.
-
ignoreAllAnnotations
public TypeConstraintMappingContext<C> ignoreAllAnnotations()
Description copied from interface:TypeConstraintMappingContextDefines that all annotations for this type should be ignored.- Specified by:
ignoreAllAnnotationsin interfaceTypeConstraintMappingContext<C>- Returns:
- The current creational context following the method chaining pattern.
-
defaultGroupSequence
public TypeConstraintMappingContext<C> defaultGroupSequence(Class<?>... defaultGroupSequence)
Description copied from interface:TypeConstraintMappingContextDefines the default group sequence for current type.- Specified by:
defaultGroupSequencein interfaceTypeConstraintMappingContext<C>- Parameters:
defaultGroupSequence- the default group sequence.- Returns:
- The current creational context following the method chaining pattern.
-
defaultGroupSequenceProviderClass
public TypeConstraintMappingContext<C> defaultGroupSequenceProviderClass(Class<? extends DefaultGroupSequenceProvider<? super C>> defaultGroupSequenceProviderClass)
Description copied from interface:TypeConstraintMappingContextDefines the default group sequence provider for the current type.- Specified by:
defaultGroupSequenceProviderClassin interfaceTypeConstraintMappingContext<C>- Parameters:
defaultGroupSequenceProviderClass- The default group sequence provider class.- Returns:
- The current creational context following the method chaining pattern.
-
property
@Deprecated public PropertyConstraintMappingContext property(String property, ElementType elementType)
Deprecated.Description copied from interface:PropertyTargetSelects a property to which the next operations shall 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.
A given property may only be configured once.
- Specified by:
propertyin interfacePropertyTarget- Parameters:
property- The property on which to apply the following constraints (Java Bean notation).elementType- The access type (field/property).- Returns:
- A creational context representing the selected property.
-
field
public PropertyConstraintMappingContext field(String property)
Description copied from interface:PropertyTargetSelects a field to which the next operations shall apply.Until this method is called constraints apply on class level. After calling this method constraints apply on the specified field property.
A given field may only be configured once.
- Specified by:
fieldin interfacePropertyTarget- Parameters:
property- The field name that represents a property on which to apply the following constraints.- Returns:
- A creational context representing the selected field property.
-
getter
public PropertyConstraintMappingContext getter(String property)
Description copied from interface:PropertyTargetSelects a getter to which the next operations shall apply.Until this method is called constraints apply on class level. After calling this method constraints apply on the specified getter property.
A given getter may only be configured once.
- Specified by:
getterin interfacePropertyTarget- Parameters:
property- The getter property name (using the Java Bean notation, e.g.nameto addressgetName()) that represents a property on which to apply the following constraints.- Returns:
- A creational context representing the selected getter property.
-
method
public MethodConstraintMappingContext method(String name, Class<?>... parameterTypes)
Description copied from interface:MethodTargetSelects a method to which the next operations shall apply.Until this method is called constraints apply on class level. After calling this method constraints apply to the specified method.
A given method may only be configured once.
- Specified by:
methodin interfaceMethodTarget- Parameters:
name- The method name.parameterTypes- The method parameter types.- Returns:
- A creational context representing the selected method.
-
constructor
public ConstructorConstraintMappingContext constructor(Class<?>... parameterTypes)
Description copied from interface:ConstructorTargetSelects a constructor to which the next operations shall apply.Until this method is called constraints apply on class level. After calling this method constraints apply to the specified constructor.
A given constructor may only be configured once.
- Specified by:
constructorin interfaceConstructorTarget- Parameters:
parameterTypes- The constructor parameter types.- Returns:
- A creational context representing the selected constructor.
-
getConstraintType
protected ConstraintDescriptorImpl.ConstraintType getConstraintType()
Returns the type of constraints hosted on the element configured by this creational context.- Returns:
- the type of constraints hosted on the element configured by this creational context
-
getConstraintMapping
protected DefaultConstraintMapping getConstraintMapping()
-
addConstraint
protected void addConstraint(org.hibernate.validator.internal.cfg.context.ConfiguredConstraint<?> constraint)
Adds a constraint to the set of constraints managed by this creational context.- Parameters:
constraint- the constraint to add
-
getConstraints
protected Set<MetaConstraint<?>> getConstraints(ConstraintCreationContext constraintCreationContext)
-
type
public <C> TypeConstraintMappingContext<C> type(Class<C> type)
-
constraintDefinition
public <A extends Annotation> ConstraintDefinitionContext<A> constraintDefinition(Class<A> annotationClass)
-
-