Package javax.validation.metadata

Examples of javax.validation.metadata.BeanDescriptor


                 PersistentClass persistentClass,
                 Class<?> clazz,
                 ValidatorFactory factory,
                 Set<Class<?>> groups,
                 boolean activateNotNull) {
    final BeanDescriptor descriptor = factory.getValidator().getConstraintsForClass( clazz );
    //no bean level constraints can be applied, go to the properties

    for ( PropertyDescriptor propertyDesc : descriptor.getConstrainedProperties() ) {
      Property property = findPropertyByName( persistentClass, prefix + propertyDesc.getPropertyName() );
      boolean hasNotNull;
      if ( property != null ) {
        hasNotNull = applyConstraints(
            propertyDesc.getConstraintDescriptors(), property, propertyDesc, groups, activateNotNull
View Full Code Here


  }

  @Test
  @SpecAssertion(section = "3.3", id = "m")
  public void testAttributesDefinedOnComposingConstraints() {
    BeanDescriptor descriptor = validator.getConstraintsForClass( FrenchAddress.class );
    Set<ConstraintDescriptor<?>> constraintDescriptors = descriptor.getConstraintsForProperty( "zipCode" )
        .getConstraintDescriptors();
    boolean findPattern = checkForAppropriateAnnotation( constraintDescriptors );
    assertTrue( findPattern, "Could not find @Pattern in composing constraints" );
  }
View Full Code Here

      Class<?> clazz,
      ValidatorFactory factory,
      Set<Class<?>> groups,
      boolean activateNotNull,
      Dialect dialect) {
    final BeanDescriptor descriptor = factory.getValidator().getConstraintsForClass( clazz );
    //no bean level constraints can be applied, go to the properties

    for ( PropertyDescriptor propertyDesc : descriptor.getConstrainedProperties() ) {
      Property property = findPropertyByName( persistentClass, prefix + propertyDesc.getPropertyName() );
      boolean hasNotNull;
      if ( property != null ) {
        hasNotNull = applyConstraints(
            propertyDesc.getConstraintDescriptors(), property, propertyDesc, groups, activateNotNull, dialect
View Full Code Here

    if (method.getParameterTypes().length == 0) {
      logger.debug("method {} has no parameters, skipping", controllerMethod);
      return false;
    }

    BeanDescriptor bean = bvalidator.getConstraintsForClass(controllerMethod.getController().getType());
    MethodDescriptor descriptor = bean.getConstraintsForMethod(method.getName(), method.getParameterTypes());
    return descriptor != null && descriptor.hasConstrainedParameters();
  }
View Full Code Here

  private List<Iterator<ConstraintDescriptor<?>>> stack = new ArrayList<>();

  public ConstraintIterator(Validator validator, Property property, Class<?>... groups)
  {
    BeanDescriptor beanDesc = validator.getConstraintsForClass(property.getOwner());
    if (beanDesc != null)
    {
      PropertyDescriptor propDesc = beanDesc.getConstraintsForProperty(property.getName());
      if (propDesc != null)
      {
        // TODO use hasConstraintDesc to optimize...?
        Set<ConstraintDescriptor<?>> constraints = propDesc.findConstraints()
          .unorderedAndMatchingGroups(groups)
View Full Code Here

    }
   
    final private static ValidationInfo getValidationInfo(BeanValidationContext beanValidationContext, String currentProperty, Validator validator) {
        Class<?> beanType = beanValidationContext.getBeanType();
        String[] path = currentProperty.split("\\.");
        BeanDescriptor beanDescriptor = validator.getConstraintsForClass(beanType);
       
        for (int i = 1; i < path.length - 1; i++)
        {
            Class<?> constrainedPropertyClass = getConstrainedPropertyClass(beanDescriptor, path[i]);
            if (constrainedPropertyClass != null) {
                beanType = constrainedPropertyClass;
                beanDescriptor = validator.getConstraintsForClass(beanType);
            }
        }

        final String propertyName = path[path.length - 1];
        PropertyDescriptor propertyDescriptor = beanDescriptor.getConstraintsForProperty(propertyName);
        return new ValidationInfo(beanType, propertyName, propertyDescriptor);
    }
View Full Code Here

    return Collections.emptySet();
  }

  @Override
  public BeanDescriptor getConstraintsForClass(final Class<?> clazz) {
    return new BeanDescriptor () {

      @Override
      public boolean hasConstraints() {
        return false;
      }
View Full Code Here

                 PersistentClass persistentClass,
                 Class<?> clazz,
                 ValidatorFactory factory,
                 Set<Class<?>> groups,
                 boolean activateNotNull) {
    final BeanDescriptor descriptor = factory.getValidator().getConstraintsForClass( clazz );
    //no bean level constraints can be applied, go to the properties

    for ( PropertyDescriptor propertyDesc : descriptor.getConstrainedProperties() ) {
      Property property = findPropertyByName( persistentClass, prefix + propertyDesc.getPropertyName() );
      boolean hasNotNull = false;
      if ( property != null ) {
        hasNotNull = applyConstraints( propertyDesc.getConstraintDescriptors(), property, propertyDesc, groups, activateNotNull );
        if ( property.isComposite() && propertyDesc.isCascaded() ) {
View Full Code Here

                 PersistentClass persistentClass,
                 Class<?> clazz,
                 ValidatorFactory factory,
                 Set<Class<?>> groups,
                 boolean activateNotNull) {
    final BeanDescriptor descriptor = factory.getValidator().getConstraintsForClass( clazz );
    //no bean level constraints can be applied, go to the properties

    for ( PropertyDescriptor propertyDesc : descriptor.getConstrainedProperties() ) {
      Property property = findPropertyByName( persistentClass, prefix + propertyDesc.getPropertyName() );
      boolean hasNotNull = false;
      if ( property != null ) {
        hasNotNull = applyConstraints( propertyDesc.getConstraintDescriptors(), property, propertyDesc, groups, activateNotNull );
        if ( property.isComposite() && propertyDesc.isCascaded() ) {
View Full Code Here

      Class<?> clazz,
      ValidatorFactory factory,
      Set<Class<?>> groups,
      boolean activateNotNull,
      Dialect dialect) {
    final BeanDescriptor descriptor = factory.getValidator().getConstraintsForClass( clazz );
    //no bean level constraints can be applied, go to the properties

    for ( PropertyDescriptor propertyDesc : descriptor.getConstrainedProperties() ) {
      Property property = findPropertyByName( persistentClass, prefix + propertyDesc.getPropertyName() );
      boolean hasNotNull;
      if ( property != null ) {
        hasNotNull = applyConstraints(
            propertyDesc.getConstraintDescriptors(), property, propertyDesc, groups, activateNotNull, dialect
View Full Code Here

TOP

Related Classes of javax.validation.metadata.BeanDescriptor

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.