Package org.hibernate.validator.internal.metadata.location

Examples of org.hibernate.validator.internal.metadata.location.ExecutableConstraintLocation


  public PropertyConstraintMappingContext valid() {
    if ( member instanceof Field ) {
      mapping.addCascadeConfig( new BeanConstraintLocation( member ) );
    }
    else {
      mapping.addMethodCascadeConfig( new ExecutableConstraintLocation( (Method) member ) );
    }

    return this;
  }
View Full Code Here


   * Marks the current property as cascadable.
   *
   * @return Returns itself for method chaining.
   */
  public ReturnValueConstraintMappingContext valid() {
    mapping.addMethodCascadeConfig( new ExecutableConstraintLocation( method ) );
    return this;
  }
View Full Code Here

   *
   * @return Returns itself for method chaining.
   */
  public ParameterConstraintMappingContext valid() {
    mapping.addMethodCascadeConfig(
        new ExecutableConstraintLocation(
            method, parameterIndex
        )
    );
    return this;
  }
View Full Code Here

    );
  }

  public static <A extends Annotation> ConfiguredConstraint<A, ExecutableConstraintLocation> forParameter(ConstraintDef<?, A> constraint, Method method, int parameterIndex) {
    return new ConfiguredConstraint<A, ExecutableConstraintLocation>(
        constraint, new ExecutableConstraintLocation( method, parameterIndex )
    );
  }
View Full Code Here

    );
  }

  public static <A extends Annotation> ConfiguredConstraint<A, ExecutableConstraintLocation> forReturnValue(ConstraintDef<?, A> constraint, Method method) {
    return new ConfiguredConstraint<A, ExecutableConstraintLocation>(
        constraint, new ExecutableConstraintLocation( method )
    );
  }
View Full Code Here

      isCascading = executable.getAccessibleObject().isAnnotationPresent( Valid.class );
    }

    return new ConstrainedExecutable(
        ConfigurationSource.ANNOTATION,
        new ExecutableConstraintLocation( executable ),
        parameterConstraints,
        crossParameterConstraints,
        returnValueConstraints,
        groupConversions,
        isCascading
View Full Code Here

      if ( annotationProcessingOptions.areParameterConstraintsIgnoredFor( executable.getMember(), i ) ) {
        metaData.add(
            new ConstrainedParameter(
                ConfigurationSource.ANNOTATION,
                new ExecutableConstraintLocation( executable, i ),
                parameterName,
                parameterConstraints,
                getGroupConversions( groupConversion, groupConversionList ),
                false
            )
        );
        i++;
        continue;
      }

      for ( Annotation parameterAnnotation : parameterAnnotations ) {
        //1. collect constraints if this annotation is a constraint annotation
        List<ConstraintDescriptorImpl<?>> constraints = findConstraintAnnotations(
            executable.getMember(), parameterAnnotation, ElementType.PARAMETER
        );
        for ( ConstraintDescriptorImpl<?> constraintDescriptorImpl : constraints ) {
          parameterConstraints.add(
              createParameterMetaConstraint(
                  executable, i, constraintDescriptorImpl
              )
          );
        }

        //2. mark parameter as cascading if this annotation is the @Valid annotation
        if ( parameterAnnotation.annotationType().equals( Valid.class ) ) {
          parameterIsCascading = true;
        }
        //3. determine group conversions
        else if ( parameterAnnotation.annotationType().equals( ConvertGroup.class ) ) {
          groupConversion = (ConvertGroup) parameterAnnotation;
        }
        else if ( parameterAnnotation.annotationType().equals( ConvertGroup.List.class ) ) {
          groupConversionList = (ConvertGroup.List) parameterAnnotation;
        }
      }

      metaData.add(
          new ConstrainedParameter(
              ConfigurationSource.ANNOTATION,
              new ExecutableConstraintLocation( executable, i ),
              parameterName,
              parameterConstraints,
              getGroupConversions( groupConversion, groupConversionList ),
              parameterIsCascading
          )
View Full Code Here

  }

  private <A extends Annotation> MetaConstraint<A> createParameterMetaConstraint(ExecutableElement member,
                                           int parameterIndex,
                                           ConstraintDescriptorImpl<A> descriptor) {
    return new MetaConstraint<A>( descriptor, new ExecutableConstraintLocation( member, parameterIndex ) );
  }
View Full Code Here

    return new MetaConstraint<A>( descriptor, new ExecutableConstraintLocation( member, parameterIndex ) );
  }

  private <A extends Annotation> MetaConstraint<A> createReturnValueMetaConstraint(ExecutableElement member,
                                           ConstraintDescriptorImpl<A> descriptor) {
    return new MetaConstraint<A>( descriptor, new ExecutableConstraintLocation( member ) );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.validator.internal.metadata.location.ExecutableConstraintLocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.