org.hibernate.validator.metadata
Class AggregatedMethodMetaData

java.lang.Object
  extended by org.hibernate.validator.metadata.AggregatedMethodMetaData
All Implemented Interfaces:
Iterable<MethodMetaConstraint<?>>

public class AggregatedMethodMetaData
extends Object
implements Iterable<MethodMetaConstraint<?>>

An aggregated view of the constraint related meta data for a given method and all the methods in the inheritance hierarchy which it overrides or implements.

Instances are retrieved by creating a AggregatedMethodMetaData.Builder and adding all required MethodMetaData objects to it. Instances are read-only after creation.

Author:
Gunnar Morling

Nested Class Summary
static class AggregatedMethodMetaData.Builder
          Creates new AggregatedMethodMetaData instances.
 
Method Summary
 void assertCorrectnessOfMethodParameterConstraints()
           Checks the parameter constraints of this method for correctness.
 boolean equals(Object obj)
           
 Iterable<MethodMetaData> getAllMethodMetaData()
           
 List<ParameterMetaData> getAllParameterMetaData()
          Returns meta data for all parameters of the represented method.
 Method getMethod()
           
 ParameterMetaData getParameterMetaData(int parameterIndex)
          Returns meta data for the specified parameter of the represented method.
 MethodMetaData getSingleMetaDataFor(Method method)
          Returns a single method meta data from this aggregation.
 int hashCode()
           
 boolean isCascading()
          Whether a cascaded validation of the return value of the represented method shall be performed or not.
 boolean isConstrained()
          Whether the represented method itself or any of the method's up in the inheritance hierarchy which it overrides/implements is constrained.
 Iterator<MethodMetaConstraint<?>> iterator()
          An iterator with the return value constraints of the represented method.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

assertCorrectnessOfMethodParameterConstraints

public void assertCorrectnessOfMethodParameterConstraints()
                                                   throws ConstraintDeclarationException

Checks the parameter constraints of this method for correctness.

The following rules apply for this check:

Throws:
ConstraintDeclarationException - In case the represented method has an illegal parameter constraint.

getMethod

public Method getMethod()

getParameterMetaData

public ParameterMetaData getParameterMetaData(int parameterIndex)
Returns meta data for the specified parameter of the represented method.

Returns:
Meta data for the specified parameter. Will never be null.

getAllParameterMetaData

public List<ParameterMetaData> getAllParameterMetaData()
Returns meta data for all parameters of the represented method.

Returns:
A list with parameter meta data. The length corresponds to the number of parameters of the method represented by this meta data object, so an empty list may be returned (in case of a parameterless method), but never null.

isCascading

public boolean isCascading()
Whether a cascaded validation of the return value of the represented method shall be performed or not. This is the case if either the method itself is annotated with Valid or any of the method's up in the inheritance hierarchy which it overrides.

Returns:
True, if a cascaded return value validation shall be performed, false otherwise.

isConstrained

public boolean isConstrained()
Whether the represented method itself or any of the method's up in the inheritance hierarchy which it overrides/implements is constrained.

Returns:
True, if this method is constrained by any means, false otherwise.

getSingleMetaDataFor

public MethodMetaData getSingleMetaDataFor(Method method)
Returns a single method meta data from this aggregation.

Parameters:
method - The method to retrieve the meta data for. Must either be the method represented by this meta data object or one method from a super-type, which the method represented by this meta data object overrides/implements.
Returns:
The meta data for the given method or null if this aggregation doesn't contain any meta data for that method.

getAllMethodMetaData

public Iterable<MethodMetaData> getAllMethodMetaData()

iterator

public Iterator<MethodMetaConstraint<?>> iterator()
An iterator with the return value constraints of the represented method.

Specified by:
iterator in interface Iterable<MethodMetaConstraint<?>>

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 © 2007-2011 Red Hat Middleware, LLC. All Rights Reserved