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

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

public class ExecutableMetaData
extends AbstractConstraintMetaData

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

Instances are retrieved by creating a ExecutableMetaData.Builder and adding all required ConstrainedExecutable 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 ExecutableMetaData.Builder
          Creates new ExecutableMetaData instances.
 
Method Summary
 ExecutableDescriptorImpl asDescriptor(boolean defaultGroupSequenceRedefined, List<Class<?>> defaultGroupSequence)
          Returns this meta data object's corresponding representation in the descriptor model.
 void assertCorrectnessOfConfiguration()
           Checks the configuration of this method for correctness as per the rules outlined in the Bean Validation specification, section 4.5.5 ("Method constraints in inheritance hierarchies").
 boolean equals(Object obj)
           
 Set<MetaConstraint<?>> getCrossParameterConstraints()
          Returns the cross-parameter constraints declared for the represented method or constructor.
 String getIdentifier()
          Returns an identifier for this meta data object, based on the represented executable's name and its parameter types.
 ParameterMetaData getParameterMetaData(int parameterIndex)
          Returns meta data for the specified parameter of the represented executable.
 Class<?>[] getParameterTypes()
           
 ReturnValueMetaData getReturnValueMetaData()
           
 ValidatableParametersMetaData getValidatableParametersMetaData()
           
 int hashCode()
           
 boolean isGetter()
           
 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

assertCorrectnessOfConfiguration

public void assertCorrectnessOfConfiguration()
                                      throws ConstraintDeclarationException

Checks the configuration of this method for correctness as per the rules outlined in the Bean Validation specification, section 4.5.5 ("Method constraints in inheritance hierarchies").

In particular, overriding methods in sub-types may not add parameter constraints and the return value of an overriding method may not be marked as cascaded if the return value is marked as cascaded already on the overridden method.

Throws:
ConstraintDeclarationException - In case any of the rules mandated by the specification is violated.

getParameterMetaData

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

Parameters:
parameterIndex - the index of the parameter
Returns:
Meta data for the specified parameter. Will never be null.

getParameterTypes

public Class<?>[] getParameterTypes()

getIdentifier

public String getIdentifier()
Returns an identifier for this meta data object, based on the represented executable's name and its parameter types.

Returns:
An identifier for this meta data object.

isGetter

public boolean isGetter()

getCrossParameterConstraints

public Set<MetaConstraint<?>> getCrossParameterConstraints()
Returns the cross-parameter constraints declared for the represented method or constructor.

Returns:
the cross-parameter constraints declared for the represented method or constructor. May be empty but will never be null.

getValidatableParametersMetaData

public ValidatableParametersMetaData getValidatableParametersMetaData()

getReturnValueMetaData

public ReturnValueMetaData getReturnValueMetaData()

asDescriptor

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