Class ConstraintDescriptorImpl<T extends Annotation>
java.lang.Object
org.hibernate.validator.internal.metadata.descriptor.ConstraintDescriptorImpl<T>
- All Implemented Interfaces:
ConstraintDescriptor<T>,Serializable
public class ConstraintDescriptorImpl<T extends Annotation>
extends Object
implements ConstraintDescriptor<T>, Serializable
Describes a single constraint (including its composing constraints).
- Author:
- Emmanuel Bernard, Hardy Ferentschik, Federico Mancini, Dag Hovland, Guillaume Smet
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe type of a constraint. -
Constructor Summary
ConstructorsConstructorDescriptionConstraintDescriptorImpl(ConstraintHelper constraintHelper, Constrainable constrainable, ConstraintAnnotationDescriptor<T> annotationDescriptor, ConstraintLocation.ConstraintLocationKind constraintLocationKind) ConstraintDescriptorImpl(ConstraintHelper constraintHelper, Constrainable constrainable, ConstraintAnnotationDescriptor<T> annotationDescriptor, ConstraintLocation.ConstraintLocationKind constraintLocationKind, Class<?> implicitGroup, ConstraintOrigin definedOn, ConstraintDescriptorImpl.ConstraintType externalConstraintType) ConstraintDescriptorImpl(ConstraintHelper constraintHelper, Constrainable constrainable, ConstraintAnnotationDescriptor<T> annotationDescriptor, ConstraintLocation.ConstraintLocationKind constraintLocationKind, ConstraintDescriptorImpl.ConstraintType constraintType) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the annotation describing the constraint declaration.Returns a map containing the annotation attribute names as keys and the annotation attribute values as value.Return a set of composingConstraintDescriptors where each descriptor describes a composing constraint.List<Class<? extends ConstraintValidator<T,?>>> List of the constraint validation implementation classes.The set of groups the constraint is applied on.Return all constraint validator descriptors (either generic or cross-parameter) which are registered for the constraint of this descriptor.The non-interpolated error messageThe set of payload the constraint hosts.inthashCode()booleantoString()<U> UReturns an instance of the specified type allowing access to provider-specific APIs.
-
Constructor Details
-
ConstraintDescriptorImpl
public ConstraintDescriptorImpl(ConstraintHelper constraintHelper, Constrainable constrainable, ConstraintAnnotationDescriptor<T> annotationDescriptor, ConstraintLocation.ConstraintLocationKind constraintLocationKind, Class<?> implicitGroup, ConstraintOrigin definedOn, ConstraintDescriptorImpl.ConstraintType externalConstraintType) -
ConstraintDescriptorImpl
public ConstraintDescriptorImpl(ConstraintHelper constraintHelper, Constrainable constrainable, ConstraintAnnotationDescriptor<T> annotationDescriptor, ConstraintLocation.ConstraintLocationKind constraintLocationKind) -
ConstraintDescriptorImpl
public ConstraintDescriptorImpl(ConstraintHelper constraintHelper, Constrainable constrainable, ConstraintAnnotationDescriptor<T> annotationDescriptor, ConstraintLocation.ConstraintLocationKind constraintLocationKind, ConstraintDescriptorImpl.ConstraintType constraintType)
-
-
Method Details
-
getAnnotationDescriptor
-
getAnnotation
Description copied from interface:ConstraintDescriptorReturns the annotation describing the constraint declaration. If a composing constraint, attribute values are reflecting the overridden attributes of the composing constraint- Specified by:
getAnnotationin interfaceConstraintDescriptor<T extends Annotation>- Returns:
- the annotation for this constraint
-
getAnnotationType
-
getMessageTemplate
Description copied from interface:ConstraintDescriptorThe non-interpolated error message- Specified by:
getMessageTemplatein interfaceConstraintDescriptor<T extends Annotation>- Returns:
- the non-interpolated error message
-
getGroups
Description copied from interface:ConstraintDescriptorThe set of groups the constraint is applied on. If the constraint declares no group, a set with only theDefaultgroup is returned.- Specified by:
getGroupsin interfaceConstraintDescriptor<T extends Annotation>- Returns:
- the groups the constraint is applied on
-
getPayload
Description copied from interface:ConstraintDescriptorThe set of payload the constraint hosts.- Specified by:
getPayloadin interfaceConstraintDescriptor<T extends Annotation>- Returns:
- payload classes hosted on the constraint or an empty set if none
-
getValidationAppliesTo
Description copied from interface:ConstraintDescriptor- Specified by:
getValidationAppliesToin interfaceConstraintDescriptor<T extends Annotation>- Returns:
- the
ConstraintTargetvalue ornull
-
getValueUnwrapping
- Specified by:
getValueUnwrappingin interfaceConstraintDescriptor<T extends Annotation>- Returns:
- a
ValidateUnwrappedValuedescribing the unwrapping behavior as given via theUnwrappingconstraint payloads.
-
getConstraintValidatorClasses
Description copied from interface:ConstraintDescriptorList of the constraint validation implementation classes.- Specified by:
getConstraintValidatorClassesin interfaceConstraintDescriptor<T extends Annotation>- Returns:
- list of the constraint validation implementation classes
-
getMatchingConstraintValidatorDescriptors
Return all constraint validator descriptors (either generic or cross-parameter) which are registered for the constraint of this descriptor.- Returns:
- The constraint validator descriptors applying to type of this constraint.
-
getAttributes
Description copied from interface:ConstraintDescriptorReturns a map containing the annotation attribute names as keys and the annotation attribute values as value.If this constraint is used as part of a composed constraint, attribute values are reflecting the overridden attribute of the composing constraint.
- Specified by:
getAttributesin interfaceConstraintDescriptor<T extends Annotation>- Returns:
- a map containing the annotation attribute names as keys and the annotation attribute values as value
-
getComposingConstraints
Description copied from interface:ConstraintDescriptorReturn a set of composingConstraintDescriptors where each descriptor describes a composing constraint.ConstraintDescriptorinstances of composing constraints reflect overridden attribute values inConstraintDescriptor.getAttributes()andConstraintDescriptor.getAnnotation().- Specified by:
getComposingConstraintsin interfaceConstraintDescriptor<T extends Annotation>- Returns:
- a set of
ConstraintDescriptorobjects or an empty set in case there are no composing constraints
-
getComposingConstraintImpls
-
isReportAsSingleViolation
public boolean isReportAsSingleViolation()- Specified by:
isReportAsSingleViolationin interfaceConstraintDescriptor<T extends Annotation>- Returns:
trueif the constraint is annotated withReportAsSingleViolation
-
getConstraintLocationKind
-
getDefinedOn
-
getConstraintType
-
unwrap
Description copied from interface:ConstraintDescriptorReturns an instance of the specified type allowing access to provider-specific APIs.If the Jakarta Bean Validation provider implementation does not support the specified class, a
ValidationExceptionis thrown.- Specified by:
unwrapin interfaceConstraintDescriptor<T extends Annotation>- Type Parameters:
U- the type of the object to be returned- Parameters:
type- the class of the object to be returned- Returns:
- an instance of the specified class
-
equals
-
hashCode
public int hashCode() -
toString
-
getCompositionType
- Returns:
- the compositionType
-