clean up no-longer-used code from JSR module

Project: http://git-wip-us.apache.org/repos/asf/bval/repo
Commit: http://git-wip-us.apache.org/repos/asf/bval/commit/92c64b3c
Tree: http://git-wip-us.apache.org/repos/asf/bval/tree/92c64b3c
Diff: http://git-wip-us.apache.org/repos/asf/bval/diff/92c64b3c

Branch: refs/heads/bv2
Commit: 92c64b3ceef1e18733d09f27405045bfbdec5a15
Parents: f1e8de1
Author: Matt Benson <[email protected]>
Authored: Sun Feb 25 13:38:09 2018 -0600
Committer: Matt Benson <[email protected]>
Committed: Sun Feb 25 13:38:09 2018 -0600

----------------------------------------------------------------------
 .../org/apache/bval/cdi/BValInterceptor.java    |   26 +-
 .../bval/jsr/AnnotationConstraintBuilder.java   |  402 ------
 .../apache/bval/jsr/AnnotationProcessor.java    |  315 -----
 .../apache/bval/jsr/ApacheFactoryContext.java   |   16 +-
 .../apache/bval/jsr/ApacheValidatorFactory.java |  260 +---
 .../org/apache/bval/jsr/AppendValidation.java   |   32 -
 .../bval/jsr/AppendValidationToBuilder.java     |   91 --
 .../apache/bval/jsr/AppendValidationToList.java |   45 -
 .../apache/bval/jsr/AppendValidationToMeta.java |   44 -
 .../apache/bval/jsr/BaseAppendValidation.java   |   79 --
 .../org/apache/bval/jsr/BeanDescriptorImpl.java |  916 -------------
 .../org/apache/bval/jsr/ClassValidator.java     | 1292 ------------------
 .../org/apache/bval/jsr/ConstraintCached.java   |    1 -
 .../bval/jsr/ConstraintDescriptorImpl.java      |  236 ----
 .../apache/bval/jsr/ConstraintFinderImpl.java   |  175 ---
 .../apache/bval/jsr/ConstraintValidation.java   |  605 --------
 .../bval/jsr/ConstraintValidationListener.java  |  251 ----
 .../jsr/ConstraintValidatorContextImpl.java     |  211 ---
 .../bval/jsr/ConstraintValidatorIdentity.java   |  128 --
 .../bval/jsr/ConstraintViolationImpl.java       |   10 +-
 .../bval/jsr/ConstructorDescriptorImpl.java     |   63 -
 .../bval/jsr/CrossParameterDescriptorImpl.java  |   35 -
 .../apache/bval/jsr/ElementDescriptorImpl.java  |  199 ---
 .../org/apache/bval/jsr/GraphBeanIdentity.java  |  105 --
 .../apache/bval/jsr/GroupValidationContext.java |  157 ---
 .../bval/jsr/GroupValidationContextImpl.java    |  403 ------
 .../jsr/IncompatiblePropertyValueException.java |   69 -
 .../bval/jsr/InvocableElementDescriptor.java    |  106 --
 .../java/org/apache/bval/jsr/JsrFeatures.java   |   69 -
 .../org/apache/bval/jsr/JsrMetaBeanFactory.java |  339 -----
 .../org/apache/bval/jsr/MethodDescriptor.java   |   40 -
 .../apache/bval/jsr/MethodDescriptorImpl.java   |   64 -
 .../org/apache/bval/jsr/ParameterAccess.java    |   96 --
 .../bval/jsr/ParameterDescriptorImpl.java       |   96 --
 .../org/apache/bval/jsr/ParametersAccess.java   |   46 -
 .../apache/bval/jsr/ProcedureDescriptor.java    |   50 -
 .../apache/bval/jsr/PropertyDescriptorImpl.java |   79 --
 .../java/org/apache/bval/jsr/ReturnAccess.java  |   76 --
 .../bval/jsr/ReturnValueDescriptorImpl.java     |   43 -
 .../bval/jsr/UnknownPropertyException.java      |   67 -
 .../jsr/descriptor/CascadableContainerD.java    |    1 +
 .../bval/jsr/descriptor/DescriptorManager.java  |    4 +
 .../bval/jsr/descriptor/GroupConversion.java    |   85 --
 .../bval/jsr/descriptor/MetadataReader.java     |    1 +
 .../apache/bval/jsr/groups/GroupConversion.java |   85 ++
 .../groups/GroupConversionDescriptorImpl.java   |   44 -
 .../bval/jsr/metadata/CompositeBuilder.java     |    2 +-
 .../apache/bval/jsr/metadata/DualBuilder.java   |    2 +-
 .../apache/bval/jsr/metadata/EmptyBuilder.java  |    2 +-
 .../bval/jsr/metadata/MetadataBuilder.java      |    2 +-
 .../bval/jsr/metadata/ReflectionBuilder.java    |    2 +-
 .../apache/bval/jsr/metadata/XmlBuilder.java    |    2 +-
 .../org/apache/bval/jsr/util/ClassHelper.java   |   61 -
 ...ementNodeBuilderCustomizableContextImpl.java |    1 -
 .../bval/jsr/util/EnumerationConverter.java     |   75 -
 .../jsr/util/NodeBuilderDefinedContextImpl.java |    4 +-
 .../jsr/util/ValidationContextTraversal.java    |  222 ---
 .../apache/bval/jsr/xml/AnnotationIgnores.java  |  202 ---
 .../org/apache/bval/jsr/xml/MetaConstraint.java |  123 --
 .../org/apache/bval/jsr/xml/SchemaManager.java  |    1 -
 .../jsr/ConstraintValidatorContextTest.java     |  112 --
 .../bval/jsr/groups/GroupSequenceTest.java      |   49 +-
 .../jsr/util/EnumerationConverterTestCase.java  |   43 -
 bval-tck/work-tests-suite.xml                   |    3 +-
 64 files changed, 138 insertions(+), 8327 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java 
b/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java
index 7bf7709..b5d2c8b 100644
--- a/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java
+++ b/bval-jsr/src/main/java/org/apache/bval/cdi/BValInterceptor.java
@@ -25,13 +25,11 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.EnumSet;
-import java.util.LinkedList;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Stream;
 
 import javax.annotation.Priority;
 import javax.enterprise.inject.spi.AnnotatedConstructor;
@@ -53,8 +51,10 @@ import javax.validation.executable.ValidateOnExecution;
 import javax.validation.metadata.ConstructorDescriptor;
 import javax.validation.metadata.MethodDescriptor;
 
-import org.apache.bval.jsr.util.ClassHelper;
+import org.apache.bval.jsr.util.Methods;
 import org.apache.bval.jsr.util.Proxies;
