org.hibernate.validator.internal.metadata.raw

## Class ConstrainedExecutable

- java.lang.Object
- - org.hibernate.validator.internal.metadata.raw.AbstractConstrainedElement
  - - org.hibernate.validator.internal.metadata.raw.ConstrainedExecutable

- All Implemented Interfaces:
    Iterable<MetaConstraint<?>>, ConstrainedElement

      public class ConstrainedExecutable
      extends AbstractConstrainedElement

  Represents a method or constructor of a Java type and all its associated meta-data relevant in the context of bean validation, for instance the constraints at it's parameters or return value.
  Author:
    Gunnar Morling

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.hibernate.validator.internal.metadata.raw.ConstrainedElement

      `ConstrainedElement.ConstrainedElementKind`

  - ### Field Summary

    - ### Fields inherited from class org.hibernate.validator.internal.metadata.raw.AbstractConstrainedElement

      `constraints, groupConversions, isCascading, location, requiresUnwrapping, source`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConstrainedExecutable(ConfigurationSource source, ConstraintLocation location, List<ConstrainedParameter> parameterMetaData, Set<MetaConstraint<?>> crossParameterConstraints, Set<MetaConstraint<?>> returnValueConstraints, Map<Class<?>,Class<?>> groupConversions, boolean isCascading, boolean requiresUnwrapping)` Creates a new executable meta data object.
    `ConstrainedExecutable(ConfigurationSource source, ConstraintLocation location, Set<MetaConstraint<?>> returnValueConstraints, Map<Class<?>,Class<?>> groupConversions, boolean isCascading, boolean requiresUnwrapping)` Creates a new executable meta data object for a parameter-less executable.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `List<ConstrainedParameter>` | `getAllParameterMetaData()` Returns meta data for all parameters of the represented executable.
    `Set<MetaConstraint<?>>` | `getCrossParameterConstraints()`
    `ExecutableElement` | `getExecutable()`
    `ConstrainedParameter` | `getParameterMetaData(int parameterIndex)` Constraint meta data for the specified parameter.
    `int` | `hashCode()`
    `boolean` | `hasParameterConstraints()` Whether this executable has at least one cascaded parameter or at least one parameter with constraints or at least one cross-parameter constraint.
    `boolean` | `isConstrained()` Whether the represented executable is constrained or not.
    `boolean` | `isEquallyParameterConstrained(ConstrainedExecutable other)` Whether this and the given other executable have the same parameter constraints.
    `boolean` | `isGetterMethod()` Whether the represented executable is a JavaBeans getter executable or not.
    `ConstrainedExecutable` | `merge(ConstrainedExecutable other)` Creates a new constrained executable object by merging this and the given other executable.
    `String` | `toString()`

    - ### Methods inherited from class org.hibernate.validator.internal.metadata.raw.AbstractConstrainedElement

      `getConstraints, getGroupConversions, getKind, getLocation, isCascading, iterator, requiresUnwrapping`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ConstrainedExecutable

          public ConstrainedExecutable(ConfigurationSource source,
                               ConstraintLocation location,
                               Set<MetaConstraint<?>> returnValueConstraints,
                               Map<Class<?>,Class<?>> groupConversions,
                               boolean isCascading,
                               boolean requiresUnwrapping)

      Creates a new executable meta data object for a parameter-less executable.
      Parameters:
        `source` - The source of meta data.
        `location` - The location of the represented executable.
        `returnValueConstraints` - The return value constraints of the represented executable, if any.
        `groupConversions` - The group conversions of the represented executable, if any.
        `isCascading` - Whether a cascaded validation of the represented executable's return value shall be performed or not.

    - #### ConstrainedExecutable

          public ConstrainedExecutable(ConfigurationSource source,
                               ConstraintLocation location,
                               List<ConstrainedParameter> parameterMetaData,
                               Set<MetaConstraint<?>> crossParameterConstraints,
                               Set<MetaConstraint<?>> returnValueConstraints,
                               Map<Class<?>,Class<?>> groupConversions,
                               boolean isCascading,
                               boolean requiresUnwrapping)

      Creates a new executable meta data object.
      Parameters:
        `source` - The source of meta data.
        `location` - The location of the represented executable.
        `parameterMetaData` - A list with parameter meta data. The length must correspond with the number of parameters of the represented executable. So this list may be empty (in case of a parameterless executable), but never `null`.
        `returnValueConstraints` - The return value constraints of the represented executable, if any.
        `groupConversions` - The group conversions of the represented executable, if any.
        `isCascading` - Whether a cascaded validation of the represented executable's return value shall be performed or not.
        `requiresUnwrapping` - Whether the value of the executable's return value must be unwrapped prior to validation or not

  - ### Method Detail

    - #### getParameterMetaData

          public ConstrainedParameter getParameterMetaData(int parameterIndex)

      Constraint meta data for the specified parameter.
      Parameters:
        `parameterIndex` - The index in this executable's parameter array of the parameter of interest.
      Returns:
        Meta data for the specified parameter. Will never be `null`.
      Throws:
        `IllegalArgumentException` - In case this executable doesn't have a parameter with the specified index.

    - #### getAllParameterMetaData

          public List<ConstrainedParameter> getAllParameterMetaData()

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

    - #### getCrossParameterConstraints

          public Set<MetaConstraint<?>> getCrossParameterConstraints()

    - #### isConstrained

          public boolean isConstrained()

      Whether the represented executable is constrained or not. This is the case if it has at least one constrained parameter, at least one parameter marked for cascaded validation, at least one cross-parameter constraint, at least one return value constraint or if the return value is marked for cascaded validation.
      Specified by:
        `isConstrained` in interface `ConstrainedElement`
      Overrides:
        `isConstrained` in class `AbstractConstrainedElement`
      Returns:
        `True` if this executable is constrained by any means, `false` otherwise.

    - #### hasParameterConstraints

          public boolean hasParameterConstraints()

      Whether this executable has at least one cascaded parameter or at least one parameter with constraints or at least one cross-parameter constraint.
      Returns:
        `True`, if this executable is parameter-constrained by any means, `false` otherwise.

    - #### isGetterMethod

          public boolean isGetterMethod()

      Whether the represented executable is a JavaBeans getter executable or not.
      Returns:
        `True`, if this executable is a getter method, `false` otherwise.

    - #### getExecutable

          public ExecutableElement getExecutable()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `AbstractConstrainedElement`

    - #### isEquallyParameterConstrained

          public boolean isEquallyParameterConstrained(ConstrainedExecutable other)

      Whether this and the given other executable have the same parameter constraints.
      Parameters:
        `other` - The other executable to check.
      Returns:
        True if this and the other executable have the same parameter constraints (including cross- parameter constraints and parameter cascades), false otherwise.

    - #### merge

          public ConstrainedExecutable merge(ConstrainedExecutable other)

      Creates a new constrained executable object by merging this and the given other executable. Both executables must have the same location, i.e. represent the same executable on the same type.
      Parameters:
        `other` - The executable to merge.
      Returns:
        A merged executable.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `AbstractConstrainedElement`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `AbstractConstrainedElement`

Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved