org.hibernate.validator.internal.cfg.context

## Class ParameterConstraintMappingContextImpl

- java.lang.Object
- - org.hibernate.validator.internal.cfg.context.ConstraintMappingContextImplBase
  - - org.hibernate.validator.internal.cfg.context.CascadableConstraintMappingContextImplBase<ParameterConstraintMappingContext>
    - - org.hibernate.validator.internal.cfg.context.ParameterConstraintMappingContextImpl

- All Implemented Interfaces:
    Cascadable<ParameterConstraintMappingContext>, Constrainable<ParameterConstraintMappingContext>, ConstructorTarget, CrossParameterTarget, MethodTarget, ParameterConstraintMappingContext, ParameterTarget, ReturnValueTarget, TypeTarget, Unwrapable<ParameterConstraintMappingContext>

      public final class ParameterConstraintMappingContextImpl
      extends CascadableConstraintMappingContextImplBase<ParameterConstraintMappingContext>
      implements ParameterConstraintMappingContext

  Constraint mapping creational context which allows to configure the constraints for one method parameter.
  Author:
    Hardy Ferentschik, Gunnar Morling, Kevin Pollet (C) 2011 SERLI

- - ### Field Summary

    - ### Fields inherited from class org.hibernate.validator.internal.cfg.context.CascadableConstraintMappingContextImplBase

      `groupConversions, isCascading`

    - ### Fields inherited from class org.hibernate.validator.internal.cfg.context.ConstraintMappingContextImplBase

      `mapping`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ParameterConstraintMappingContextImpl(ExecutableConstraintMappingContextImpl executableContext, int parameterIndex)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ConstrainedParameter` | `build(ConstraintHelper constraintHelper, ParameterNameProvider parameterNameProvider)`
    `ParameterConstraintMappingContext` | `constraint(ConstraintDef<?,?> definition)` Adds a new constraint.
    `ConstructorConstraintMappingContext` | `constructor(Class<?>... parameterTypes)` Selects a constructor to which the next operations shall apply.
    `CrossParameterConstraintMappingContext` | `crossParameter()` Selects the cross-parameter element of a method or constructor as target for the next constraint declaration operations.
    `protected ConstraintDescriptorImpl.ConstraintType` | `getConstraintType()` Returns the type of constraints hosted on the element configured by this creational context.
    `protected ParameterConstraintMappingContext` | `getThis()` Returns this object, narrowed down to the specific sub-type.
    `MethodConstraintMappingContext` | `method(String name, Class<?>... parameterTypes)` Selects a method to which the next operations shall apply.
    `ParameterConstraintMappingContext` | `parameter(int index)` Changes the parameter for which added constraints apply.
    `ReturnValueConstraintMappingContext` | `returnValue()` Selects the current method's return value as the target for the next operations.

    - ### Methods inherited from class org.hibernate.validator.internal.cfg.context.CascadableConstraintMappingContextImplBase

      `addGroupConversion, convertGroup, getGroupConversions, isCascading, unwrapValidatedValue, valid`

    - ### Methods inherited from class org.hibernate.validator.internal.cfg.context.ConstraintMappingContextImplBase

      `addConstraint, getConstraintMapping, getConstraints, type`

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

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

    - ### Methods inherited from interface org.hibernate.validator.cfg.context.TypeTarget

      `type`

    - ### Methods inherited from interface org.hibernate.validator.cfg.context.Cascadable

      `convertGroup, valid`

    - ### Methods inherited from interface org.hibernate.validator.cfg.context.Unwrapable

      `unwrapValidatedValue`

- - ### Constructor Detail

    - #### ParameterConstraintMappingContextImpl

          public ParameterConstraintMappingContextImpl(ExecutableConstraintMappingContextImpl executableContext,
                                               int parameterIndex)

  - ### Method Detail

    - #### getThis

          protected ParameterConstraintMappingContext getThis()

      Description copied from class: `CascadableConstraintMappingContextImplBase`
      Returns this object, narrowed down to the specific sub-type.
      Specified by:
        `getThis` in class `CascadableConstraintMappingContextImplBase<ParameterConstraintMappingContext>`
      Returns:
        this object, narrowed down to the specific sub-type
      See Also:
        "Get this" trick

    - #### constraint

          public ParameterConstraintMappingContext constraint(ConstraintDef<?,?> definition)

      Description copied from interface: `Constrainable`
      Adds a new constraint.
      Specified by:
        `constraint` in interface `Constrainable<ParameterConstraintMappingContext>`
      Parameters:
        `definition` - The constraint to add.
      Returns:
        The current creational context following the method chaining pattern.

    - #### parameter

          public ParameterConstraintMappingContext parameter(int index)

      Description copied from interface: `ParameterTarget`
      Changes the parameter for which added constraints apply. A given parameter may only be configured once.
      Specified by:
        `parameter` in interface `ParameterTarget`
      Parameters:
        `index` - The parameter index.
      Returns:
        A creational context representing the selected parameter.

    - #### crossParameter

          public CrossParameterConstraintMappingContext crossParameter()

      Description copied from interface: `CrossParameterTarget`
      Selects the cross-parameter element of a method or constructor as target for the next constraint declaration operations. May only be configured once for a given method or constructor.
      Specified by:
        `crossParameter` in interface `CrossParameterTarget`
      Returns:
        A creational context representing the cross-parameter element of the current method or constructor.

    - #### returnValue

          public ReturnValueConstraintMappingContext returnValue()

      Description copied from interface: `ReturnValueTarget`
      Selects the current method's return value as the target for the next operations. The return value of one method or constructor may only be configured more once.
      Specified by:
        `returnValue` in interface `ReturnValueTarget`
      Returns:
        A creational context representing the current method's or constructor's return value.

    - #### constructor

          public ConstructorConstraintMappingContext constructor(Class<?>... parameterTypes)

      Description copied from interface: `ConstructorTarget`
      Selects a constructor to which the next operations shall apply.

      Until this method is called constraints apply on class level. After calling this method constraints apply to the specified constructor.

      A given constructor may only be configured once.

      Specified by:
        `constructor` in interface `ConstructorTarget`
      Parameters:
        `parameterTypes` - The constructor parameter types.
      Returns:
        A creational context representing the selected constructor.

    - #### method

          public MethodConstraintMappingContext method(String name,
                                              Class<?>... parameterTypes)

      Description copied from interface: `MethodTarget`
      Selects a method to which the next operations shall apply.

      Until this method is called constraints apply on class level. After calling this method constraints apply to the specified method.

      A given method may only be configured once.

      Specified by:
        `method` in interface `MethodTarget`
      Parameters:
        `name` - The method name.
        `parameterTypes` - The method parameter types.
      Returns:
        A creational context representing the selected method.

    - #### build

          public ConstrainedParameter build(ConstraintHelper constraintHelper,
                                   ParameterNameProvider parameterNameProvider)

    - #### getConstraintType

          protected ConstraintDescriptorImpl.ConstraintType getConstraintType()

      Description copied from class: `ConstraintMappingContextImplBase`
      Returns the type of constraints hosted on the element configured by this creational context.
      Specified by:
        `getConstraintType` in class `ConstraintMappingContextImplBase`
      Returns:
        the type of constraints hosted on the element configured by this creational context

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