org.hibernate.validator.internal.metadata.aggregated
Class AbstractConstraintMetaData

java.lang.Object
  extended by org.hibernate.validator.internal.metadata.aggregated.AbstractConstraintMetaData
All Implemented Interfaces:
Iterable<MetaConstraint<?>>, ConstraintMetaData
Direct Known Subclasses:
ExecutableMetaData, ParameterMetaData, PropertyMetaData

public abstract class AbstractConstraintMetaData
extends Object
implements ConstraintMetaData

Base implementation for ConstraintMetaData with attributes common to all type of meta data.

Author:
Gunnar Morling

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData
ConstraintMetaData.ConstraintMetaDataKind
 
Constructor Summary
AbstractConstraintMetaData(String name, Type type, Set<MetaConstraint<?>> constraints, ConstraintMetaData.ConstraintMetaDataKind constrainedMetaDataKind, boolean isCascading, boolean isConstrained)
           
 
Method Summary
protected  Set<ConstraintDescriptorImpl<?>> asDescriptors(Set<MetaConstraint<?>> constraints)
           
 boolean equals(Object obj)
           
 Set<MetaConstraint<?>> getConstraints()
           
 ConstraintMetaData.ConstraintMetaDataKind getKind()
          Returns the kind of this meta data object.
 String getName()
          Returns the name of this meta data object.
 Type getType()
          Returns the data type of this meta data object, e.g.
 int hashCode()
           
 boolean isCascading()
          Whether this meta data object is marked for cascaded validation or not.
 boolean isConstrained()
          Whether this meta data object is constrained by any means or not.
 Iterator<MetaConstraint<?>> iterator()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData
asDescriptor
 

Constructor Detail

AbstractConstraintMetaData

public AbstractConstraintMetaData(String name,
                                  Type type,
                                  Set<MetaConstraint<?>> constraints,
                                  ConstraintMetaData.ConstraintMetaDataKind constrainedMetaDataKind,
                                  boolean isCascading,
                                  boolean isConstrained)
Parameters:
name - the name of the constrained property, method or parameter
type - the type of the constrained element
constraints - the set of constraints
constrainedMetaDataKind - the type of constraint - property, method or parameter constraint
isCascading - should cascading constraints be evaluated. Returns true is the constrained element is marked for cascaded validation (@Valid), false otherwise.
isConstrained - returns true is there are direct constraints defined on this element or it is marked for cascaded validation, false otherwise.
Method Detail

getName

public String getName()
Description copied from interface: ConstraintMetaData
Returns the name of this meta data object.

Specified by:
getName in interface ConstraintMetaData
Returns:
This meta data object's name.

getType

public Type getType()
Description copied from interface: ConstraintMetaData
Returns the data type of this meta data object, e.g. the type of a bean property or the return type of a method.

Specified by:
getType in interface ConstraintMetaData
Returns:
This meta data object's type.

iterator

public Iterator<MetaConstraint<?>> iterator()
Specified by:
iterator in interface Iterable<MetaConstraint<?>>

getConstraints

public Set<MetaConstraint<?>> getConstraints()

getKind

public ConstraintMetaData.ConstraintMetaDataKind getKind()
Description copied from interface: ConstraintMetaData
Returns the kind of this meta data object.

Specified by:
getKind in interface ConstraintMetaData
Returns:
The kind of this meta data object.

isCascading

public boolean isCascading()
Description copied from interface: ConstraintMetaData
Whether this meta data object is marked for cascaded validation or not.

Specified by:
isCascading in interface ConstraintMetaData
Returns:
True if this object is marked for cascaded validation, false otherwise.

isConstrained

public boolean isConstrained()
Description copied from interface: ConstraintMetaData
Whether this meta data object is constrained by any means or not.

Specified by:
isConstrained in interface ConstraintMetaData
Returns:
True if this object is marked for cascaded validation or has any constraints, false otherwise.

asDescriptors

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

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2012 Oracle Corporation. All Rights Reserved.