Package javax.validation.metadata

Examples of javax.validation.metadata.MethodDescriptor


      @SpecAssertion(section = "6.2", id = "d"),
      @SpecAssertion(section = "6.2", id = "g"),
      @SpecAssertion(section = "6.7", id = "g")
  })
  public void testFindConstraintsForMethodDefinedOnSuperTypeLookingAt() {
    MethodDescriptor crossParameterConstrainedDescriptor = Executables.crossParameterConstrainedMethodFromSuperType();
    assertEquals(
        crossParameterConstrainedDescriptor.findConstraints()
            .lookingAt( Scope.LOCAL_ELEMENT )
            .getConstraintDescriptors()
            .size(),
        0,
        "Should have no local constraints"
    );

    assertTrue(
        crossParameterConstrainedDescriptor.findConstraints().lookingAt( Scope.HIERARCHY )
            .getConstraintDescriptors()
            .isEmpty(),
        "Should have no hierarchy constraint"
    );
  }
View Full Code Here


            .getBootstrapConfiguration()
            .getDefaultValidatedExecutableTypes(),
        Collections.emptySet()
    );

    MethodDescriptor descriptor = getMethodDescriptor(
        StockItem.class,
        "setName",
        String.class
    );

    assertNotNull( descriptor );
    assertEquals( descriptor.getName(), "setName" );
    assertEquals( descriptor.getParameterDescriptors().get( 0 ).getConstraintDescriptors().size(), 1 );
  }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "6.3", id = "e")
  public void testGetConstraintsForParameterConstrainedMethod() {
    MethodDescriptor methodDescriptor = Executables.parameterConstrainedMethod();
    assertNotNull( methodDescriptor, "Descriptor should not be null" );
  }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "6.3", id = "e")
  public void testGetConstraintsForCrossParameterConstrainedMethod() {
    MethodDescriptor methodDescriptor = Executables.crossParameterConstrainedMethod();
    assertNotNull( methodDescriptor, "Descriptor should not be null" );
  }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "6.3", id = "e")
  public void testGetConstraintsForCascadedParameterMethod() {
    MethodDescriptor methodDescriptor = Executables.cascadedParameterMethod();
    assertNotNull( methodDescriptor, "Descriptor should not be null" );
  }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "6.3", id = "e")
  public void testGetConstraintsForReturnValueConstrainedMethod() {
    MethodDescriptor methodDescriptor = Executables.returnValueConstrainedMethod();
    assertNotNull( methodDescriptor, "Descriptor should not be null" );
  }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "6.3", id = "e")
  public void testGetConstraintsForCascadedReturnValueMethod() {
    MethodDescriptor methodDescriptor = Executables.cascadedReturnValueMethod();
    assertNotNull( methodDescriptor, "Descriptor should not be null" );
  }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "6.3", id = "e")
  public void testGetConstraintsForUnconstrainedMethod() {
    MethodDescriptor methodDescriptor = Executables.unconstrainedMethod();
    assertNull( methodDescriptor, "Descriptor should be null" );
  }
View Full Code Here

  @Test
  @SpecAssertion(section = "6.3", id = "e")
  public void testGetConstraintsForNonExistingMethod() {
    BeanDescriptor beanDescriptor = validator.getConstraintsForClass( CustomerService.class );
    MethodDescriptor methodDescriptor = beanDescriptor.getConstraintsForMethod( "foo" );
    assertNull( methodDescriptor, "Descriptor should be null" );
  }
View Full Code Here

    this.parameterNameProvider = parameterNameProvider;
  }

  public boolean accepts(ResourceMethod method) {
  BeanDescriptor bean = methodValidator.getConstraintsForClass(method.getResource().getType());
  MethodDescriptor descriptor = bean.getConstraintsForMethod(method.getMethod().getName(), method.getMethod().getParameterTypes());
  return descriptor != null && descriptor.hasConstrainedParameters();
  }
View Full Code Here

TOP

Related Classes of javax.validation.metadata.MethodDescriptor

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.