Package javax.validation

Examples of javax.validation.ConstraintTarget


  @Test
  @SpecAssertion(section = "6.11", id = "l")
  public void testGetValidationAppliesTo() {
    ConstraintDescriptor<?> descriptor = getConstraintDescriptor( Person.class, "age" );
    ConstraintTarget constraintTarget = descriptor.getValidationAppliesTo();
    assertNotNull( constraintTarget );
    assertEquals( constraintTarget, ConstraintTarget.RETURN_VALUE );
  }
View Full Code Here


    ConstraintDescriptor<?> descriptor = getConstraintDescriptor( Person.class, "age" );

    Set<ConstraintDescriptor<?>> composingDescriptors = descriptor.getComposingConstraints();
    assertEquals( composingDescriptors.size(), 1, "Wrong number of composing constraints" );

    ConstraintTarget constraintTarget = composingDescriptors.iterator().next().getValidationAppliesTo();
    assertNotNull( constraintTarget );
    assertEquals( constraintTarget, ConstraintTarget.RETURN_VALUE );
  }
View Full Code Here

  @Test
  @SpecAssertion(section = "6.11", id = "l")
  public void testGetValidationAppliesToReturnsNull() {
    ConstraintDescriptor<?> descriptor = getConstraintDescriptor( Person.class, "firstName" );
    ConstraintTarget constraintTarget = descriptor.getValidationAppliesTo();
    assertNull( constraintTarget );
  }
View Full Code Here

     */
    private ConstraintType determineConstraintType(Member member,
                                                   ElementType elementType,
                                                   boolean hasGenericValidators,
                                                   boolean hasCrossParameterValidator) {
        ConstraintTarget constraintTarget = (ConstraintTarget) attributes.get( ConstraintHelper.VALIDATION_APPLIES_TO );
        ConstraintType constraintType;
        boolean isExecutable = isExecutable( elementType );

        //target explicitly set to RETURN_VALUE
        if ( constraintTarget == ConstraintTarget.RETURN_VALUE ) {
View Full Code Here

        );
      }
      if ( method.getReturnType() != ConstraintTarget.class ) {
        throw log.getValidationAppliesToParameterMustHaveReturnTypeConstraintTargetException( annotationType.getName() );
      }
      ConstraintTarget defaultValue = (ConstraintTarget) method.getDefaultValue();
      if ( defaultValue != ConstraintTarget.IMPLICIT ) {
        throw log.getValidationAppliesToParameterMustHaveDefaultValueImplicitException( annotationType.getName() );
      }
    }
    else if ( method != null ) {
View Full Code Here

        );
      }
      if ( method.getReturnType() != ConstraintTarget.class ) {
        throw log.getValidationAppliesToParameterMustHaveReturnTypeConstraintTargetException( annotationType.getName() );
      }
      ConstraintTarget defaultValue = (ConstraintTarget) method.getDefaultValue();
      if ( defaultValue != ConstraintTarget.IMPLICIT ) {
        throw log.getValidationAppliesToParameterMustHaveDefaultValueImplicitException( annotationType.getName() );
      }
    }
    else if ( method != null ) {
View Full Code Here

  private ConstraintType determineConstraintType(Member member,
      ElementType elementType,
      boolean hasGenericValidators,
      boolean hasCrossParameterValidator,
      ConstraintType externalConstraintType) {
    ConstraintTarget constraintTarget = (ConstraintTarget) attributes.get( ConstraintHelper.VALIDATION_APPLIES_TO );
    ConstraintType constraintType;
    boolean isExecutable = isExecutable( elementType );

    //target explicitly set to RETURN_VALUE
    if ( constraintTarget == ConstraintTarget.RETURN_VALUE ) {
View Full Code Here

    // Now we are out of luck. We have cross parameter and generic validators.
    if ( !attributes.containsKey( VALIDATION_APPLIES_TO ) ) {
      throw log.getGenericAndCrossParameterValidatorWithoutConstraintTargetException( annotationType.getName() );
    }

    ConstraintTarget constraintTarget = (ConstraintTarget) attributes.get( VALIDATION_APPLIES_TO );
    switch ( constraintTarget ) {
      case IMPLICIT: {
        throw log.getImplicitConstraintTargetInAmbiguousConfigurationException( annotationType.getName() );
      }
      case RETURN_VALUE: {
View Full Code Here

  private ConstraintType determineConstraintType(Member member,
      ElementType elementType,
      boolean hasGenericValidators,
      boolean hasCrossParameterValidator,
      ConstraintType externalConstraintType) {
    ConstraintTarget constraintTarget = (ConstraintTarget) attributes.get( ConstraintHelper.VALIDATION_APPLIES_TO );
    ConstraintType constraintType;
    boolean isExecutable = isExecutable( elementType );

    //target explicitly set to RETURN_VALUE
    if ( constraintTarget == ConstraintTarget.RETURN_VALUE ) {
View Full Code Here

        );
      }
      if ( method.getReturnType() != ConstraintTarget.class ) {
        throw log.getValidationAppliesToParameterMustHaveReturnTypeConstraintTargetException( annotationType.getName() );
      }
      ConstraintTarget defaultValue = (ConstraintTarget) method.getDefaultValue();
      if ( defaultValue != ConstraintTarget.IMPLICIT ) {
        throw log.getValidationAppliesToParameterMustHaveDefaultValueImplicitException( annotationType.getName() );
      }
    }
    else if ( method != null ) {
View Full Code Here

TOP

Related Classes of javax.validation.ConstraintTarget

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.