Class ContainerElementConstraintMappingContextImpl
- All Implemented Interfaces:
Cascadable<ContainerElementConstraintMappingContext>,Constrainable<ContainerElementConstraintMappingContext>,ConstraintDefinitionTarget,ConstraintMappingTarget,ConstructorTarget,ContainerElementConstraintMappingContext,ContainerElementTarget,MethodTarget,ParameterTarget,PropertyTarget,ReturnValueTarget,TypeTarget
- Author:
- Gunnar Morling
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final DefaultConstraintMappingprotected final Map<Integer,ContainerElementConstraintMappingContextImpl> Contexts for configuring nested container elements, if any. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddConstraint(org.hibernate.validator.internal.cfg.context.ConfiguredConstraint<?> constraint) Adds a constraint to the set of constraints managed by this creational context.voidaddGroupConversion(Class<?> from, Class<?> to) Adds a group conversion for this element.constraint(ConstraintDef<?, ?> definition) Adds a new constraint.<A extends Annotation>
ConstraintDefinitionContext<A>constraintDefinition(Class<A> annotationClass) constructor(Class<?>... parameterTypes) Selects a constructor to which the next operations shall apply.containerElement(ContainerElementTarget parent, TypeConstraintMappingContextImpl<?> typeContext, ConstraintLocation location) containerElement(ContainerElementTarget parent, TypeConstraintMappingContextImpl<?> typeContext, ConstraintLocation location, int index, int... nestedIndexes) Selects the single type argument of the current element's generic type as the target for the next operations.containerElementType(int index, int... nestedIndexes) Selects the single type argument of the current element's generic type as the target for the next operations.convertGroup(Class<?> from) Adds a group conversion for this cascadable element.Selects a field to which the next operations shall apply.protected CascadingMetaDataBuilderprotected DefaultConstraintMappingprotected Set<MetaConstraint<?>>getConstraints(ConstraintCreationContext constraintCreationContext) protected ConstraintDescriptorImpl.ConstraintTypeReturns the type of constraints hosted on the element configured by this creational context.Selects a getter to which the next operations shall apply.protected ContainerElementConstraintMappingContextgetThis()Returns this object, narrowed down to the specific sub-type.protected Set<MetaConstraint<?>>getTypeArgumentConstraints(ConstraintCreationContext constraintCreationContext) booleanSelects a method to which the next operations shall apply.parameter(int index) Changes the parameter for which added constraints apply.property(String property, ElementType elementType) Deprecated.Selects the current method's return value as the target for the next operations.toString()<C> TypeConstraintMappingContext<C>valid()Marks the current element (property, parameter etc.) as cascadable.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hibernate.validator.cfg.context.Cascadable
convertGroup, validMethods inherited from interface org.hibernate.validator.cfg.context.ConstraintDefinitionTarget
constraintDefinitionMethods inherited from interface org.hibernate.validator.cfg.context.TypeTarget
type
-
Field Details
-
nestedContainerElementContexts
protected final Map<Integer,ContainerElementConstraintMappingContextImpl> nestedContainerElementContextsContexts for configuring nested container elements, if any. Indexed by type parameter. -
isCascading
protected boolean isCascading -
groupConversions
-
mapping
-
-
Method Details
-
getThis
Returns this object, narrowed down to the specific sub-type.- Returns:
- this object, narrowed down to the specific sub-type
- See Also:
-
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
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
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.
-
constructor
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.
-
method
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.
-
parameter
Description copied from interface:ParameterTargetChanges the parameter for which added constraints apply. A given parameter may only be configured once.- Specified by:
parameterin interfaceParameterTarget- Parameters:
index- The parameter index.- Returns:
- A creational context representing the selected parameter.
-
returnValue
Description copied from interface:ReturnValueTargetSelects the current method's return value as the target for the next operations. The return value of one method or constructor may only be configured more once.- Specified by:
returnValuein interfaceReturnValueTarget- Returns:
- A creational context representing the current method's or constructor's return value.
-
containerElementType
Description copied from interface:ContainerElementTargetSelects the single type argument of the current element's generic type as the target for the next operations. Selects the component type if the current element is of an array type.- Specified by:
containerElementTypein interfaceContainerElementTarget- Returns:
- A creational context representing the single type argument or the component type of the current element's type.
-
containerElementType
public ContainerElementConstraintMappingContext containerElementType(int index, int... nestedIndexes) Description copied from interface:ContainerElementTargetSelects the single type argument of the current element's generic type as the target for the next operations. Selects the component type if the current element is of an array type.- Specified by:
containerElementTypein interfaceContainerElementTarget- Parameters:
index- The index of the type argument to configure. Pass 0 when navigating into an array type.nestedIndexes- the nested index(es) in case the container element to configure is a generic type within another generic type, e.g.List<Map<String, String>>, a multi-dimensional array or a combination of (nested) parameterized and array types.- Returns:
- A creational context representing the specified type argument.
-
constraint
Description copied from interface:ConstrainableAdds a new constraint.- Specified by:
constraintin interfaceConstrainable<ContainerElementConstraintMappingContext>- Parameters:
definition- The constraint to add.- Returns:
- The current creational context following the method chaining pattern.
-
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
-
toString
-
addGroupConversion
Adds a group conversion for this element.- Parameters:
from- the source group of the conversionto- the target group of the conversion
-
valid
Description copied from interface:CascadableMarks the current element (property, parameter etc.) as cascadable.- Specified by:
validin interfaceCascadable<C extends Cascadable<C>>- Returns:
- The current creational context following the method chaining pattern.
-
convertGroup
public GroupConversionTargetContext<ContainerElementConstraintMappingContext> convertGroup(Class<?> from) Description copied from interface:CascadableAdds a group conversion for this cascadable element. Several conversions may be configured for one element.- Specified by:
convertGroupin interfaceCascadable<C extends Cascadable<C>>- Parameters:
from- the source group of the conversion to be configured- Returns:
- a creational context allow to set the target group of the conversion
-
containerElement
public ContainerElementConstraintMappingContext containerElement(ContainerElementTarget parent, TypeConstraintMappingContextImpl<?> typeContext, ConstraintLocation location) -
containerElement
public ContainerElementConstraintMappingContext containerElement(ContainerElementTarget parent, TypeConstraintMappingContextImpl<?> typeContext, ConstraintLocation location, int index, int... nestedIndexes) -
isCascading
public boolean isCascading() -
getTypeArgumentConstraints
protected Set<MetaConstraint<?>> getTypeArgumentConstraints(ConstraintCreationContext constraintCreationContext) -
getCascadingMetaDataBuilder
-
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
-
constraintDefinition
public <A extends Annotation> ConstraintDefinitionContext<A> constraintDefinition(Class<A> annotationClass)
-