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

java.lang.Object
  extended by org.hibernate.validator.internal.metadata.aggregated.AbstractConstraintMetaData
      extended by org.hibernate.validator.internal.metadata.aggregated.MethodMetaData
All Implemented Interfaces:
Iterable<MetaConstraint<?>>, ConstraintMetaData

public class MethodMetaData
extends AbstractConstraintMetaData

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 MethodMetaData.Builder and adding all required ConstrainedMethod objects to it. Instances are read-only after creation.

Identity is solely based on the method's name and parameter types, hence sets and similar collections of this type may only be created in the scope of one Java type.

Author:
Gunnar Morling

Nested Class Summary
static class MethodMetaData.Builder
          Creates new MethodMetaData instances.
 
Nested classes/interfaces inherited from interface org.hibernate.validator.internal.metadata.aggregated.ConstraintMetaData
ConstraintMetaData.ConstraintMetaDataKind
 
Method Summary
 MethodDescriptor asDescriptor(boolean defaultGroupSequenceRedefined, List<Class<?>> defaultGroupSequence)
          Returns this meta data object's corresponding representation in the descriptor model.
 void assertCorrectnessOfMethodParameterConstraints()
           Checks the parameter constraints of this method for correctness.
 boolean equals(Object obj)
           
 List<ParameterMetaData> getAllParameterMetaData()
          Returns meta data for all parameters of the represented method.
 ParameterMetaData getParameterMetaData(int parameterIndex)
          Returns meta data for the specified parameter of the represented method.
 Class<?>[] getParameterTypes()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class org.hibernate.validator.internal.metadata.aggregated.AbstractConstraintMetaData
asDescriptors, getConstraints, getKind, getName, getType, isCascading, isConstrained, iterator
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

assertCorrectnessOfMethodParameterConstraints

public void assertCorrectnessOfMethodParameterConstraints()
                                                   throws javax.validation.ConstraintDeclarationException

Checks the parameter constraints of this method for correctness.

The following rules apply for this check:

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

getParameterMetaData

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

Parameters:
parameterIndex - the index of the parameter
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.

getParameterTypes

public Class<?>[] getParameterTypes()

asDescriptor

public MethodDescriptor asDescriptor(boolean defaultGroupSequenceRedefined,
                                     List<Class<?>> defaultGroupSequence)
Description copied from interface: ConstraintMetaData
Returns this meta data object's corresponding representation in the descriptor model.

Parameters:
defaultGroupSequenceRedefined - Whether the bean hosting the represented element has a redefined default group sequence or not.
defaultGroupSequence - The default group sequence of the bean hosting the represented element.
Returns:
This meta data object's corresponding descriptor model representation. Implementations should return a specific sub type of ElementDescriptor.

toString

public String toString()
Overrides:
toString in class AbstractConstraintMetaData

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractConstraintMetaData

equals

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


Copyright © 2012 Oracle Corporation. All Rights Reserved.