Top Description Inners Fields Constructors Methods
org.hibernate.validator.internal.metadata.aggregated

public abstract Class AbstractConstraintMetaData

extends Object
implements ConstraintMetaData
Class Inheritance
All Implemented Interfaces
org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData, java.lang.Iterable
Known Direct Subclasses
org.hibernate.validator.internal.metadata.aggregated.ClassMetaData, org.hibernate.validator.internal.metadata.aggregated.ExecutableMetaData, org.hibernate.validator.internal.metadata.aggregated.ParameterMetaData, org.hibernate.validator.internal.metadata.aggregated.PropertyMetaData, org.hibernate.validator.internal.metadata.aggregated.ReturnValueMetaData
Static Imports
org.hibernate.validator.internal.util.CollectionHelper.newHashSet

Base implementation for ConstraintMetaData with attributes common to all type of meta data.
Authors
Gunnar Morling, Hardy Ferentschik

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
AbstractConstraintMetaData.ContainerElementMetaDataTree

This data structure is used to join the cascading metadata information with the constraint violations.

Field Summary

Modifier and TypeField and Description
private final Set<MetaConstraint<?>>
private final Set<MetaConstraint<?>>
private final Set<MetaConstraint<?>>
private final boolean
private final boolean
private final String
private final Type

Constructor Summary

AccessConstructor and Description
public
AbstractConstraintMetaData(String name, Type type, Set<MetaConstraint<?>> directConstraints, Set<MetaConstraint<?>> containerElementsConstraints, boolean isCascading, boolean isConstrained)

Method Summary

Modifier and TypeMethod and Description
protected Set<ContainerElementTypeDescriptor>
asContainerElementTypeDescriptors(Set<MetaConstraint<?>> containerElementsConstraints, CascadingMetaData cascadingMetaData, boolean defaultGroupSequenceRedefined, List<Class<?>> defaultGroupSequence)

private Set<ContainerElementTypeDescriptor>
asContainerElementTypeDescriptors(Type type, AbstractConstraintMetaData.ContainerElementMetaDataTree containerElementMetaDataTree, boolean defaultGroupSequenceRedefined, List<Class<?>> defaultGroupSequence)

protected Set<ConstraintDescriptorImpl<?>>
asDescriptors(Set<MetaConstraint<?>> constraints)

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public Set<MetaConstraint<?>>
public Set<MetaConstraint<?>>
public Set<MetaConstraint<?>>
public String
getName()

Implements org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData.getName.

Returns the name of this meta data object.
public Type
getType()

Implements org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData.getType.

Returns the data type of this meta data object, e.g. the type of a bean property or the return type of a method.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public final boolean
isCascading()

Implements org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData.isCascading.

Whether this meta data object is marked for cascaded validation or not.
public boolean
isConstrained()

Implements org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData.isConstrained.

Whether this meta data object is constrained by any means or not.
public Iterator<MetaConstraint<?>>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

allConstraintsback to summary
private final Set<MetaConstraint<?>> allConstraints
Annotations
@Immutable
containerElementsConstraintsback to summary
private final Set<MetaConstraint<?>> containerElementsConstraints
Annotations
@Immutable
directConstraintsback to summary
private final Set<MetaConstraint<?>> directConstraints
Annotations
@Immutable
isCascadingback to summary
private final boolean isCascading
isConstrainedback to summary
private final boolean isConstrained
nameback to summary
private final String name
typeback to summary
private final Type type

Constructor Detail

AbstractConstraintMetaDataback to summary
public AbstractConstraintMetaData(String name, Type type, Set<MetaConstraint<?>> directConstraints, Set<MetaConstraint<?>> containerElementsConstraints, boolean isCascading, boolean isConstrained)

Method Detail

