Package javax.validation.metadata

Examples of javax.validation.metadata.ParameterDescriptor



    List<ParameterDescriptor> parameterDescriptors = descriptor.getParameterDescriptors();
    assertTrue( parameterDescriptors.size() == 1 );

    ParameterDescriptor parameterDescriptor = parameterDescriptors.get( 0 );
    assertTrue( parameterDescriptor.isCascaded(), "<valid/> is used to configure cascading" );
  }
View Full Code Here


    assertEquals( groupConversionDescriptor.getFrom(), Default.class, "Wrong from class for group conversion" );

    List<ParameterDescriptor> parameterDescriptors = descriptor.getParameterDescriptors();
    assertTrue( parameterDescriptors.size() == 1 );

    ParameterDescriptor parameterDescriptor = parameterDescriptors.get( 0 );
    groupConversionDescriptors = parameterDescriptor.getGroupConversions();
    assertTrue( groupConversionDescriptors.size() == 1 );

    groupConversionDescriptor = groupConversionDescriptors.iterator().next();
    assertEquals( groupConversionDescriptor.getFrom(), Default.class, "Wrong from class for group conversion" );
  }
View Full Code Here

    assertNotNull( descriptor, "the specified method should be configured in xml" );

    ReturnValueDescriptor returnValueDescriptor = descriptor.getReturnValueDescriptor();
    assertTrue( returnValueDescriptor.isCascaded(), "Cascaded validation should be applied" );

    ParameterDescriptor parameterDescriptor = descriptor.getParameterDescriptors().get( 0 );
    assertTrue( parameterDescriptor.isCascaded(), "Cascaded validation should be applied" );
  }
View Full Code Here

    assertNotNull( descriptor, "the specified constructor should be configured in xml" );

    ReturnValueDescriptor returnValueDescriptor = descriptor.getReturnValueDescriptor();
    assertTrue( returnValueDescriptor.isCascaded(), "Cascaded validation should be applied" );

    ParameterDescriptor parameterDescriptor = descriptor.getParameterDescriptors().get( 0 );
    assertTrue( parameterDescriptor.isCascaded(), "Cascaded validation should be applied" );
  }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "6.4", id = "b")
  public void testGetGroupConversionsReturnsEmptySetForConstructorParameter() {
    ParameterDescriptor parameterDescriptor = Executables.parameterConstrainedConstructor()
        .getParameterDescriptors()
        .get( 0 );
    Set<GroupConversionDescriptor> groupConversions = parameterDescriptor.getGroupConversions();

    assertNotNull( groupConversions );
    assertTrue( groupConversions.isEmpty() );
  }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "6.4", id = "b")
  public void testGetGroupConversionsReturnsEmptySetForMethodParameter() {
    ParameterDescriptor parameterDescriptor = Executables.parameterConstrainedMethod()
        .getParameterDescriptors()
        .get( 0 );
    Set<GroupConversionDescriptor> groupConversions = parameterDescriptor.getGroupConversions();

    assertNotNull( groupConversions );
    assertTrue( groupConversions.isEmpty() );
  }
View Full Code Here

                        ensureNoReturnValueAddedInChild(methodDesc.getReturnValueDescriptor(), parentDesc, "Return value constraints should be at least the same for parent and children");

                        if (parentDesc != null) {
                            final Iterator<ParameterDescriptor> parentPd = parentDesc.getParameterDescriptors().iterator();
                            for (final ParameterDescriptor pd : methodDesc.getParameterDescriptors()) {
                                final ParameterDescriptor next = parentPd.next();
                                if (pd.getConstraintDescriptors().size() != next.getConstraintDescriptors().size()) {
                                    throw new ConstraintDeclarationException("child shouldn't get more constraint than parent");
                                }
                                if (pd.isCascaded() != next.isCascaded()) { // @Valid
                                    throw new ConstraintDeclarationException("child shouldn't get more constraint than parent");
                                }
                            }
                        } else {
                            ensureMethodDoesntDefineParameterConstraint(methodDesc);
View Full Code Here

      }
    }
    else if ( localContext.getParameterIndex() != null ) {
      // add the parameter descriptor
      Integer parameterIndex = localContext.getParameterIndex();
      ParameterDescriptor parameterDescriptor = executableDescriptor.getParameterDescriptors()
          .get( parameterIndex );
      elementDescriptors.add( parameterDescriptor );

      value = parameterValues[localContext.getParameterIndex()];
View Full Code Here

  }

  @Test
  @TestForIssue(jiraKey = "HV-443")
  public void testFindParameterConstraintLookingAt() {
    ParameterDescriptor parameterDescriptor = getMethodDescriptor(
        CustomerRepositoryExt.class,
        "createCustomer",
        CharSequence.class,
        String.class
    ).getParameterDescriptors().get( 1 );

    Set<ConstraintDescriptor<?>> constraintDescriptors = parameterDescriptor.findConstraints()
        .lookingAt( Scope.LOCAL_ELEMENT )
        .getConstraintDescriptors();
    assertEquals( constraintDescriptors.size(), 0 );

    constraintDescriptors = parameterDescriptor.findConstraints()
        .lookingAt( Scope.HIERARCHY )
        .getConstraintDescriptors();
    assertEquals( constraintDescriptors.size(), 1 );
    assertEquals(
        constraintDescriptors.iterator().next().getAnnotation().annotationType(),
View Full Code Here

    List<ParameterDescriptor> parameterConstraints = methodDescriptor.getParameterDescriptors();
    assertNotNull( parameterConstraints );
    assertEquals( parameterConstraints.size(), 2 );

    ParameterDescriptor parameterDescriptor1 = parameterConstraints.get( 0 );
    assertEquals( parameterDescriptor1.getElementClass(), CharSequence.class );
    assertFalse( parameterDescriptor1.hasConstraints() );

    ParameterDescriptor parameterDescriptor2 = parameterConstraints.get( 1 );
    assertEquals( parameterDescriptor2.getElementClass(), String.class );
    assertTrue( parameterDescriptor2.hasConstraints() );
  }
View Full Code Here

TOP

Related Classes of javax.validation.metadata.ParameterDescriptor

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.