Package org.apache.bval.jsr303.xml

Examples of org.apache.bval.jsr303.xml.ValidationMappingParser


     * validate constraints hosted on parameters of a method
     */
    private <T> void validateReturnedValueInContext(GroupValidationContext<T> context,
        MethodDescriptorImpl methodDescriptor) {

        final Groups groups = context.getGroups();

        for (ConstraintDescriptor<?> consDesc : methodDescriptor.getConstraintDescriptors()) {
            ConstraintValidation<?> validation = (ConstraintValidation<?>) consDesc;
            // 1. process groups
            for (Group current : groups.getGroups()) {
                context.setCurrentGroup(current);
                validation.validate(context);
            }
            // 2. process sequences
            for (List<Group> eachSeq : groups.getSequences()) {
                for (Group current : eachSeq) {
                    context.setCurrentGroup(current);
                    validation.validate(context);
                    /**
                     * if one of the group process in the sequence leads to one
                     * or more validation failure, the groups following in the
                     * sequence must not be processed
                     */
                    if (!context.getListener().isEmpty())
                        break;
                }
            }
        }
        if (methodDescriptor.isCascaded() && context.getValidatedValue() != null) {
            context
                .setMetaBean(factoryContext.getMetaBeanFinder().findForClass(context.getValidatedValue().getClass()));
            // 1. process groups
            for (Group current : groups.getGroups()) {
                context.setCurrentGroup(current);
                ValidationHelper
                    .validateContext(context, new Jsr303ValidationCallback(context), isTreatMapsLikeBeans());
            }
            // 2. process sequences
            for (List<Group> eachSeq : groups.getSequences()) {
                for (Group current : eachSeq) {
                    context.setCurrentGroup(current);
                    ValidationHelper.validateContext(context, new Jsr303ValidationCallback(context),
                        isTreatMapsLikeBeans());
                    /**
 
View Full Code Here


    }

    public ElementDescriptor.ConstraintFinder unorderedAndMatchingGroups(Class<?>... groups) {
        Set<ConstraintValidation> matchingDescriptors =
              new HashSet<ConstraintValidation>(constraintDescriptors.size());
        Groups groupChain = new GroupsComputer().computeGroups(groups);
        for (Group group : groupChain.getGroups()) {
            if ( group.isDefault() ) {
                // If group is default, check if it gets redefined
                List<Group> expandedDefaultGroup = metaBean.getFeature(Jsr303Features.Bean.GROUP_SEQUENCE);
                for ( Group defaultGroupMember : expandedDefaultGroup ) {
                    for (ConstraintValidation descriptor : constraintDescriptors) {
View Full Code Here

   */
  private <T> void validateParameterInContext(
      GroupValidationContext<ConstraintValidationListener<T>> context,
      ParameterDescriptorImpl paramDesc) {

    final Groups groups = context.getGroups();

    for (ConstraintDescriptor consDesc : paramDesc.getConstraintDescriptors()) {
      ConstraintValidation validation = (ConstraintValidation) consDesc;
      // 1. process groups
      for (Group current : groups.getGroups()) {
        context.setCurrentGroup(current);
        validation.validate(context);
      }
      // 2. process sequences
      for (List<Group> eachSeq : groups.getSequences()) {
        for (Group current : eachSeq) {
          context.setCurrentGroup(current);
          validation.validate(context);
          /**
           * if one of the group process in the sequence leads to one or more validation failure,
           * the groups following in the sequence must not be processed
           */
          if (!context.getListener().isEmpty()) break;
        }
      }
    }
    if (paramDesc.isCascaded() && context.getValidatedValue() != null) {
      context.setMetaBean(factoryContext.getMetaBeanFinder().
          findForClass(context.getValidatedValue().getClass()));
      // 1. process groups
      for (Group current : groups.getGroups()) {
        context.setCurrentGroup(current);
        validateContext(context);
      }
      // 2. process sequences
      for (List<Group> eachSeq : groups.getSequences()) {
        for (Group current : eachSeq) {
          context.setCurrentGroup(current);
          validateContext(context);
          /**
           * if one of the group process in the sequence leads to one or more validation failure,
View Full Code Here

   */
  private <T> void validateReturnedValueInContext(
      GroupValidationContext<ConstraintValidationListener<T>> context,
      MethodDescriptorImpl methodDescriptor) {

    final Groups groups = context.getGroups();

    for (ConstraintDescriptor consDesc : methodDescriptor.getConstraintDescriptors()) {
      ConstraintValidation validation = (ConstraintValidation) consDesc;
      // 1. process groups
      for (Group current : groups.getGroups()) {
        context.setCurrentGroup(current);
        validation.validate(context);
      }
      // 2. process sequences
      for (List<Group> eachSeq : groups.getSequences()) {
        for (Group current : eachSeq) {
          context.setCurrentGroup(current);
          validation.validate(context);
          /**
           * if one of the group process in the sequence leads to one or more validation failure,
           * the groups following in the sequence must not be processed
           */
          if (!context.getListener().isEmpty()) break;
        }
      }
    }
    if (methodDescriptor.isCascaded() && context.getValidatedValue() != null) {
      context.setMetaBean(factoryContext.getMetaBeanFinder().
          findForClass(context.getValidatedValue().getClass()));
      // 1. process groups
      for (Group current : groups.getGroups()) {
        context.setCurrentGroup(current);
        validateContext(context);
      }
      // 2. process sequences
      for (List<Group> eachSeq : groups.getSequences()) {
        for (Group current : eachSeq) {
          context.setCurrentGroup(current);
          validateContext(context);
          /**
           * if one of the group process in the sequence leads to one or more validation failure,
View Full Code Here

                  createContext(metaBean, null, beanType, groups);
            ConstraintValidationListener result = context.getListener();
            context.setMetaProperty(
                  getNestedProperty(metaBean, null, propertyName).getMetaProperty());
            context.setFixedValue(value);
            Groups sequence = context.getGroups();
            // 1. process groups
            for (Group current : sequence.getGroups()) {
                context.setCurrentGroup(current);
                validatePropertyInGroup(context);
            }
            // 2. process sequences
            for (List<Group> eachSeq : sequence.getSequences()) {
                for (Group current : eachSeq) {
                    context.setCurrentGroup(current);
                    validatePropertyInGroup(context);
                    /**
                     * if one of the group process in the sequence leads to one or more validation failure,
View Full Code Here

        try {
            final GroupValidationContext<ConstraintValidationListener<T>> context =
                  createContext(factoryContext.getMetaBeanFinder()
                        .findForClass(object.getClass()), object, (Class<T>)object.getClass(), groupArray);
            final ConstraintValidationListener result = context.getListener();
            final Groups groups = context.getGroups();
            // 1. process groups
            for (Group current : groups.getGroups()) {
                context.setCurrentGroup(current);
                validateBeanNet(context);
            }
            // 2. process sequences
            for (List<Group> eachSeq : groups.getSequences()) {
                for (Group current : eachSeq) {
                    context.setCurrentGroup(current);
                    validateBeanNet(context);
                    /**
                     * if one of the group process in the sequence leads to one or more validation failure,
View Full Code Here

            } else {
                context.setMetaProperty(nestedProp.getMetaProperty());
            }
            if (context.getMetaProperty() == null) throw new IllegalArgumentException(
                  "Unknown property " + object.getClass().getName() + "." + propertyName);
            Groups sequence = context.getGroups();
            // 1. process groups
            for (Group current : sequence.getGroups()) {
                context.setCurrentGroup(current);
                validatePropertyInGroup(context);
            }
            // 2. process sequences
            for (List<Group> eachSeq : sequence.getSequences()) {
                for (Group current : eachSeq) {
                    context.setCurrentGroup(current);
                    validatePropertyInGroup(context);
                    /**
                     * if one of the group process in the sequence leads to one or more validation failure,
View Full Code Here

     * {@inheritDoc}
     */
    public ElementDescriptor.ConstraintFinder unorderedAndMatchingGroups(Class<?>... groups) {
        Set<ConstraintValidation<?>> matchingDescriptors =
            new HashSet<ConstraintValidation<?>>(constraintDescriptors.size());
        Groups groupChain = new GroupsComputer().computeGroups(groups);
        for (Group group : groupChain.getGroups()) {
            if (group.isDefault()) {
                // If group is default, check if it gets redefined
                List<Group> expandedDefaultGroup = metaBean.getFeature(Jsr303Features.Bean.GROUP_SEQUENCE);
                for (Group defaultGroupMember : expandedDefaultGroup) {
                    for (ConstraintValidation<?> descriptor : constraintDescriptors) {
View Full Code Here

        super(name);
    }

    public void setUp() throws Exception {
        super.setUp();
        groupsComputer = new GroupsComputer();
    }
View Full Code Here

     * {@inheritDoc}
     */
    public ElementDescriptor.ConstraintFinder unorderedAndMatchingGroups(Class<?>... groups) {
        Set<ConstraintValidation<?>> matchingDescriptors =
            new HashSet<ConstraintValidation<?>>(constraintDescriptors.size());
        Groups groupChain = new GroupsComputer().computeGroups(groups);
        for (Group group : groupChain.getGroups()) {
            if (group.isDefault()) {
                // If group is default, check if it gets redefined
                List<Group> expandedDefaultGroup = metaBean.getFeature(Jsr303Features.Bean.GROUP_SEQUENCE);
                for (Group defaultGroupMember : expandedDefaultGroup) {
View Full Code Here

TOP

Related Classes of org.apache.bval.jsr303.xml.ValidationMappingParser

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.