org.hibernate.validator.internal.metadata.aggregated

## Class MetaDataBuilder

- java.lang.Object
- - org.hibernate.validator.internal.metadata.aggregated.MetaDataBuilder

- Direct Known Subclasses:
    ExecutableMetaData.Builder, ParameterMetaData.Builder, PropertyMetaData.Builder

      public abstract class MetaDataBuilder
      extends Object

  Builds `ConstraintMetaData` instances for the `ConstrainedElement` objects representing one method or property in a type's inheritance hierarchy.
  Author:
    Gunnar Morling

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ConstraintHelper` | `constraintHelper`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `MetaDataBuilder(Class<?> beanClass, ConstraintHelper constraintHelper)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract boolean` | `accepts(ConstrainedElement constrainedElement)` Whether this builder allows to add the given element or not.
    `protected Set<MetaConstraint<?>>` | `adaptOriginsAndImplicitGroups(Set<MetaConstraint<?>> constraints)` Adapts the given constraints to the given bean type.
    `void` | `add(ConstrainedElement constrainedElement)` Adds the given element to this builder.
    `abstract ConstraintMetaData` | `build()` Creates a new, read-only `ConstraintMetaData` object with all constraint information related to the method or property represented by this builder.
    `protected Set<MetaConstraint<?>>` | `getConstraints()`
    `protected Map<Class<?>,Class<?>>` | `getGroupConversions()`
    `protected boolean` | `isCascading()`
    `boolean` | `requiresUnwrapping()`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### constraintHelper

          protected final ConstraintHelper constraintHelper

  - ### Constructor Detail

    - #### MetaDataBuilder

          protected MetaDataBuilder(Class<?> beanClass,
                         ConstraintHelper constraintHelper)

  - ### Method Detail

    - #### accepts

          public abstract boolean accepts(ConstrainedElement constrainedElement)

      Whether this builder allows to add the given element or not. This is the case if the specified element relates to the same property or method with which this builder was instantiated.
      Parameters:
        `constrainedElement` - The element to check.
      Returns:
        `true` if the given element can be added to this builder, `false` otherwise.

    - #### add

          public void add(ConstrainedElement constrainedElement)

      Adds the given element to this builder. It must be checked with `accepts(ConstrainedElement)` before, whether this is allowed or not.
      Parameters:
        `constrainedElement` - The element to add.

    - #### build

          public abstract ConstraintMetaData build()

      Creates a new, read-only `ConstraintMetaData` object with all constraint information related to the method or property represented by this builder.
      Returns:
        A `ConstraintMetaData` object.

    - #### getGroupConversions

          protected Map<Class<?>,Class<?>> getGroupConversions()

    - #### getConstraints

          protected Set<MetaConstraint<?>> getConstraints()

    - #### isCascading

          protected boolean isCascading()

    - #### requiresUnwrapping

          public boolean requiresUnwrapping()

    - #### adaptOriginsAndImplicitGroups

          protected Set<MetaConstraint<?>> adaptOriginsAndImplicitGroups(Set<MetaConstraint<?>> constraints)

      Adapts the given constraints to the given bean type. In case a constraint is defined locally at the bean class the original constraint will be returned without any modifications. If a constraint is defined in the hierarchy (interface or super class) a new constraint will be returned with an origin of `ConstraintOrigin.DEFINED_IN_HIERARCHY`. If a constraint is defined on an interface, the interface type will additionally be part of the constraint's groups (implicit grouping).
      Parameters:
        `constraints` - The constraints that shall be adapted. The constraints themselves will not be altered.
      Returns:
        A constraint adapted to the given bean type.

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