asContainerElementTypeDescriptorsback to summary
protected Set<ContainerElementTypeDescriptor> asContainerElementTypeDescriptors(Set<MetaConstraint<?>> containerElementsConstraints, CascadingMetaData cascadingMetaData, boolean defaultGroupSequenceRedefined, List<Class<?>> defaultGroupSequence)
asContainerElementTypeDescriptorsback to summary
private Set<ContainerElementTypeDescriptor> asContainerElementTypeDescriptors(Type type, AbstractConstraintMetaData.ContainerElementMetaDataTree containerElementMetaDataTree, boolean defaultGroupSequenceRedefined, List<Class<?>> defaultGroupSequence)
asDescriptorsback to summary
protected Set<ConstraintDescriptorImpl<?>> asDescriptors(Set<MetaConstraint<?>> constraints)
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getAllConstraintsback to summary
public Set<MetaConstraint<?>> getAllConstraints()
getContainerElementsConstraintsback to summary
public Set<MetaConstraint<?>> getContainerElementsConstraints()
getDirectConstraintsback to summary
public Set<MetaConstraint<?>> getDirectConstraints()
getNameback to summary
public String getName()

Implements org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData.getName.

Doc from org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData.getName.

Returns the name of this meta data object.

Returns:String

This meta data object's name.

Annotations
@Override
getTypeback to summary
public Type getType()

Implements org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData.getType.

Doc from org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData.getType.

Returns the data type of this meta data object, e.g. the type of a bean property or the return type of a method.

Returns:Type

This meta data object's type.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
isCascadingback to summary
public final boolean isCascading()

Implements org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData.isCascading.

Doc from org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData.isCascading.

Whether this meta data object is marked for cascaded validation or not.

Returns:boolean

trueif this object is marked for cascaded validation, false otherwise.

Annotations
@Override
isConstrainedback to summary
public boolean isConstrained()

Implements org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData.isConstrained.

Doc from org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData.isConstrained.

Whether this meta data object is constrained by any means or not.

Returns:boolean

true if this object is marked for cascaded validation or has any constraints, false otherwise.

Annotations
@Override
iteratorback to summary
public Iterator<MetaConstraint<?>> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<MetaConstraint<?>>

an Iterator.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.hibernate.validator.internal.metadata.aggregated back to summary

private Class AbstractConstraintMetaData.ContainerElementMetaDataTree

extends Object
Class Inheritance
  • java.lang.Object
  • org.hibernate.validator.internal.metadata.aggregated.AbstractConstraintMetaData.ContainerElementMetaDataTree

This data structure is used to join the cascading metadata information with the constraint violations. It is a temporary data structure and it should be kept that way.

We might consider in the future having a common tree structure for the cascading metadata and the constraint violations that would be built earlier and shared. This class shouldn't be taken as a model as this data structure should be made immutable.

Field Summary

Modifier and TypeField and Description
private boolean
private final Set<MetaConstraint<?>>
private Class<?>
private Type
private Set<GroupConversionDescriptor>
private final Map<TypeVariable<?>, AbstractConstraintMetaData.ContainerElementMetaDataTree>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
private void
addConstraint(List<TypeVariable<?>> path, MetaConstraint<?> constraint)

private static AbstractConstraintMetaData.ContainerElementMetaDataTree
of(CascadingMetaData cascadingMetaData, Set<MetaConstraint<?>> containerElementsConstraints)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cascadingback to summary
private boolean cascading
constraintsback to summary
private final Set<MetaConstraint<?>> constraints
containerClassback to summary
private Class<?> containerClass
elementTypeback to summary
private Type elementType
groupConversionDescriptorsback to summary
private Set<GroupConversionDescriptor> groupConversionDescriptors
nodesback to summary
private final Map<TypeVariable<?>, AbstractConstraintMetaData.ContainerElementMetaDataTree> nodes

Constructor Detail

ContainerElementMetaDataTreeback to summary
private ContainerElementMetaDataTree()

Method Detail

addCascadingMetaDataback to summary
private void addCascadingMetaData(List<TypeVariable<?>> path, ContainerCascadingMetaData cascadingMetaData)
addConstraintback to summary
private void addConstraint(List<TypeVariable<?>> path, MetaConstraint<?> constraint)
ofback to summary
private static AbstractConstraintMetaData.ContainerElementMetaDataTree of(CascadingMetaData cascadingMetaData, Set<MetaConstraint<?>> containerElementsConstraints)