+import org.apache.bval.util.reflection.Reflection;
+import org.apache.bval.util.reflection.Reflection.Interfaces;
 
 /**
  * Interceptor class for the {@link BValBinding} {@link InterceptorBinding}.
@@ -205,14 +205,10 @@ public class BValInterceptor implements Serializable {
             synchronized (this) {
                 methodConfig = methodConfiguration.get(method);
                 if (methodConfig == null) {
-                    final List<Class<?>> classHierarchy =
-                        ClassHelper.fillFullClassHierarchyAsList(new 
LinkedList<>(), targetClass);
-                    Collections.reverse(classHierarchy);
-
                     // search on method @ValidateOnExecution
                     ValidateOnExecution validateOnExecution = null;
                     ValidateOnExecution validateOnExecutionType = null;
-                    for (final Class<?> c : classHierarchy) {
+                    for (final Class<?> c : reverseHierarchy(targetClass)) {
                         final AnnotatedType<?> annotatedType = 
CDI.current().getBeanManager().createAnnotatedType(c);
                         AnnotatedMethod<?> annotatedMethod = null;
 
@@ -328,13 +324,13 @@ public class BValInterceptor implements Serializable {
     }
 
     private static boolean doValidMethod(final Method method, final 
Set<ExecutableType> config) {
-        return isGetter(method) ? 
config.contains(ExecutableType.GETTER_METHODS)
-            : config.contains(ExecutableType.NON_GETTER_METHODS);
+        return config
+            .contains(Methods.isGetter(method) ? ExecutableType.GETTER_METHODS 
: ExecutableType.NON_GETTER_METHODS);
     }
 
-    private static boolean isGetter(final Method method) {
-        final String name = method.getName();
-        return method.getParameterTypes().length == 0 && 
!Void.TYPE.equals(method.getReturnType())
-            && (name.startsWith("get") || name.startsWith("is") && 
boolean.class.equals(method.getReturnType()));
+    private static Iterable<Class<?>> reverseHierarchy(Class<?> t) {
+        final Stream.Builder<Class<?>> builder = Stream.builder();
+        Reflection.hierarchy(t, Interfaces.INCLUDE).forEach(builder);
+        return builder.build()::iterator;
     }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java
----------------------------------------------------------------------
diff --git 
a/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java 
b/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java
deleted file mode 100644
index 4b15ba7..0000000
--- 
a/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationConstraintBuilder.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.jsr.groups.GroupsComputer;
-import org.apache.bval.jsr.xml.AnnotationProxyBuilder;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.reflection.TypeUtils;
-import org.apache.commons.weaver.privilizer.Privileged;
-
-import javax.validation.Constraint;
-import javax.validation.ConstraintDeclarationException;
-import javax.validation.ConstraintDefinitionException;
-import javax.validation.ConstraintTarget;
-import javax.validation.ConstraintValidator;
-import javax.validation.OverridesAttribute;
-import javax.validation.Payload;
-import javax.validation.ReportAsSingleViolation;
-import javax.validation.constraintvalidation.SupportedValidationTarget;
-import javax.validation.constraintvalidation.ValidationTarget;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Description: helper class that builds a {@link ConstraintValidation} or its
- * composite constraint validations by parsing the jsr-annotations and
- * providing information (e.g. for @OverridesAttributes) <br/>
- */
-final class AnnotationConstraintBuilder<A extends Annotation> {
-    private static final Logger log = 
Logger.getLogger(AnnotationConstraintBuilder.class.getName());
-
-    private final ConstraintValidation<?> constraintValidation;
-    private List<ConstraintOverrides> overrides;
-
-    /**
-     * Create a new AnnotationConstraintBuilder instance.
-     *
-     * @param validatorClasses
-     * @param annotation
-     * @param owner
-     * @param access
-     */
-    public AnnotationConstraintBuilder(Class<? extends ConstraintValidator<A, 
?>>[] validatorClasses, A annotation,
-        Class<?> owner, AccessStrategy access, ConstraintTarget target) {
-        final boolean reportFromComposite =
-            annotation != null && 
annotation.annotationType().isAnnotationPresent(ReportAsSingleViolation.class);
-        constraintValidation =
-            new ConstraintValidation<>(validatorClasses, annotation, owner, 
access, reportFromComposite, target);
-        buildFromAnnotation();
-    }
-
-    /** build attributes, payload, groups from 'annotation' */
-    @Privileged
-    private void buildFromAnnotation() {
-        if (constraintValidation.getAnnotation() == null) {
-            return;
-        }
-        final Class<? extends Annotation> annotationType = 
constraintValidation.getAnnotation().annotationType();
-
-        boolean foundPayload = false;
-        boolean foundGroups = false;
-        Method validationAppliesTo = null;
-        boolean foundMessage = false;
-
-        for (final Method method : 
AnnotationProxyBuilder.findMethods(annotationType)) {
-            // groups + payload must also appear in attributes (also
-            // checked by TCK-Tests)
-            if (method.getParameterTypes().length == 0) {
-                try {
-                    final String name = method.getName();
-                    if 
(ConstraintAnnotationAttributes.PAYLOAD.getAttributeName().equals(name)) {
-                        buildPayload(method);
-                        foundPayload = true;
-                    } else if 
(ConstraintAnnotationAttributes.GROUPS.getAttributeName().equals(name)) {
-                        buildGroups(method);
-                        foundGroups = true;
-                    } else if 
(ConstraintAnnotationAttributes.VALIDATION_APPLIES_TO.getAttributeName().equals(name))
 {
-                        buildValidationAppliesTo(method);
-                        validationAppliesTo = method;
-                    } else if (name.startsWith("valid")) {
-                        throw new ConstraintDefinitionException(
-                            "constraints parameters can't start with valid: " 
+ name);
-                    } else {
-                        if 
(ConstraintAnnotationAttributes.MESSAGE.getAttributeName().equals(name)) {
-                            foundMessage = true;
-                            if (!TypeUtils.isAssignable(method.getReturnType(),
-                                
ConstraintAnnotationAttributes.MESSAGE.getType())) {
-                                throw new 
ConstraintDefinitionException("Return type for message() must be of type "
-                                    + 
ConstraintAnnotationAttributes.MESSAGE.getType());
-                            }
-                        }
-                        constraintValidation.getAttributes().put(name,
-                            
method.invoke(constraintValidation.getAnnotation()));
-                    }
-                } catch (final ConstraintDefinitionException cde) {
-                    throw cde;
-                } catch (final Exception e) { // do nothing
-                    log.log(Level.WARNING,
-                        String.format("Error processing annotation: %s ", 
constraintValidation.getAnnotation()), e);
-                }
-            }
-        }
-
-        if (!foundMessage) {
-            throw new ConstraintDefinitionException(
-                "Annotation " + annotationType.getName() + " has no message 
method");
-        }
-        if (!foundPayload) {
-            throw new ConstraintDefinitionException(
-                "Annotation " + annotationType.getName() + " has no payload 
method");
-        }
-        if (!foundGroups) {
-            throw new ConstraintDefinitionException("Annotation " + 
annotationType.getName() + " has no groups method");
-        }
-        if (validationAppliesTo != null && ConstraintTarget.IMPLICIT != 
validationAppliesTo.getDefaultValue()) {
-            throw new ConstraintDefinitionException("validationAppliesTo 
default value should be IMPLICIT");
-        }
-
-        // valid validationAppliesTo
-        final Constraint annotation = 
annotationType.getAnnotation(Constraint.class);
-        if (annotation == null) {
-            return;
-        }
-
-        final Pair validationTarget = 
computeValidationTarget(annotation.validatedBy());
-        for (final Annotation a : annotationType.getAnnotations()) {
-            final Class<? extends Annotation> aClass = a.annotationType();
-            if (aClass.getName().startsWith("java.lang.annotation.")) {
-                continue;
-            }
-
-            final Constraint inheritedConstraint = 
aClass.getAnnotation(Constraint.class);
-            if (inheritedConstraint != null && 
!aClass.getName().startsWith("javax.validation.constraints.")) {
-                final Pair validationTargetInherited = 
computeValidationTarget(inheritedConstraint.validatedBy());
-                if ((validationTarget.a > 0 && validationTargetInherited.b > 0 
&& validationTarget.b == 0)
-                    || (validationTarget.b > 0 && validationTargetInherited.a 
> 0 && validationTarget.a == 0)) {
-                    throw new ConstraintDefinitionException("Parent and child 
constraint have different targets");
-                }
-            }
-        }
-    }
-
-    private Pair computeValidationTarget(final Class<?>[] validators) {
-        int param = 0;
-        int annotatedElt = 0;
-
-        for (final Class<?> validator : validators) {
-            final SupportedValidationTarget supportedAnnotationTypes =
-                validator.getAnnotation(SupportedValidationTarget.class);
-            if (supportedAnnotationTypes != null) {
-                final List<ValidationTarget> values = 
Arrays.asList(supportedAnnotationTypes.value());
-                if (values.contains(ValidationTarget.PARAMETERS)) {
-                    param++;
-                }
-                if (values.contains(ValidationTarget.ANNOTATED_ELEMENT)) {
-                    annotatedElt++;
-                }
-            } else {
-                annotatedElt++;
-            }
-        }
-
-        if (annotatedElt == 0 && param >= 1 && 
constraintValidation.getValidationAppliesTo() != null) { // pure cross param
-            throw new ConstraintDefinitionException(
-                "pure cross parameter constraints shouldn't get 
validationAppliesTo attribute");
-        }
-        if (param >= 1 && annotatedElt >= 1 && 
constraintValidation.getValidationAppliesTo() == null) { // generic and cross 
param
-            throw new ConstraintDefinitionException(
-                "cross parameter AND generic constraints should get 
validationAppliesTo attribute");
-        }
-        if (param == 0 && constraintValidation.getValidationAppliesTo() != 
null) { // pure generic
-            throw new ConstraintDefinitionException(
-                "pure generic constraints shouldn't get validationAppliesTo 
attribute");
-        }
-
-        return new Pair(annotatedElt, param);
-    }
-
-    private void buildValidationAppliesTo(final Method method)
-        throws InvocationTargetException, IllegalAccessException {
-        if (!TypeUtils.isAssignable(method.getReturnType(),
-            ConstraintAnnotationAttributes.VALIDATION_APPLIES_TO.getType())) {
-            throw new ConstraintDefinitionException("Return type for 
validationAppliesTo() must be of type "
-                + 
ConstraintAnnotationAttributes.VALIDATION_APPLIES_TO.getType());
-        }
-        final Object validationAppliesTo = 
method.invoke(constraintValidation.getAnnotation());
-        if (!ConstraintTarget.class.isInstance(validationAppliesTo)) {
-            throw new ConstraintDefinitionException("validationAppliesTo type 
is " + ConstraintTarget.class.getName());
-        }
-        
constraintValidation.setValidationAppliesTo(ConstraintTarget.class.cast(validationAppliesTo));
-    }
-
-    private void buildGroups(final Method method) throws 
IllegalAccessException, InvocationTargetException {
-        if (!TypeUtils.isAssignable(method.getReturnType(), 
ConstraintAnnotationAttributes.GROUPS.getType())) {
-            throw new ConstraintDefinitionException(
-                "Return type for groups() must be of type " + 
ConstraintAnnotationAttributes.GROUPS.getType());
-        }
-
-        final Object raw = method.invoke(constraintValidation.getAnnotation());
-        Class<?>[] garr;
-        if (raw instanceof Class<?>) {
-            garr = new Class[] { (Class<?>) raw };
-        } else if (raw instanceof Class<?>[]) {
-            garr = (Class<?>[]) raw;
-            if (Object[].class.cast(method.getDefaultValue()).length > 0) {
-                throw new ConstraintDefinitionException("Default value for 
groups() must be an empty array");
-            }
-        } else {
-            garr = null;
-        }
-
-        if (garr == null || garr.length == 0) {
-            garr = GroupsComputer.DEFAULT_GROUP;
-        }
-        constraintValidation.setGroups(garr);
-    }
-
-    @SuppressWarnings("unchecked")
-    private void buildPayload(final Method method) throws 
IllegalAccessException, InvocationTargetException {
-        if (!TypeUtils.isAssignable(method.getReturnType(), 
ConstraintAnnotationAttributes.PAYLOAD.getType())) {
-            throw new ConstraintDefinitionException(
-                "Return type for payload() must be of type " + 
ConstraintAnnotationAttributes.PAYLOAD.getType());
-        }
-        if (Object[].class.cast(method.getDefaultValue()).length > 0) {
-            throw new ConstraintDefinitionException("Default value for 
payload() must be an empty array");
-        }
-
-        final Class<? extends Payload>[] payload_raw =
-            (Class<? extends Payload>[]) 
method.invoke(constraintValidation.getAnnotation());
-
-        final Set<Class<? extends Payload>> payloadSet;
-        if (payload_raw == null) {
-            payloadSet = Collections.emptySet();
-        } else {
-            payloadSet = new HashSet<>(payload_raw.length);
-            Collections.addAll(payloadSet, payload_raw);
-        }
-        constraintValidation.setPayload(payloadSet);
-    }
-
-    /**
-     * Get the configured {@link ConstraintValidation}.
-     *
-     * @return {@link ConstraintValidation}
-     */
-    public ConstraintValidation<?> getConstraintValidation() {
-        return constraintValidation;
-    }
-
-    /**
-     * initialize a child composite 'validation' with @OverridesAttribute from
-     * 'constraintValidation' and add to composites.
-     */
-    public void addComposed(ConstraintValidation<?> composite) {
-        applyOverridesAttributes(composite);
-
-        if (constraintValidation.getValidationAppliesTo() != null) {
-            
composite.setValidationAppliesTo(constraintValidation.getValidationAppliesTo());
-        }
-
-        constraintValidation.addComposed(composite); // add AFTER apply()
-    }
-
-    private void applyOverridesAttributes(ConstraintValidation<?> composite) {
-        if (null == overrides) {
-            buildOverridesAttributes();
-        }
-        if (!overrides.isEmpty()) {
-            final int index = computeIndex(composite);
-
-            // Search for the overrides to apply
-            final ConstraintOverrides generalOverride = 
findOverride(composite.getAnnotation().annotationType(), -1);
-            if (generalOverride != null) {
-                if (index > 0) {
-                    throw new ConstraintDeclarationException(
-                        "Wrong OverridesAttribute declaration for " + 
generalOverride.constraintType
-                            + ", it needs a defined index when there is a list 
of constraints");
-                }
-                generalOverride.applyOn(composite);
-            }
-
-            final ConstraintOverrides override = 
findOverride(composite.getAnnotation().annotationType(), index);
-            if (override != null) {
-                override.applyOn(composite);
-            }
-        }
-    }
-
-    /**
-     * Calculates the index of the composite constraint. The index represents
-     * the order in which it is added in reference to other constraints of the
-     * same type.
-     *
-     * @param composite
-     *            The composite constraint (not yet added).
-     * @return An integer index always >= 0
-     */
-    private int computeIndex(ConstraintValidation<?> composite) {
-        return (int) constraintValidation.getComposingValidations().stream()
-            .filter(v -> 
v.getAnnotation().annotationType().equals(composite.getAnnotation().annotationType())).count();
-    }
-
-    /** read overridesAttributes from constraintValidation.annotation */
-    private void buildOverridesAttributes() {
-        overrides = new LinkedList<>();
-        for (Method method : 
constraintValidation.getAnnotation().annotationType().getDeclaredMethods()) {
-            final OverridesAttribute.List overridesAttributeList = 
method.getAnnotation(OverridesAttribute.List.class);
-            if (overridesAttributeList != null) {
-                for (OverridesAttribute overridesAttribute : 
overridesAttributeList.value()) {
-                    parseConstraintOverride(method.getName(), 
overridesAttribute);
-                }
-            }
-            final OverridesAttribute overridesAttribute = 
method.getAnnotation(OverridesAttribute.class);
-            if (overridesAttribute != null) {
-                parseConstraintOverride(method.getName(), overridesAttribute);
-            }
-        }
-    }
-
-    private void parseConstraintOverride(String methodName, OverridesAttribute 
oa) {
-        ConstraintOverrides target = findOverride(oa.constraint(), 
oa.constraintIndex());
-        if (target == null) {
-            target = new ConstraintOverrides(oa.constraint(), 
oa.constraintIndex());
-            overrides.add(target);
-        }
-        target.values.put(oa.name(), 
constraintValidation.getAttributes().get(methodName));
-    }
-
-    private ConstraintOverrides findOverride(Class<? extends Annotation> 
constraint, int constraintIndex) {
-        return overrides.stream()
-            .filter(ov -> ov.constraintType.equals(constraint) && 
ov.constraintIndex == constraintIndex).findFirst()
-            .orElse(null);
-    }
-
-    /**
-     * Holds the values to override in a composed constraint during creation of
-     * a composed ConstraintValidation
-     */
-    private static final class ConstraintOverrides {
-        final Class<? extends Annotation> constraintType;
-        final int constraintIndex;
-
-        /** key = attributeName, value = overridden value */
-        final Map<String, Object> values;
-
-        private ConstraintOverrides(Class<? extends Annotation> 
constraintType, int constraintIndex) {
-            this.constraintType = constraintType;
-            this.constraintIndex = constraintIndex;
-            values = new HashMap<>();
-        }
-
-        @SuppressWarnings("unchecked")
-        private void applyOn(ConstraintValidation<?> composite) {
-            // Update the attributes
-            composite.getAttributes().putAll(values);
-
-            // And the annotation
-            final Annotation originalAnnot = composite.getAnnotation();
-            final AnnotationProxyBuilder<Annotation> apb = new 
AnnotationProxyBuilder<Annotation>(originalAnnot);
-            values.forEach(apb::putValue);
-
-            ((ConstraintValidation<Annotation>) 
composite).setAnnotation(apb.createAnnotation());
-        }
-    }
-
-    private static class Pair {
-        private int a;
-        private int b;
-
-        private Pair(int a, int b) {
-            this.a = a;
-            this.b = b;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java
----------------------------------------------------------------------
diff --git 
a/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java 
b/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java
deleted file mode 100644
index 3c4b046..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/AnnotationProcessor.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.model.Features;
-import org.apache.bval.model.Meta;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.ObjectUtils;
-import org.apache.bval.util.reflection.Reflection;
-import org.apache.commons.weaver.privilizer.Privilizing;
-import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
-
-import javax.validation.Constraint;
-import javax.validation.ConstraintValidator;
-import javax.validation.Valid;
-import javax.validation.constraintvalidation.SupportedValidationTarget;
-import javax.validation.constraintvalidation.ValidationTarget;
-import javax.validation.groups.ConvertGroup;
-import javax.validation.groups.Default;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Description: implements uniform handling of JSR303 {@link Constraint}
- * annotations, including composed constraints and the resolution of
- * {@link ConstraintValidator} implementations.
- */
-@Privilizing(@CallTo(Reflection.class))
-public final class AnnotationProcessor {
-    /** {@link ApacheFactoryContext} used */
-    private final ApacheValidatorFactory factory;
-
-    /**
-     * Create a new {@link AnnotationProcessor} instance.
-     * 
-     * @param factory the validator factory.
-     */
-    public AnnotationProcessor(ApacheValidatorFactory factory) {
-        this.factory = factory;
-    }
-
-    /**
-     * Process JSR303 annotations.
-     * 
-     * @param prop
-     *            potentially null
-     * @param owner
-     *            bean type
-     * @param element
-     *            whose annotations to read
-     * @param access
-     *            strategy for <code>prop</code>
-     * @param appender
-     *            handling accumulation
-     * @return whether any processing took place
-     * @throws IllegalAccessException
-     * @throws InvocationTargetException
-     */
-    public boolean processAnnotations(Meta prop, Class<?> owner, 
AnnotatedElement element, AccessStrategy access,
-        AppendValidation appender) throws IllegalAccessException, 
InvocationTargetException {
-
-        boolean changed = false;
-        for (final Annotation annotation : element.getDeclaredAnnotations()) {
-            final Class<?> type = annotation.annotationType();
-            if (type.getName().startsWith("java.lang.annotation.")) {
-                continue;
-            }
-            changed = processAnnotation(annotation, prop, owner, access, 
appender, true) || changed;
-        }
-        return changed;
-    }
-
-    /**
-     * Process a single annotation.
-     * 
-     * @param <A>
-     *            annotation type
-     * @param annotation
-     *            to process
-     * @param prop
-     *            potentially null
-     * @param owner
-     *            bean type
-     * @param access
-     *            strategy for <code>prop</code>
-     * @param appender
-     *            handling accumulation
-     * @return whether any processing took place
-     * @throws IllegalAccessException
-     * @throws InvocationTargetException
-     */
-    public <A extends Annotation> boolean processAnnotation(A annotation, Meta 
prop, Class<?> owner,
-        AccessStrategy access, AppendValidation appender, boolean reflection)
-        throws IllegalAccessException, InvocationTargetException {
-        if (annotation instanceof Valid) {
-            return addAccessStrategy(prop, access);
-        }
-
-        if (ConvertGroup.class.isInstance(annotation) || 
ConvertGroup.List.class.isInstance(annotation)) {
-            if (!reflection) {
-                Collection<Annotation> annotations = 
prop.getFeature(JsrFeatures.Property.ANNOTATIONS_TO_PROCESS);
-                if (annotations == null) {
-                    annotations = new ArrayList<>();
-                    
prop.putFeature(JsrFeatures.Property.ANNOTATIONS_TO_PROCESS, annotations);
-                }
-                annotations.add(annotation);
-            }
-            return true;
-        }
-
-        /*
-         * An annotation is considered a constraint definition if its retention
-         * policy contains RUNTIME and if the annotation itself is annotated
-         * with javax.validation.Constraint.
-         */
-        final Constraint vcAnno = 
annotation.annotationType().getAnnotation(Constraint.class);
-        if (vcAnno != null) {
-            Class<? extends ConstraintValidator<A, ?>>[] validatorClasses =
-                findConstraintValidatorClasses(annotation, vcAnno);
-            return applyConstraint(annotation, validatorClasses, prop, owner, 
access, appender);
-        }
-
-        /*
-         * Multi-valued constraints: To support this requirement, the bean
-         * validation provider treats regular annotations (annotations not
-         * annotated by @Constraint) whose value element has a return type of 
an
-         * array of constraint annotations in a special way.
-         */
-        final Object result =
-            Reflection.getAnnotationValue(annotation, 
ConstraintAnnotationAttributes.VALUE.getAttributeName());
-        if (result instanceof Annotation[]) {
-            boolean changed = false;
-            for (final Annotation each : (Annotation[]) result) {
-                if 
(each.annotationType().getName().startsWith("java.lang.annotation")) {
-                    continue;
-                }
-
-                changed |= processAnnotation(each, prop, owner, access, 
appender, reflection);
-            }
-            return changed;
-        }
-        return false;
-    }
-
-    /**
-     * Add the specified {@link AccessStrategy} to <code>prop</code>; noop if
-     * <code>prop == null</code>.
-     * 
-     * @param prop
-     * @param access
-     * @return whether anything took place.
-     */
-    public boolean addAccessStrategy(Meta prop, AccessStrategy access) {
-        if (prop == null) {
-            return false;
-        }
-        AccessStrategy[] strategies = 
prop.getFeature(Features.Property.REF_CASCADE);
-        if (ObjectUtils.arrayContains(strategies, access)) {
-            return false;
-        }
-        if (strategies == null) {
-            strategies = new AccessStrategy[] { access };
-        } else {
-            strategies = ObjectUtils.arrayAdd(strategies, access);
-        }
-        prop.putFeature(Features.Property.REF_CASCADE, strategies);
-        return true;
-    }
-
-    /**
-     * Find available {@link ConstraintValidation} classes for a given
-     * constraint annotation.
-     * 
-     * @param annotation
-     * @param vcAnno
-     * @return {@link ConstraintValidation} implementation class array
-     */
-    @SuppressWarnings("unchecked")
-    private <A extends Annotation> Class<? extends ConstraintValidator<A, 
?>>[] findConstraintValidatorClasses(
-        A annotation, Constraint vcAnno) {
-        if (vcAnno == null) {
-            vcAnno = 
annotation.annotationType().getAnnotation(Constraint.class);
-        }
-        final Class<A> annotationType = (Class<A>) annotation.annotationType();
-        List<Class<? extends ConstraintValidator<A, ?>>> validatorClasses =
-            
factory.getConstraintsCache().getConstraintValidatorClasses(annotationType);
-        if (validatorClasses == null) {
-            validatorClasses = Arrays.asList((Class<? extends 
ConstraintValidator<A, ?>>[]) vcAnno.validatedBy());
-            if (validatorClasses.isEmpty()) {
-            }
-        }
-        return validatorClasses.toArray(new Class[validatorClasses.size()]);
-    }
-
-    /**
-     * Apply a constraint to the specified <code>appender</code>.
-     * 
-     * @param annotation
-     *            constraint annotation
-     * @param rawConstraintClasses
-     *            known {@link ConstraintValidator} implementation classes for
-     *            <code>annotation</code>
-     * @param prop
-     *            meta-property
-     * @param owner
-     *            type
-     * @param access
-     *            strategy
-     * @param appender
-     * @return success flag
-     * @throws IllegalAccessException
-     * @throws InvocationTargetException
-     */
-    private <A extends Annotation> boolean applyConstraint(A annotation,
-        Class<? extends ConstraintValidator<A, ?>>[] rawConstraintClasses, 
Meta prop, Class<?> owner,
-        AccessStrategy access, AppendValidation appender) throws 
IllegalAccessException, InvocationTargetException {
-
-        final Class<? extends ConstraintValidator<A, ?>>[] constraintClasses = 
select(rawConstraintClasses, access);
-        if (constraintClasses != null && constraintClasses.length == 0 && 
rawConstraintClasses.length > 0) {
-            return false;
-        }
-
-        final AnnotationConstraintBuilder<A> builder =
-            new AnnotationConstraintBuilder<A>(constraintClasses, annotation, 
owner, access, null);
-
-        // JSR-303 3.4.4: Add implicit groups
-        if (prop != null && prop.getParentMetaBean() != null) {
-            final MetaBean parentMetaBean = prop.getParentMetaBean();
-            // If:
-            // - the owner is an interface
-            // - the class of the metabean being build is different than the
-            // owner
-            // - and only the Default group is defined
-            // Then: add the owner interface as implicit groups
-            if (builder.getConstraintValidation().getOwner().isInterface()
-                && parentMetaBean.getBeanClass() != 
builder.getConstraintValidation().getOwner()
-                && builder.getConstraintValidation().getGroups().size() == 1
-                && 
builder.getConstraintValidation().getGroups().contains(Default.class)) {
-                Set<Class<?>> groups = 
builder.getConstraintValidation().getGroups();
-                groups.add(builder.getConstraintValidation().getOwner());
-                builder.getConstraintValidation().setGroups(groups);
-            }
-        }
-
-        // If already building a constraint composition tree, ensure that:
-        // - the parent groups are inherited
-        // - the parent payload is inherited
-        if (appender instanceof AppendValidationToBuilder) {
-            AppendValidationToBuilder avb = (AppendValidationToBuilder) 
appender;
-            
builder.getConstraintValidation().setGroups(avb.getInheritedGroups());
-            
builder.getConstraintValidation().setPayload(avb.getInheritedPayload());
-        }
-
-        // process composed constraints:
-        // here are not other superclasses possible, because annotations do not
-        // inherit!
-        processAnnotations(prop, owner, annotation.annotationType(), access, 
new AppendValidationToBuilder(builder));
-
-        // Even if the validator is null, it must be added to mimic the RI impl
-        appender.append(builder.getConstraintValidation());
-        return true;
-    }
-
-    private static <A extends Annotation> Class<? extends 
ConstraintValidator<A, ?>>[] select(
-        final Class<? extends ConstraintValidator<A, ?>>[] 
rawConstraintClasses, final AccessStrategy access) {
-        final boolean isReturn = ReturnAccess.class.isInstance(access);
-        final boolean isParam = ParametersAccess.class.isInstance(access);
-        if (rawConstraintClasses != null && (isReturn || isParam)) {
-            final Collection<Class<? extends ConstraintValidator<A, ?>>> 
selected =
-                new ArrayList<Class<? extends ConstraintValidator<A, ?>>>();
-            for (final Class<? extends ConstraintValidator<A, ?>> constraint : 
rawConstraintClasses) {
-                final SupportedValidationTarget target = 
constraint.getAnnotation(SupportedValidationTarget.class);
-                if (target == null && isReturn) {
-                    selected.add(constraint);
-                } else if (target != null) {
-                    for (final ValidationTarget validationTarget : 
target.value()) {
-                        if (isReturn && ValidationTarget.ANNOTATED_ELEMENT == 
validationTarget) {
-                            selected.add(constraint);
-                        } else if (isParam && ValidationTarget.PARAMETERS == 
validationTarget) {
-                            selected.add(constraint);
-                        }
-                    }
-                }
-            }
-            @SuppressWarnings("unchecked")
-            final Class<? extends ConstraintValidator<A, ?>>[] result = 
selected.toArray(new Class[selected.size()]);
-            return result;
-        }
-        return rawConstraintClasses;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java
----------------------------------------------------------------------
diff --git 
a/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java 
b/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java
index 1e4b263..2feab79 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheFactoryContext.java
@@ -27,7 +27,6 @@ import javax.validation.Validator;
 import javax.validation.ValidatorContext;
 import javax.validation.valueextraction.ValueExtractor;
 
-import org.apache.bval.MetaBeanFinder;
 import org.apache.bval.jsr.descriptor.DescriptorManager;
 import org.apache.bval.jsr.groups.GroupsComputer;
 import org.apache.bval.jsr.valueextraction.ValueExtractors;
@@ -44,7 +43,6 @@ public class ApacheFactoryContext implements ValidatorContext 
{
     private final Lazy<GroupsComputer> groupsComputer = new 
Lazy<>(GroupsComputer::new);
     private final ApacheValidatorFactory factory;
     private final ValueExtractors valueExtractors;
-    private volatile MetaBeanFinder metaBeanFinder;
 
     private MessageInterpolator messageInterpolator;
     private TraversableResolver traversableResolver;
@@ -60,9 +58,8 @@ public class ApacheFactoryContext implements ValidatorContext 
{
      * @param metaBeanFinder
      *            meta finder
      */
-    public ApacheFactoryContext(ApacheValidatorFactory factory, MetaBeanFinder 
metaBeanFinder) {
+    public ApacheFactoryContext(ApacheValidatorFactory factory) {
         this.factory = factory;
-        this.metaBeanFinder = metaBeanFinder;
         valueExtractors = factory.getValueExtractors().createChild();
     }
 
@@ -76,15 +73,6 @@ public class ApacheFactoryContext implements 
ValidatorContext {
     }
 
     /**
-     * Get the metaBeanFinder.
-     * 
-     * @return {@link MetaBeanFinder}
-     */
-    public final MetaBeanFinder getMetaBeanFinder() {
-        return metaBeanFinder;
-    }
-
-    /**
      * Discard cached metadata. Calling this method unnecessarily has the 
effect of severly limiting performance,
      * therefore only do so when changes have been made that affect validation 
metadata, i.e. particularly NOT in
      * response to:
@@ -95,7 +83,7 @@ public class ApacheFactoryContext implements ValidatorContext 
{
      * </ul>
      */
     private synchronized void resetMeta() {
-        metaBeanFinder = factory.buildMetaBeanFinder();
+        getDescriptorManager().clear();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java
----------------------------------------------------------------------
diff --git 
a/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java 
b/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java
index 3bff1c5..91b2e86 100644
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java
+++ b/bval-jsr/src/main/java/org/apache/bval/jsr/ApacheValidatorFactory.java
@@ -19,17 +19,11 @@
 package org.apache.bval.jsr;
 
 import java.io.Closeable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
 
 import javax.validation.ClockProvider;
 import javax.validation.ConstraintValidatorFactory;
@@ -42,26 +36,12 @@ import javax.validation.Validator;
 import javax.validation.ValidatorFactory;
 import javax.validation.spi.ConfigurationState;
 
-import org.apache.bval.IntrospectorMetaBeanFactory;
-import org.apache.bval.MetaBeanBuilder;
-import org.apache.bval.MetaBeanFactory;
-import org.apache.bval.MetaBeanFinder;
-import org.apache.bval.MetaBeanManager;
 import org.apache.bval.jsr.descriptor.DescriptorManager;
 import org.apache.bval.jsr.metadata.MetadataBuilders;
 import org.apache.bval.jsr.util.AnnotationsManager;
 import org.apache.bval.jsr.valueextraction.ValueExtractors;
-import org.apache.bval.jsr.xml.AnnotationIgnores;
-import org.apache.bval.jsr.xml.MetaConstraint;
 import org.apache.bval.jsr.xml.ValidationMappingParser;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.ObjectUtils;
-import org.apache.bval.util.StringUtils;
 import org.apache.bval.util.reflection.Reflection;
-import org.apache.bval.xml.XMLMetaBeanBuilder;
-import org.apache.bval.xml.XMLMetaBeanFactory;
-import org.apache.bval.xml.XMLMetaBeanManager;
-import org.apache.commons.weaver.privilizer.Privileged;
 import org.apache.commons.weaver.privilizer.Privilizing;
 import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
 
@@ -85,72 +65,8 @@ public class ApacheValidatorFactory implements 
ValidatorFactory, Cloneable {
     private final DescriptorManager descriptorManager = new 
DescriptorManager(this);
     private final MetadataBuilders metadataBuilders = new MetadataBuilders();
     private final ValueExtractors valueExtractors = new ValueExtractors();
-
-    /**
-     * information from xml parsing
-     */
-    private final AnnotationIgnores annotationIgnores = new 
AnnotationIgnores();
     private final ConstraintCached constraintsCache = new ConstraintCached();
-    private final Map<Class<?>, Class<?>[]> defaultSequences;
-
-    /**
-     * access strategies for properties with cascade validation @Valid support
-     */
-    private final ConcurrentMap<Class<?>, List<AccessStrategy>> validAccesses;
-    private final ConcurrentMap<Class<?>, List<MetaConstraint<?, ? extends 
Annotation>>> constraintMap;
-
     private final Collection<Closeable> toClose = new ArrayList<>();
-    private final MetaBeanFinder defaultMetaBeanFinder;
-
-    /**
-     * Create MetaBeanManager that uses factories:
-     * <ol>
-     * <li>if enabled by
-     * {@link ApacheValidatorConfiguration.Properties#ENABLE_INTROSPECTOR}, an
-     * {@link IntrospectorMetaBeanFactory}</li>
-     * <li>{@link MetaBeanFactory} types (if any) specified by
-     * {@link 
ApacheValidatorConfiguration.Properties#METABEAN_FACTORY_CLASSNAMES}
-     * </li>
-     * <li>if no {@link JsrMetaBeanFactory} has yet been specified (this
-     * allows factory order customization), a {@link JsrMetaBeanFactory}
-     * which handles both JSR303-XML and JSR303-Annotations</li>
-     * <li>if enabled by
-     * {@link ApacheValidatorConfiguration.Properties#ENABLE_METABEANS_XML}, an
-     * {@link XMLMetaBeanFactory}</li>
-     * </ol>
-     *
-     * @return a new instance of MetaBeanManager with adequate 
MetaBeanFactories
-     */
-    protected MetaBeanFinder buildMetaBeanFinder() {
-        final List<MetaBeanFactory> builders = new ArrayList<>();
-        if 
(Boolean.parseBoolean(getProperties().get(ApacheValidatorConfiguration.Properties.ENABLE_INTROSPECTOR)))
 {
-            builders.add(new IntrospectorMetaBeanFactory());
-        }
-        final String[] factoryClassNames =
-            
StringUtils.split(getProperties().get(ApacheValidatorConfiguration.Properties.METABEAN_FACTORY_CLASSNAMES));
-        if (factoryClassNames != null) {
-            for (String clsName : factoryClassNames) {
-                // cast, relying on #createMetaBeanFactory to throw the 
exception if incompatible:
-                final Class<? extends MetaBeanFactory> factoryClass =
-                    loadClass(clsName).asSubclass(MetaBeanFactory.class);
-                builders.add(createMetaBeanFactory(factoryClass));
-            }
-        }
-        boolean jsrFound = false;
-        for (MetaBeanFactory builder : builders) {
-            jsrFound |= builder instanceof JsrMetaBeanFactory;
-        }
-        if (!jsrFound) {
-            builders.add(new JsrMetaBeanFactory(this));
-        }
-        @SuppressWarnings("deprecation")
-        final boolean enableMetaBeansXml =
-            
Boolean.parseBoolean(getProperties().get(ApacheValidatorConfiguration.Properties.ENABLE_METABEANS_XML));
-        if (enableMetaBeansXml) {
-            XMLMetaBeanManagerCreator.addFactory(builders);
-        }
-        return createMetaBeanManager(builders);
-    }
 
     /**
      * Convenience method to retrieve a default global ApacheValidatorFactory
@@ -183,10 +99,6 @@ public class ApacheValidatorFactory implements 
ValidatorFactory, Cloneable {
      */
     public ApacheValidatorFactory(ConfigurationState configuration) {
         properties = new HashMap<>(configuration.getProperties());
-        defaultSequences = new HashMap<>();
-        validAccesses = new ConcurrentHashMap<>();
-        constraintMap = new ConcurrentHashMap<>();
-
         parameterNameProvider = configuration.getParameterNameProvider();
         messageResolver = configuration.getMessageInterpolator();
         traversableResolver = configuration.getTraversableResolver();
@@ -197,10 +109,9 @@ public class ApacheValidatorFactory implements 
ValidatorFactory, Cloneable {
             
toClose.add(ConfigurationImpl.class.cast(configuration).getClosable());
         }
 
+        //TODO introduce service interface
         new 
ValidationMappingParser(this).processMappingConfig(configuration.getMappingStreams());
 
-        defaultMetaBeanFinder = buildMetaBeanFinder();
-
         configuration.getValueExtractors().forEach(valueExtractors::add);
         annotationsManager = new AnnotationsManager(this);
     }
@@ -231,7 +142,7 @@ public class ApacheValidatorFactory implements 
ValidatorFactory, Cloneable {
      */
     @Override
     public ApacheFactoryContext usingContext() {
-        return new ApacheFactoryContext(this, defaultMetaBeanFinder);
+        return new ApacheFactoryContext(this);
     }
 
     /**
@@ -388,15 +299,6 @@ public class ApacheValidatorFactory implements 
ValidatorFactory, Cloneable {
     }
 
     /**
-     * Get the detected {@link AnnotationIgnores}.
-     *
-     * @return AnnotationIgnores
-     */
-    public AnnotationIgnores getAnnotationIgnores() {
-        return annotationIgnores;
-    }
-
-    /**
      * Get the constraint cache used.
      *
      * @return {@link ConstraintCached}
@@ -432,165 +334,7 @@ public class ApacheValidatorFactory implements 
ValidatorFactory, Cloneable {
         return valueExtractors;
     }
 
-    /**
-     * Add a meta-constraint to this {@link ApacheValidatorFactory}'s runtime 
customizations.
-     *
-     * @param beanClass
-     * @param metaConstraint
-     */
-    public void addMetaConstraint(final Class<?> beanClass, final 
MetaConstraint<?, ?> metaConstraint) {
-        List<MetaConstraint<?, ? extends Annotation>> slot = 
constraintMap.get(beanClass);
-        if (slot == null) {
-            slot = new ArrayList<>();
-            final List<MetaConstraint<?, ? extends Annotation>> old = 
constraintMap.putIfAbsent(beanClass, slot);
-            if (old != null) {
-                slot = old;
-            }
-        }
-        slot.add(metaConstraint);
-    }
-
-    /**
-     * Mark a property of <code>beanClass</code> for nested validation.
-     *
-     * @param beanClass
-     * @param accessStrategy
-     *            defining the property to validate
-     */
-    public void addValid(Class<?> beanClass, AccessStrategy accessStrategy) {
-        List<AccessStrategy> slot = validAccesses.get(beanClass);
-        if (slot == null) {
-            slot = new ArrayList<>();
-            final List<AccessStrategy> old = 
validAccesses.putIfAbsent(beanClass, slot);
-            if (old != null) {
-                slot = old;
-            }
-        }
-        slot.add(accessStrategy);
-    }
-
-    /**
-     * Set the default group sequence for a particular bean class.
-     *
-     * @param beanClass
-     * @param groupSequence
-     */
-    public void addDefaultSequence(Class<?> beanClass, Class<?>... 
groupSequence) {
-        defaultSequences.put(beanClass, safeArray(groupSequence));
-    }
-
-    /**
-     * Retrieve the runtime constraint configuration for a given class.
-     *
-     * @param <T>
-     * @param beanClass
-     * @return List of {@link MetaConstraint}s applicable to 
<code>beanClass</code>
-     */
-    public <T> List<MetaConstraint<T, ? extends Annotation>> 
getMetaConstraints(Class<T> beanClass) {
-        final List<MetaConstraint<?, ? extends Annotation>> slot = 
constraintMap.get(beanClass);
-        if (slot == null) {
-            return Collections.emptyList();
-        }
-        // noinspection RedundantCast
-        @SuppressWarnings({ "unchecked", "rawtypes" })
-        final List<MetaConstraint<T, ? extends Annotation>> result = (List) 
slot;
-        return Collections.unmodifiableList(result);
-    }
-
-    /**
-     * Get the {@link AccessStrategy} {@link List} indicating nested bean 
validations that must be triggered in the
-     * course of validating a <code>beanClass</code> graph.
-     *
-     * @param beanClass
-     * @return {@link List} of {@link AccessStrategy}
-     */
-    public List<AccessStrategy> getValidAccesses(Class<?> beanClass) {
-        final List<AccessStrategy> slot = validAccesses.get(beanClass);
-        return slot == null ? Collections.emptyList() : 
Collections.unmodifiableList(slot);
-    }
-
-    /**
-     * Get the default group sequence configured for <code>beanClass</code>.
-     *
-     * @param beanClass
-     * @return group Class array
-     */
-    public Class<?>[] getDefaultSequence(Class<?> beanClass) {
-        return safeArray(defaultSequences.get(beanClass));
-    }
-
     public MetadataBuilders getMetadataBuilders() {
         return metadataBuilders;
     }
-
-    private static Class<?>[] safeArray(Class<?>... array) {
-        return array == null || array.length == 0 ? 
ObjectUtils.EMPTY_CLASS_ARRAY : array.clone();
-    }
-
-    /**
-     * Create a {@link MetaBeanManager} using the specified builders.
-     *
-     * @param builders
-     *            {@link MetaBeanFactory} {@link List}
-     * @return {@link MetaBeanManager}
-     */
-    @SuppressWarnings("deprecation")
-    protected MetaBeanFinder createMetaBeanManager(List<MetaBeanFactory> 
builders) {
-        // as long as we support both: jsr (in the builders list) and 
xstream-xml metabeans:
-        if 
(Boolean.parseBoolean(getProperties().get(ApacheValidatorConfiguration.Properties.ENABLE_METABEANS_XML)))
 {
-            return 
XMLMetaBeanManagerCreator.createXMLMetaBeanManager(builders);
-        }
-        return new MetaBeanManager(new MetaBeanBuilder(builders.toArray(new 
MetaBeanFactory[builders.size()])));
-    }
-
-    @Privileged
-    private <F extends MetaBeanFactory> F createMetaBeanFactory(final Class<F> 
cls) {
-        try {
-            Constructor<F> c = Reflection.getDeclaredConstructor(cls, 
ApacheValidatorFactory.this.getClass());
-            if (c != null) {
-                return c.newInstance(this);
-            }
-            c = Reflection.getDeclaredConstructor(cls, getClass());
-            if (c != null) {
-                return c.newInstance(this);
-            }
-            return cls.getConstructor().newInstance();
-        } catch (Exception e) {
-            throw new ValidationException(e);
-        }
-    }
-
-    /**
-     * separate class to prevent the classloader to immediately load optional 
classes: XMLMetaBeanManager,
-     * XMLMetaBeanFactory, XMLMetaBeanBuilder that might not be available in 
the classpath
-     */
-    private static class XMLMetaBeanManagerCreator {
-
-        static void addFactory(List<MetaBeanFactory> builders) {
-            builders.add(new XMLMetaBeanFactory());
-        }
-
-        /**
-         * Create the {@link MetaBeanManager} to process JSR303 XML. Requires 
bval-xstream at RT.
-         *
-         * @param builders
-         *            meta bean builders
-         * @return {@link MetaBeanManager}
-         */
-        // NOTE - We return MetaBeanManager instead of XMLMetaBeanManager to
-        // keep
-        // bval-xstream an optional module.
-        protected static MetaBeanManager 
createXMLMetaBeanManager(List<MetaBeanFactory> builders) {
-            return new XMLMetaBeanManager(
-                new XMLMetaBeanBuilder(builders.toArray(new 
MetaBeanFactory[builders.size()])));
-        }
-    }
-
-    private Class<?> loadClass(final String className) {
-        try {
-            return Class.forName(className, true, 
Reflection.getClassLoader(ApacheValidatorFactory.class));
-        } catch (ClassNotFoundException ex) {
-            throw new ValidationException("Unable to load class: " + 
className, ex);
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidation.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidation.java 
b/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidation.java
deleted file mode 100644
index 70d3df5..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import java.lang.annotation.Annotation;
-
-/**
- * Description: unified interface to accumulate {@link ConstraintValidation}s
- * to varied targets.<br/>
- */
-public interface AppendValidation {
-    /**
-     * Append a {@link ConstraintValidation}.
-     * @param <T>
-     * @param validation
-     */
-    <T extends Annotation> void append(ConstraintValidation<T> validation);
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java
----------------------------------------------------------------------
diff --git 
a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java 
b/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java
deleted file mode 100644
index 6d3f060..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToBuilder.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.jsr.xml.AnnotationProxyBuilder;
-
-import javax.validation.Payload;
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-/**
- * Description: Adapt {@link AnnotationConstraintBuilder} to the {@link 
AppendValidation} interface.<br/>
- */
-public class AppendValidationToBuilder extends BaseAppendValidation {
-    private final AnnotationConstraintBuilder<?> builder;
-
-    /**
-     * Create a new AppendValidationToBuilder instance.
-     * @param builder
-     */
-    public AppendValidationToBuilder(AnnotationConstraintBuilder<?> builder) {
-        this.builder = builder;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <T extends Annotation> void 
preProcessValidation(ConstraintValidation<T> validation) {
-        // JSR-303 2.3:
-        // Groups from the main constraint annotation are inherited by the 
composing annotations.
-        // Any groups definition on a composing annotation is ignored.
-        final Set<Class<?>> inheritedGroups = 
builder.getConstraintValidation().getGroups();
-        validation.setGroups(inheritedGroups);
-
-        // JSR-303 2.3 p:
-        // Payloads are also inherited
-        final Set<Class<? extends Payload>> inheritedPayload = 
builder.getConstraintValidation().getPayload();
-        validation.setPayload(inheritedPayload);
-
-        // Inherited groups and payload values must also be replicated in the 
-        // annotation, so it has to be substituted with a new proxy.
-        final T originalAnnot = validation.getAnnotation();
-        final AnnotationProxyBuilder<T> apb = new 
AnnotationProxyBuilder<T>(originalAnnot);
-        apb.putValue(ConstraintAnnotationAttributes.GROUPS.getAttributeName(),
-            inheritedGroups.toArray(new Class[inheritedGroups.size()]));
-        apb.putValue(ConstraintAnnotationAttributes.PAYLOAD.getAttributeName(),
-            inheritedPayload.toArray(new Class[inheritedPayload.size()]));
-        final T newAnnot = apb.createAnnotation();
-        validation.setAnnotation(newAnnot);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <T extends Annotation> void performAppend(ConstraintValidation<T> 
validation) {
-        builder.addComposed(validation);
-    }
-
-    /**
-     * Get inherited groups.
-     * @return The set of groups from the parent constraint.
-     */
-    public Set<Class<?>> getInheritedGroups() {
-        return builder.getConstraintValidation().getGroups();
-    }
-
-    /**
-     * Get inherited payload.
-     * @return The set of payloads from the parent constraint.
-     */
-    public Set<Class<? extends Payload>> getInheritedPayload() {
-        return builder.getConstraintValidation().getPayload();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java
----------------------------------------------------------------------
diff --git 
a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java 
b/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java
deleted file mode 100644
index 00a05b2..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToList.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Description: {@link org.apache.bval.jsr.AppendValidation} implementation 
that acts as an intermediate
- * cache of validations for further processing.<br/>
- */
-public class AppendValidationToList extends BaseAppendValidation {
-    private final List<ConstraintValidation<?>> validations = new 
ArrayList<ConstraintValidation<?>>();
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <T extends Annotation> void performAppend(ConstraintValidation<T> 
validation) {
-        validations.add(validation);
-    }
-
-    /**
-     * Get the list of cached validations.
-     * @return {@link java.util.List} of {@link 
org.apache.bval.jsr.ConstraintValidation}
-     */
-    public List<ConstraintValidation<?>> getValidations() {
-        return validations;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToMeta.java
----------------------------------------------------------------------
diff --git 
a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToMeta.java 
b/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToMeta.java
deleted file mode 100644
index f9716e2..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/AppendValidationToMeta.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.bval.jsr;
-
-import org.apache.bval.model.FeaturesCapable;
-
-import java.lang.annotation.Annotation;
-
-/**
- * Description: adapt any {@link FeaturesCapable} from the core meta-model to 
the {@link AppendValidation} interface.<br/>
- */
-public class AppendValidationToMeta extends BaseAppendValidation {
-    private final FeaturesCapable feature;
-
-    /**
-     * Create a new AppendValidationToMeta instance.
-     * @param meta
-     */
-    public AppendValidationToMeta(FeaturesCapable meta) {
-        this.feature = meta;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <T extends Annotation> void performAppend(ConstraintValidation<T> 
validation) {
-        feature.addValidation(validation);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/92c64b3c/bval-jsr/src/main/java/org/apache/bval/jsr/BaseAppendValidation.java
----------------------------------------------------------------------
diff --git 
a/bval-jsr/src/main/java/org/apache/bval/jsr/BaseAppendValidation.java 
b/bval-jsr/src/main/java/org/apache/bval/jsr/BaseAppendValidation.java
deleted file mode 100644
index d7182ac..0000000
--- a/bval-jsr/src/main/java/org/apache/bval/jsr/BaseAppendValidation.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-package org.apache.bval.jsr;
-
-import java.lang.annotation.Annotation;
-
-/**
- * Abstract base validation appender that initializes the
- * {@link ConstraintValidation#getValidator()} on post-processing.
- * 
- * @author Carlos Vara
- */
-public abstract class BaseAppendValidation implements AppendValidation {
-
-    /**
-     * {@inheritDoc}
-     *
-     * Append operation divided in 3 stages: pre & post processing and the
-     * "real" append process.
-     */
-    @Override
-    public final <T extends Annotation> void append(final 
ConstraintValidation<T> validation) {
-        preProcessValidation(validation);
-        performAppend(validation);
-        postProcessValidation(validation);
-    }
-
-    /**
-     * Performs the actual "appending" operation to the underlying data
-     * structure that holds the validations. Implementations shouldn't try to 
do
-     * more than that in this step.
-     * 
-     * @param <T>
-     *            The type of the validation.
-     * @param validation
-     *            The validation to be appended.
-     */
-    public abstract <T extends Annotation> void performAppend(final 
ConstraintValidation<T> validation);
-
-    /**
-     * Pre-process the validation before appending it.
-     * 
-     * @param <T>
-     *            The type of the validation.
-     * @param validation
-     *            The validation to be appended.
-     */
-    public <T extends Annotation> void preProcessValidation(final 
ConstraintValidation<T> validation) {
-        // No generic pre-processing
-    }
-
-    /**
-     * Post-process the validation once it postProcessValidationhas been 
appended.
-     * 
-     * @param <T>
-     *            The type of the validation.
-     * @param validation
-     *            The validation to be appended.
-     */
-    public <T extends Annotation> void postProcessValidation(final 
ConstraintValidation<T> validation) {
-    }
-
-}

Reply via email to