Package javax.validation.metadata.ElementDescriptor

Examples of javax.validation.metadata.ElementDescriptor.ConstraintFinder


    //get constraints for each property name
    for(String propertyName : propertySet) {
      PropertyDescriptor property = DescriptorFactory.INSTANCE.getPropertyDescriptor(this.backingReflector, propertyName);
     
      //create finder
      ConstraintFinder finder = property.findConstraints()
        .lookingAt(scope)
        .declaredOn(declaredOnTypes.toArray(new ElementType[]{}))
        .unorderedAndMatchingGroups(matchingGroups.toArray(new Class<?>[]{}));
     
      //find and add to results
      results.addAll(finder.getConstraintDescriptors());
    }
    return results;
  }
View Full Code Here


    Collection<ValidatorDescriptor> processBeanAttribute(FacesContext context, ValueDescriptor descriptor, String msg,
        Class<?>... groups) {
        PropertyDescriptor constraintsForProperty = getValidator(context).getConstraintsForClass(descriptor.getBeanType())
            .getConstraintsForProperty(descriptor.getName());
        if (null != constraintsForProperty) {
            ConstraintFinder propertyConstraints = constraintsForProperty.findConstraints();
            if (null != groups && groups.length > 0) {
                // Filter groups, if required
                propertyConstraints = propertyConstraints.unorderedAndMatchingGroups(groups);
            }
            Set<ConstraintDescriptor<?>> constraints = propertyConstraints // or the requested list of groups)
                .getConstraintDescriptors();

            // ContextHolder is an arbitrary object, it will depend on the implementation
            FacesMessage message = Strings.isEmpty(msg) ? null : new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg);
            return processConstraints(context, constraints, message);
View Full Code Here

TOP

Related Classes of javax.validation.metadata.ElementDescriptor.ConstraintFinder

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.