You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by mb...@apache.org on 2018/02/25 20:10:36 UTC

[1/8] bval git commit: remove obsolete modules, moving required core code to jsr

Repository: bval
Updated Branches:
  refs/heads/bv2 92c64b3ce -> ed299e4f1


http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java b/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java
deleted file mode 100644
index d6e96f8..0000000
--- a/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java
+++ /dev/null
@@ -1,143 +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.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.bval.example.BusinessObject;
-import org.apache.bval.example.BusinessObjectAddress;
-import org.junit.Test;
-
-/**
- * XMLMetaBean Tester.
- */
-public class XMLMetaBeanInfosTest {
-
-    @Test
-    public void testBeanInfosToXML() {
-        XMLMetaBeanInfos infos = new XMLMetaBeanInfos();
-        infos.setBeans(new ArrayList<XMLMetaBean>());
-        infos.setValidators(new ArrayList<XMLMetaValidator>());
-
-        XMLMetaValidator validator = new XMLMetaValidator();
-        validator.setId("mandatory");
-        validator.setJava("org.apache.bval.MandatoryValidator");
-
-        infos.getValidators().add(validator);
-
-        validator = new XMLMetaValidator();
-        validator.setId("email");
-        validator.setJava("org.apache.bval.EMailValidation");
-
-        infos.getValidators().add(validator);
-
-        XMLMetaBean bean = new XMLMetaBean();
-        bean.putFeature("DOMAIN", "TestProfile");
-        bean.putFeature("label-key", "business-object-label");
-        bean.setId("User");
-        bean.setImpl(BusinessObject.class.getName());
-        bean.setProperties(new ArrayList<XMLMetaProperty>());
-        XMLMetaProperty property = new XMLMetaProperty();
-        property.setName("userId");
-        property.setMandatory(XMLMetaValue.MANDATORY);
-        bean.getProperties().add(property);
-
-        property = new XMLMetaProperty();
-        property.setName("firstName");
-        property.setMandatory(XMLMetaValue.MANDATORY);
-        property.setMaxLength(100);
-        bean.getProperties().add(property);
-
-        property = new XMLMetaProperty();
-        property.setName("lastName");
-        property.setMandatory(XMLMetaValue.MANDATORY);
-        property.setMaxLength(100);
-        bean.getProperties().add(property);
-
-        property = new XMLMetaProperty();
-        property.setName("title");
-        property.setMandatory(XMLMetaValue.OPTIONAL);
-        property.setMaxLength(10);
-        bean.getProperties().add(property);
-
-        property = new XMLMetaProperty();
-        property.setName("dateBirth");
-        property.setMandatory(XMLMetaValue.OPTIONAL);
-        property.setTimeLag(XMLMetaValue.TIMELAG_Past);
-        bean.getProperties().add(property);
-
-        property = new XMLMetaProperty();
-        property.setName("validTo");
-        property.setMandatory(XMLMetaValue.OPTIONAL);
-        property.setTimeLag(XMLMetaValue.TIMELAG_Future);
-        bean.getProperties().add(property);
-
-        property = new XMLMetaProperty();
-        property.setName("email");
-        property.putFeature(XMLMetaValue.ANNOKEY_Widget, "entry");
-        property.putFeature(XMLMetaValue.ANNOKEY_TableColumn, true);
-        Map<String, String> formatterMap = new HashMap<String, String>();
-        formatterMap.put("locale", "DE");
-        formatterMap.put("style", "info");
-        property.putFeature("ajax-formatter", formatterMap);
-        property.addValidator("email");
-        bean.getProperties().add(property);
-
-        infos.getBeans().add(bean);
-
-        XMLMetaBean bean2 = new XMLMetaBean();
-        bean2.setId("Address");
-        bean2.setImpl(BusinessObjectAddress.class.getName());
-        property = new XMLMetaProperty();
-        property.setName("city");
-        bean2.putProperty(property);
-        property = new XMLMetaProperty();
-        property.setName("country");
-        property.setMaxLength(10);
-        property.setMandatory(XMLMetaValue.MANDATORY);
-        bean2.putProperty(property);
-
-        XMLMetaBeanReference relation = new XMLMetaBeanReference();
-        relation.setName("address");
-        relation.setBeanId("Address");
-        relation.setMandatory(XMLMetaValue.OPTIONAL);
-        bean.putBeanRef(relation);
-
-        infos.getBeans().add(bean2);
-
-        String xml = XMLMapper.getInstance().getXStream().toXML(infos);
-        XMLMetaBeanInfos infos2 = (XMLMetaBeanInfos) XMLMapper.getInstance().getXStream().fromXML(xml);
-        assertEquals(2, infos2.getBeans().size());
-    }
-
-    @Test
-    public void testMaxValueParsing() {
-        String xml = "\n" + "<beanInfos>  <bean id=\"org.apache.bval.test.model.Profile\">\n"
-            + "    <property name=\"activationDay\" minValue=\"1\" maxValue=\"31\"/>\n"
-            + "    <property name=\"activationMonth\" minValue=\"1\" maxValue=\"12\"/>\n" + "  </bean></beanInfos>";
-        XMLMetaBeanInfos beanInfos = (XMLMetaBeanInfos) XMLMapper.getInstance().getXStream().fromXML(xml);
-        assertNotNull(beanInfos);
-        assertEquals(Integer.valueOf(31), beanInfos.getBeans().get(0).getProperty("activationDay").getMaxValue());
-        assertEquals(Integer.valueOf(1), beanInfos.getBeans().get(0).getProperty("activationDay").getMinValue());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java b/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java
deleted file mode 100644
index e200d41..0000000
--- a/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java
+++ /dev/null
@@ -1,93 +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.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Map;
-
-import org.apache.bval.MetaBeanFinder;
-import org.apache.bval.example.BusinessObject;
-import org.apache.bval.model.MetaBean;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Description: <br>
- * User: roman.stumm<br>
- * Date: 17.06.2010<br>
- * Time: 10:28:48<br>
- */
-public class XMLMetaBeanManagerTest {
-    private static XMLMetaBeanManager mbm = new XMLMetaBeanManager();
-
-    @BeforeClass
-    public static void setUp() throws Exception {
-        mbm.addLoader(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos.xml")));
-    }
-
-    @Test
-    public void testEnrichCopies() throws Exception {
-        Map<String, MetaBean> copies = mbm.enrichCopies(
-            new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos-custom.xml")).load());
-        assertNotNull(copies);
-        MetaBean mb = copies.get(BusinessObject.class.getName());
-        assertFalse(mb.getProperty("lastName").isMandatory());
-        MetaBean mb2 = mbm.findForClass(BusinessObject.class);
-        assertTrue(mb2.getProperty("lastName").isMandatory());
-    }
-
-    @Test
-    public void testCopy() {
-        MetaBean mb = mbm.findForClass(BusinessObject.class);
-        MetaBean mb2 = mb.copy();
-        assertNotSame(mb, mb2);
-        assertNotSame(mb.getProperty("dateBirth"), mb2.getProperty("dateBirth"));
-    }
-
-    @SuppressWarnings("deprecation")
-    @Test
-    public void testFindForClass() throws Exception {
-        MetaBeanFinder finder = mbm;
-        MetaBean info = finder.findForClass(BusinessObject.class);
-        assertNotNull(info);
-        assertSame(info, info.getProperty("address").getMetaBean().getProperty("owner").getMetaBean());
-        assertSame(info, info.getProperty("addresses").getMetaBean().getProperty("owner").getMetaBean());
-        assertTrue(info.getProperty("email").getJavaScriptValidations().length > 0);
-    }
-
-    @Test
-    public void testFindAll() {
-        Map<String, MetaBean> all = mbm.findAll();
-        assertNotNull(all);
-        Map<String, MetaBean> all2 = mbm.findAll();
-        assertEquals(all.size(), all2.size());
-        assertSame(all.get(BusinessObject.class.getName()), all2.get(BusinessObject.class.getName()));
-        assertNotNull(all.get(BusinessObject.class.getName()));
-        MetaBean bean = all.get(BusinessObject.class.getName());
-        assertSame(bean, bean.getProperty("address").getMetaBean().getProperty("owner").getMetaBean());
-        assertSame(bean, bean.getProperty("addresses").getMetaBean().getProperty("owner").getMetaBean());
-    }
-
-    static void assertNotSame(Object o1, Object o2) {
-        assertFalse(o1 == o2);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml
----------------------------------------------------------------------
diff --git a/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml b/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml
deleted file mode 100644
index d9f6b72..0000000
--- a/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<beanInfos>
-
-  <bean id="org.apache.bval.example.BusinessObject"
-        impl="org.apache.bval.example.BusinessObject">
-    <property name="lastName" mandatory="false"/>
-    <property name="unknownName" mandatory="true"/>
-  </bean>
-
-  <bean id="UnknownObject" impl="org.apache.bval.UnknownClass">
-    <property name="fullName" mandatory="true"/>
-  </bean>
-</beanInfos>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml
----------------------------------------------------------------------
diff --git a/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml b/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml
deleted file mode 100644
index f78aa47..0000000
--- a/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<beanInfos>
-  <validator id="standard" java="org.apache.bval.routines.NOPValidation"
-             jsFunction="noop"/>
-  <validator id="email" java="org.apache.bval.routines.EMailValidation"/>
-  <bean id="org.apache.bval.example.BusinessObject"
-        impl="org.apache.bval.example.BusinessObject">
-    <feature key="mainKey">
-      <value class="string">userId</value>
-    </feature>
-    <feature key="DOMAIN">
-      <value class="string">TestObjects</value>
-    </feature>
-    <feature key="WIDGET">
-      <value class="string">entry</value>
-    </feature>
-    <property name="userId" mandatory="true"/>
-    <property name="firstName" mandatory="true" maxLength="100"/>
-    <property name="lastName" mandatory="true" maxLength="100"/>
-    <property name="title" mandatory="false" maxLength="10"/>
-    <property timeLag="PAST" name="dateBirth" mandatory="false"/>
-    <property timeLag="FUTURE" name="validTo" mandatory="false"/>
-    <property name="email">
-      <feature key="WIDGET">
-        <value class="string">entry</value>
-      </feature>
-      <feature key="TABLE_COLUMN">
-        <value class="boolean">true</value>
-      </feature>
-      <feature key="ajax-formatter">
-        <value class="map">
-          <entry>
-            <string>locale</string>
-            <string>DE</string>
-          </entry>
-          <entry>
-            <string>style</string>
-            <string>info</string>
-          </entry>
-        </value>
-      </feature>
-      <validator refId="email"/>
-      <validator refId="standard"/>
-    </property>
-    <relationship beanId="org.apache.bval.example.Address" name="address" mandatory="false"
-                  displayName="UserAddress"/>
-    <relationship beanId="org.apache.bval.example.Address" name="addresses" maxLength="3"/>
-  </bean>
-  <bean id="org.apache.bval.example.Address"
-        impl="org.apache.bval.example.BusinessObjectAddress">
-    <feature key="DOMAIN">
-      <value class="string">TestObjects</value>
-    </feature>
-    <property name="city"/>
-    <property name="country" mandatory="true" maxLength="10"/>
-    <relationship name="owner" beanId="org.apache.bval.example.BusinessObject"
-                  mandatory="true"/>
-  </bean>
-</beanInfos>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index cc73e25..6e1df5b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,9 +52,9 @@
     <url>http://bval.apache.org/</url>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/bval/trunk/</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/bval/trunk/</developerConnection>
-        <url>http://svn.apache.org/repos/asf/bval/trunk/</url>
+        <connection>scm:git:http://git-wip-us.apache.org/repos/asf/bval</connection>
+        <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/bval</developerConnection>
+        <url>http://git-wip-us.apache.org/repos/asf/bval</url>
     </scm>
 
     <mailingLists>
@@ -577,7 +577,7 @@
                 <plugin>
                     <groupId>org.codehaus.mojo</groupId>
                     <artifactId>buildnumber-maven-plugin</artifactId>
-                    <version>1.2</version>
+                    <version>1.4</version>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
@@ -660,6 +660,7 @@
                 <configuration>
                     <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
                     <revisionOnScmFailure>offline</revisionOnScmFailure>
+                    <shortRevisionLength>10</shortRevisionLength>
                 </configuration>
                 <executions>
                     <execution>
@@ -692,10 +693,7 @@
     </build>
 
     <modules>
-        <module>bval-core</module>
-        <module>bval-xstream</module>
         <module>bval-jsr</module>
-        <module>bval-json</module>
         <module>bval-extras</module>
         <module>bval-tck</module>
         <module>bundle</module>


[6/8] bval git commit: remove obsolete modules, moving required core code to jsr

Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/ObjectUtils.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/ObjectUtils.java b/bval-core/src/main/java/org/apache/bval/util/ObjectUtils.java
deleted file mode 100644
index 1c5a728..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/ObjectUtils.java
+++ /dev/null
@@ -1,98 +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.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Array;
-import java.util.Objects;
-import java.util.function.Predicate;
-import java.util.stream.Stream;
-
-public final class ObjectUtils {
-    public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[0];
-    public static final String[] EMPTY_STRING_ARRAY = new String[0];
-    public static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
-
-    private ObjectUtils() {
-    }
-
-    /**
-     * <p>Returns a default value if the object passed is {@code null}.</p>
-     *
-     * <pre>
-     * ObjectUtils.defaultIfNull(null, null)      = null
-     * ObjectUtils.defaultIfNull(null, "")        = ""
-     * ObjectUtils.defaultIfNull(null, "zz")      = "zz"
-     * ObjectUtils.defaultIfNull("abc", *)        = "abc"
-     * ObjectUtils.defaultIfNull(Boolean.TRUE, *) = Boolean.TRUE
-     * </pre>
-     *
-     * @param <T> the type of the object
-     * @param object  the {@code Object} to test, may be {@code null}
-     * @param defaultValue  the default value to return, may be {@code null}
-     * @return {@code object} if it is not {@code null}, defaultValue otherwise
-     */
-    public static <T> T defaultIfNull(final T object, final T defaultValue) {
-        return object == null ? defaultValue : object;
-    }
-
-    public static <T> boolean isNotEmpty(final T[] array) {
-        return !isEmpty(array);
-    }
-
-    public static boolean isEmpty(final Object[] array) {
-        return array == null || array.length == 0;
-    }
-
-    /**
-     * <p>Checks if the object is in the given array.
-     *
-     * <p>The method returns {@code false} if a {@code null} array is passed in.
-     *
-     * @param array  the array to search through
-     * @param objectToFind  the object to find
-     * @return {@code true} if the array contains the object
-     */
-    public static boolean arrayContains(final Object[] array, final Object objectToFind) {
-        if (array == null) {
-            return false;
-        }
-        return Stream.of(array).anyMatch(Predicate.isEqual(objectToFind));
-    }
-
-    public static int indexOf(final Object[] array, final Object objectToFind) {
-        for (int i = 0; i < array.length; i++) {
-            if (Objects.equals(array[i], objectToFind)) {
-                return i;
-            }
-        }
-        return -1;
-    }
-
-    public static <T> T[] arrayAdd(T[] array, T objectToAdd) {
-        if (array == null && objectToAdd == null) {
-            throw new IllegalArgumentException("Arguments cannot both be null");
-        }
-        final int arrayLength = Array.getLength(array);
-        @SuppressWarnings("unchecked")
-        T[] newArray = (T[]) Array.newInstance(array.getClass().getComponentType(), arrayLength + 1);
-        System.arraycopy(array, 0, newArray, 0, arrayLength);
-        newArray[newArray.length - 1] = objectToAdd;
-
-        return newArray;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/ObjectWrapper.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/ObjectWrapper.java b/bval-core/src/main/java/org/apache/bval/util/ObjectWrapper.java
deleted file mode 100644
index 8483745..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/ObjectWrapper.java
+++ /dev/null
@@ -1,50 +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.util;
-
-import java.util.Optional;
-import java.util.function.Consumer;
-import java.util.function.Supplier;
-
-public class ObjectWrapper<T> implements Consumer<T>, Supplier<T> {
-    private T value;
-
-    public ObjectWrapper() {
-        this(null);
-    }
-
-    public ObjectWrapper(T value) {
-        super();
-        this.value = value;
-    }
-
-    @Override
-    public void accept(T value) {
-        this.value = value;
-    }
-
-    @Override
-    public T get() {
-        return value;
-    }
-
-    public Optional<T> optional() {
-        return Optional.ofNullable(value);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java b/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java
deleted file mode 100644
index 481df3c..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/PropertyAccess.java
+++ /dev/null
@@ -1,336 +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.util;
-
-import org.apache.bval.util.reflection.Reflection;
-import org.apache.commons.weaver.privilizer.Privilizing;
-import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
-
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Description: Undefined dynamic strategy (FIELD or METHOD access). Uses Apache
- * Commons BeanUtils (if present) to support its {@code DynaBean} type. Otherwise the
- * {@code java.beans} APIs are used for Java bean property methods and we fall
- * back to accessing field values directly.
- */
-@Privilizing(@CallTo(Reflection.class))
-public class PropertyAccess extends AccessStrategy {
-    private static final Logger log = Logger.getLogger(PropertyAccess.class.getName());
-    private static final String BEANUTILS = "org.apache.commons.beanutils.BeanUtils";
-    private static final String BEANUTILS_PROPERTY_ACCESS = "org.apache.bval.util.BeanUtilsPropertyAccess";
-    private static final Constructor<? extends PropertyAccess> BEANUTILS_PROPERTY_ACCESS_CTOR;
-    private static final ConcurrentMap<Class<?>, Map<String, PropertyDescriptor>> PROPERTY_DESCRIPTORS =
-        new ConcurrentHashMap<Class<?>, Map<String, PropertyDescriptor>>();
-
-    static {
-        final ClassLoader cl = Reflection.getClassLoader(PropertyAccess.class);
-        boolean useBeanUtils;
-        try {
-            Reflection.toClass(BEANUTILS, cl);
-            useBeanUtils = true;
-        } catch (Exception e) {
-            useBeanUtils = false;
-        }
-        Constructor<? extends PropertyAccess> ctor;
-        if (useBeanUtils) {
-            try {
-                final Class<?> beanUtilsPropertyAccess = Reflection.toClass(BEANUTILS_PROPERTY_ACCESS, cl);
-
-                ctor = Reflection.getDeclaredConstructor(beanUtilsPropertyAccess.asSubclass(PropertyAccess.class),
-                    Class.class, String.class);
-
-            } catch (Exception e) {
-                ctor = null;
-            }
-        } else {
-            ctor = null;
-        }
-        BEANUTILS_PROPERTY_ACCESS_CTOR = ctor;
-    }
-
-    /**
-     * Obtain a {@link PropertyAccess} instance.
-     * @param clazz
-     * @param propertyName
-     * @return PropertyAccess
-     * @since 1.1.2
-     */
-    public static PropertyAccess getInstance(Class<?> clazz, String propertyName) {
-        if (BEANUTILS_PROPERTY_ACCESS_CTOR != null) {
-            try {
-                return BEANUTILS_PROPERTY_ACCESS_CTOR.newInstance(clazz, propertyName);
-            } catch (Exception e) {
-                log.log(Level.WARNING, String.format("Exception encountered attempting to instantiate %s(%s, %s)",
-                    BEANUTILS_PROPERTY_ACCESS_CTOR, clazz, propertyName), e);
-            }
-        }
-        return new PropertyAccess(clazz, propertyName);
-    }
-
-    private final Class<?> beanClass;
-    private final String propertyName;
-    private Field rememberField;
-
-    /**
-     * Create a new PropertyAccess instance.
-     * 
-     * @param clazz
-     * @param propertyName
-     */
-    @Deprecated
-    // keep as protected
-    public PropertyAccess(Class<?> clazz, String propertyName) {
-        this.beanClass = clazz;
-        this.propertyName = propertyName;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ElementType getElementType() {
-        return rememberField != null ? ElementType.FIELD : ElementType.METHOD;
-    }
-
-    protected Object getPublicProperty(Object bean)
-        throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
-        if (bean instanceof Map<?, ?>) {
-            return ((Map<?, ?>) bean).get(propertyName);
-        }
-        final Method readMethod = getPropertyReadMethod(propertyName, bean.getClass());
-        if (readMethod == null) {
-            throw new NoSuchMethodException(toString());
-        }
-        final boolean unset = Reflection.setAccessible(readMethod, true);
-        try {
-            return readMethod.invoke(bean);
-        } finally {
-            if (unset) {
-                Reflection.setAccessible(readMethod, false);
-            }
-        }
-    }
-
-    /**
-     * Get a named property from <code>bean</code>.
-     * 
-     * @param bean
-     * @param propertyName
-     * @return Object found
-     * @throws InvocationTargetException
-     * @throws NoSuchMethodException
-     * @throws IllegalAccessException
-     */
-    public static Object getProperty(Object bean, String propertyName)
-        throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
-        return getInstance(bean.getClass(), propertyName).get(bean);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return "Property{" + beanClass.getName() + '.' + propertyName + '}';
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Type getJavaType() {
-        Type result = getTypeInner();
-        return result == null ? Object.class : result;
-    }
-
-    /**
-     * Learn whether this {@link PropertyAccess} references a known property.
-     * 
-     * @return boolean
-     */
-    public boolean isKnown() {
-        return getTypeInner() != null;
-    }
-
-    /**
-     * Find out what, if any, type can be calculated.
-     * 
-     * @return type found or <code>null</code>
-     */
-    private Type getTypeInner() {
-        if (rememberField != null) {
-            return rememberField.getGenericType();
-        }
-        Method readMethod = getPropertyReadMethod(propertyName, beanClass);
-        if (readMethod != null) {
-            return readMethod.getGenericReturnType();
-        }
-        Field fld = getField(propertyName, beanClass);
-        if (fld != null) {
-            cacheField(fld);
-            return rememberField.getGenericType();
-        }
-        return null;
-    }
-
-    private static Method getPropertyReadMethod(String propertyName, Class<?> beanClass) {
-        final Map<String, PropertyDescriptor> propertyDescriptors = getPropertyDescriptors(beanClass);
-        if (propertyDescriptors.containsKey(propertyName)) {
-            return propertyDescriptors.get(propertyName).getReadMethod();
-        }
-        return null;
-    }
-
-    private static Field getField(String propertyName, Class<?> beanClass) {
-        try { // try public field
-            return beanClass.getField(propertyName);
-        } catch (NoSuchFieldException ex2) {
-            // search for private/protected field up the hierarchy
-            Class<?> theClass = beanClass;
-            while (theClass != null) {
-                try {
-                    return theClass.getDeclaredField(propertyName);
-                } catch (NoSuchFieldException ex3) {
-                    // do nothing
-                }
-                theClass = theClass.getSuperclass();
-            }
-        }
-        return null;
-    }
-
-    private static Object readField(Field field, Object bean) throws IllegalAccessException {
-        final boolean mustUnset = Reflection.setAccessible(field, true);
-        try {
-            return field.get(bean);
-        } finally {
-            if (mustUnset) {
-                Reflection.setAccessible(field, false);
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getPropertyName() {
-        return propertyName;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Object get(Object bean) {
-        try {
-            if (rememberField != null) { // cache field of previous access
-                return readField(rememberField, bean);
-            }
-            try { // try public method
-                return getPublicProperty(bean);
-            } catch (NoSuchMethodException ex) {
-                return getFieldValue(bean);
-            }
-        } catch (IllegalArgumentException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new IllegalArgumentException("cannot access " + propertyName, e);
-        }
-    }
-
-    private Object getFieldValue(Object bean) throws IllegalAccessException {
-        Field field = getField(propertyName, beanClass);
-        if (field != null) {
-            cacheField(field);
-            return readField(rememberField, bean);
-        }
-        throw new IllegalArgumentException("cannot access field " + propertyName);
-    }
-
-    private void cacheField(Field field) {
-        this.rememberField = field;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-
-        PropertyAccess that = (PropertyAccess) o;
-
-        return beanClass.equals(that.beanClass) && propertyName.equals(that.propertyName);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int hashCode() {
-        int result;
-        result = beanClass.hashCode();
-        result = 31 * result + propertyName.hashCode();
-        return result;
-    }
-
-    private static Map<String, PropertyDescriptor> getPropertyDescriptors(Class<?> type) {
-        if (PROPERTY_DESCRIPTORS.containsKey(type)) {
-            return PROPERTY_DESCRIPTORS.get(type);
-        }
-        Map<String, PropertyDescriptor> m;
-        try {
-            final PropertyDescriptor[] propertyDescriptors = Introspector.getBeanInfo(type).getPropertyDescriptors();
-            if (propertyDescriptors == null) {
-                m = Collections.emptyMap();
-            } else {
-                m = new HashMap<String, PropertyDescriptor>();
-                for (PropertyDescriptor pd : propertyDescriptors) {
-                    m.put(pd.getName(), pd);
-                }
-            }
-        } catch (IntrospectionException e) {
-            log.log(Level.SEVERE, String.format("Cannot locate %s for ", BeanInfo.class.getSimpleName(), type), e);
-            m = Collections.emptyMap();
-        }
-        final Map<String, PropertyDescriptor> faster = PROPERTY_DESCRIPTORS.putIfAbsent(type, m);
-        return faster == null ? m : faster;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/StringUtils.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/StringUtils.java b/bval-core/src/main/java/org/apache/bval/util/StringUtils.java
deleted file mode 100644
index 6b9c25d..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/StringUtils.java
+++ /dev/null
@@ -1,149 +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.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public final class StringUtils {
-    private StringUtils() {
-    }
-
-    /**
-     * Taken from commons-lang3.
-     * <p>
-     * <p>Capitalizes a String changing the first character to title case as
-     * per {@link Character#toTitleCase(char)}. No other characters are changed.</p>
-     * <p>
-     * <p>For a word based algorithm, see {@link org.apache.commons.lang3.text.WordUtils#capitalize(String)}.
-     * A {@code null} input String returns {@code null}.</p>
-     * <p>
-     * <pre>
-     * StringUtils.capitalize(null)  = null
-     * StringUtils.capitalize("")    = ""
-     * StringUtils.capitalize("cat") = "Cat"
-     * StringUtils.capitalize("cAt") = "CAt"
-     * StringUtils.capitalize("'cat'") = "'cat'"
-     * </pre>
-     *
-     * @param str the String to capitalize, may be null
-     * @return the capitalized String, {@code null} if null String input
-     * @see org.apache.commons.lang3.text.WordUtils#capitalize(String)
-     */
-    public static String capitalize(final String str) {
-        int strLen;
-        if (str == null || (strLen = str.length()) == 0) {
-            return str;
-        }
-
-        final char firstChar = str.charAt(0);
-        final char newChar = Character.toTitleCase(firstChar);
-        if (firstChar == newChar) {
-            // already capitalized
-            return str;
-        }
-
-        char[] newChars = new char[strLen];
-        newChars[0] = newChar;
-        str.getChars(1, strLen, newChars, 1);
-        return String.valueOf(newChars);
-    }
-
-    /**
-     * Taken from commons-lang3.
-     * <p>Checks if a CharSequence is whitespace, empty ("") or null.</p>
-     * <p>
-     * <pre>
-     * StringUtils.isBlank(null)      = true
-     * StringUtils.isBlank("")        = true
-     * StringUtils.isBlank(" ")       = true
-     * StringUtils.isBlank("bob")     = false
-     * StringUtils.isBlank("  bob  ") = false
-     * </pre>
-     *
-     * @param cs the CharSequence to check, may be null
-     * @return {@code true} if the CharSequence is null, empty or whitespace
-     */
-    public static boolean isBlank(final CharSequence cs) {
-        int strLen;
-        if (cs == null || (strLen = cs.length()) == 0) {
-            return true;
-        }
-        for (int i = 0; i < strLen; i++) {
-            if (Character.isWhitespace(cs.charAt(i)) == false) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Taken from commons-lang3.
-     * <p>Checks if a CharSequence is not empty (""), not null and not whitespace only.</p>
-     *
-     * <pre>
-     * StringUtils.isNotBlank(null)      = false
-     * StringUtils.isNotBlank("")        = false
-     * StringUtils.isNotBlank(" ")       = false
-     * StringUtils.isNotBlank("bob")     = true
-     * StringUtils.isNotBlank("  bob  ") = true
-     * </pre>
-     *
-     * @param cs  the CharSequence to check, may be null
-     * @return {@code true} if the CharSequence is
-     *  not empty and not null and not whitespace
-     */
-    public static boolean isNotBlank(final CharSequence cs) {
-        return !isBlank(cs);
-    }
-
-    /**
-     * <p>Splits the provided text into an array, separator is whitespace.
-     */
-    public static String[] split(String str) {
-        return split(str, null);
-    }
-
-    /**
-     * <p>Splits the provided text into an array, separator is whitespace.
-     */
-    public static String[] split(String str, Character token) {
-        if (str == null || str.isEmpty()) {
-            return ObjectUtils.EMPTY_STRING_ARRAY;
-        }
-
-        // split on token
-        List<String> ret = new ArrayList<>();
-        StringBuilder sb = new StringBuilder(str.length());
-        for (int pos = 0; pos < str.length(); pos++) {
-            char c = str.charAt(pos);
-            if ((token == null && Character.isWhitespace(c)) || (token != null && token.equals(c))) {
-                if (sb.length() > 0) {
-                    ret.add(sb.toString());
-                    sb.setLength(0); // reset the string
-                }
-            } else {
-                sb.append(c);
-            }
-        }
-        if (sb.length() > 0) {
-            ret.add(sb.toString());
-        }
-        return ret.toArray(new String[ret.size()]);
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/Validate.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/Validate.java b/bval-core/src/main/java/org/apache/bval/util/Validate.java
deleted file mode 100644
index 042dc1b..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/Validate.java
+++ /dev/null
@@ -1,59 +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.util;
-
-import java.util.function.Function;
-
-/**
- * Some used validations from commons.
- */
-public final class Validate {
-    private Validate() {
-    }
-
-    public static <T> T notNull(final T object) {
-        return notNull(object, "The validated object is null");
-    }
-
-    public static <T> T notNull(final T object, final String message, final Object... values) {
-        return notNull(object, NullPointerException::new, message, values);
-    }
-
-    public static <E extends Exception, T> T notNull(final T object, Function<? super String, ? extends E> fn,
-        final String message, final Object... values) throws E {
-        Exceptions.raiseIf(object == null, fn, message, values);
-        return object;
-    }
-
-    public static void isTrue(final boolean expression, final String message, final Object... values) {
-        Exceptions.raiseUnless(expression, IllegalArgumentException::new, message, values);
-    }
-
-    public static <T> T[] noNullElements(final T[] array, final String message, final Object... values) {
-        Validate.notNull(array);
-
-        for (int i = 0; i < array.length; i++) {
-            Exceptions.raiseIf(array[i] == null, IllegalArgumentException::new, message,
-                ObjectUtils.arrayAdd(values, Integer.valueOf(i)));
-        }
-        return array;
-    }
-
-    public static void validState(final boolean expression, final String message, final Object... values) {
-        Exceptions.raiseUnless(expression, IllegalStateException::new, message, values);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java b/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java
deleted file mode 100644
index 16438ae..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java
+++ /dev/null
@@ -1,239 +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.util;
-
-import org.apache.bval.DynamicMetaBean;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.model.Validation;
-import org.apache.bval.model.ValidationContext;
-import org.apache.bval.model.ValidationListener;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Stateless helper methods used by the validators.
- * 
- * @author Carlos Vara
- */
-public class ValidationHelper {
-
-    /**
-     * Interface implemented by the call-back object passed to
-     * {@link ValidationHelper#validateContext(ValidationContext, ValidateCallback, boolean)}
-     * . Its {@link #validate()} method will be called accordingly for every
-     * dispatch.
-     */
-    public static interface ValidateCallback {
-        void validate();
-    }
-
-    /**
-     * validate a complex 'bean' with related beans according to
-     * validation rules in 'metaBean'
-     * 
-     * @param context
-     *            - the context is initialized with: <br>
-     *            &nbsp;&nbsp;bean - the root object start validation at
-     *            or a collection of root objects <br>
-     *            &nbsp;&nbsp;metaBean - the meta information for the root
-     *            object(s)
-     * @param context
-     *            The current validation context.
-     */
-    public static void validateContext(ValidationContext<?> context, ValidateCallback s, boolean treatMapsLikeBeans) {
-        if (context.getBean() != null) {
-            if (!treatMapsLikeBeans && context.getBean() instanceof Map<?, ?>) {
-                validateMapInContext(context, s);
-            } else if (context.getBean() instanceof Iterable<?>) {
-                validateIterableInContext(context, s);
-            } else if (context.getBean() instanceof Object[]) {
-                validateArrayInContext(context, s);
-            } else { // to One Bean (or Map like Bean)
-                validateBeanInContext(context, s);
-            }
-        }
-    }
-
-    /**
-     * Validates a single object.
-     * 
-     * @param <VL>
-     * @param context
-     *            The validation context, its current bean must be a single
-     *            object.
-     * @param s
-     */
-    protected static <VL extends ValidationListener> void validateBeanInContext(ValidationContext<VL> context,
-        ValidateCallback s) {
-        if (getDynamicMetaBean(context) != null) {
-            context.setMetaBean(getDynamicMetaBean(context).resolveMetaBean(context.getBean()));
-        }
-        s.validate();
-    }
-
-    /**
-     * Iterates the values of an array, setting the current context
-     * appropriately and validating each value.
-     * 
-     * @param <VL>
-     * @param context
-     *            The validation context, its current bean must be an array.
-     */
-    protected static <VL extends ValidationListener> void validateArrayInContext(ValidationContext<VL> context,
-        ValidateCallback s) {
-        int index = 0;
-        DynamicMetaBean dyn = getDynamicMetaBean(context);
-        Object[] array = (Object[]) context.getBean();
-        MetaBean metaBean = context.getMetaBean();
-        context.setCurrentIndex(null);
-
-        try {
-            for (Object each : array) {
-                context.setCurrentIndex(index++);
-                if (each == null) {
-                    continue; // Null values are not validated
-                }
-                if (dyn == null) {
-                    context.setBean(each);
-                } else {
-                    context.setBean(each, dyn.resolveMetaBean(each));
-                }
-                s.validate();
-            }
-        } finally {
-            context.moveUp(array, metaBean);
-        }
-    }
-
-    /**
-     * Iterates the values of an {@link Iterable} object, setting the current
-     * context appropriately and validating each value.
-     * 
-     * @param <VL>
-     * @param context
-     *            The validation context, its current bean must implement
-     *            {@link Iterable}.
-     */
-    protected static <VL extends ValidationListener> void validateIterableInContext(ValidationContext<VL> context,
-        ValidateCallback s) {
-
-        final boolean positional = context.getBean() instanceof List<?>;
-        int index = 0;
-        Iterable<?> iterable = (Iterable<?>) context.getBean();
-        MetaBean metaBean = context.getMetaBean();
-        context.setCurrentIndex(null);
-
-        try {
-            // jsr303 spec: Each object provided by the iterator is validated.
-            final DynamicMetaBean dyn = getDynamicMetaBean(context);
-            for (Object each : iterable) {
-                if (positional) {
-                    context.setCurrentIndex(index++);
-                }
-                if (each == null) {
-                    continue; // Null values are not validated
-                }
-                if (dyn == null) {
-                    context.setBean(each);
-                } else {
-                    context.setBean(each, dyn.resolveMetaBean(each));
-                }
-                s.validate();
-            }
-        } finally {
-            context.moveUp(iterable, metaBean);
-        }
-    }
-
-    /**
-     * Iterates the values of a {@link Map}, setting the current context
-     * appropriately and validating each value.
-     * 
-     * @param <VL>
-     * @param context
-     *            The validation context, its current bean must implement
-     *            {@link Map}.
-     */
-    protected static <VL extends ValidationListener> void validateMapInContext(ValidationContext<VL> context,
-        ValidateCallback s) {
-        // jsr303 spec: For Map, the value of each Map.Entry is validated (key
-        // is not validated).
-        Map<?, ?> currentBean = (Map<?, ?>) context.getBean();
-        MetaBean metaBean = context.getMetaBean();
-        final DynamicMetaBean dyn = getDynamicMetaBean(context);
-        context.setCurrentKey(null);
-        try {
-            for (Map.Entry<?, ?> entry : currentBean.entrySet()) {
-                Object value = entry.getValue();
-                if (value == null) {
-                    continue;
-                }
-                context.setCurrentKey(entry.getKey());
-                if (dyn == null) {
-                    context.setBean(value);
-                } else {
-                    context.setBean(value, dyn.resolveMetaBean(value));
-                }
-                s.validate();
-            }
-        } finally {
-            context.moveUp(currentBean, metaBean);
-        }
-    }
-
-    /**
-     * @param <VL>
-     * @param context
-     *            The current validation context.
-     * @return the current {@link DynamicMetaBean} in context, or
-     *         <code>null</code> if the current meta bean is not dynamic.
-     */
-    private static <VL extends ValidationListener> DynamicMetaBean getDynamicMetaBean(ValidationContext<VL> context) {
-        return context.getMetaBean() instanceof DynamicMetaBean ? (DynamicMetaBean) context.getMetaBean() : null;
-    }
-
-    /**
-     * Validate a single bean only, no related beans will be validated.
-     */
-    public static <VL extends ValidationListener> void validateBean(ValidationContext<VL> context) {
-        // execute all property level validations
-        for (MetaProperty prop : context.getMetaBean().getProperties()) {
-            context.setMetaProperty(prop);
-            validateProperty(context);
-        }
-
-        // execute all bean level validations
-        context.setMetaProperty(null);
-        for (Validation validation : context.getMetaBean().getValidations()) {
-            validation.validate(context);
-        }
-    }
-
-    /**
-     * Validate a single property only. Performs all validations
-     * for this property.
-     */
-    public static <VL extends ValidationListener> void validateProperty(ValidationContext<VL> context) {
-        for (Validation validation : context.getMetaProperty().getValidations()) {
-            validation.validate(context);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java b/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java
deleted file mode 100644
index 79e88fb..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/reflection/Reflection.java
+++ /dev/null
@@ -1,457 +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.util.reflection;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Function;
-
-import org.apache.commons.weaver.privilizer.Privilizing;
-
-/**
- * Security-agnostic "blueprint" class for reflection-related operations. Intended for use by Apache BVal code.
- */
-public class Reflection {
-    /**
-     * Inclusivity literals for {@link #hierarchy(Class, Interfaces)}.
-     * Taken from commons-lang3.
-     */
-    public enum Interfaces {
-        INCLUDE, EXCLUDE
-    }
-
-    private static final Object[][] NATIVE_CODES = new Object[][]{
-            { byte.class, "byte", "B" },
-            { char.class, "char", "C" },
-            { double.class, "double", "D" },
-            { float.class, "float", "F" },
-            { int.class, "int", "I" },
-            { long.class, "long", "J" },
-            { short.class, "short", "S" },
-            { boolean.class, "boolean", "Z" },
-            { void.class, "void", "V" }
-    };
-
-    /**
-     * Maps primitive {@code Class}es to their corresponding wrapper {@code Class}.
-     */
-    private static final Map<Class<?>, Class<?>> PRIMITIVE_WRAPPER_MAP;
-    static {
-        final Map<Class<?>, Class<?>> m = new HashMap<>();
-        m.put(Boolean.TYPE, Boolean.class);
-        m.put(Byte.TYPE, Byte.class);
-        m.put(Character.TYPE, Character.class);
-        m.put(Short.TYPE, Short.class);
-        m.put(Integer.TYPE, Integer.class);
-        m.put(Long.TYPE, Long.class);
-        m.put(Double.TYPE, Double.class);
-        m.put(Float.TYPE, Float.class);
-        m.put(Void.TYPE, Void.TYPE);
-        PRIMITIVE_WRAPPER_MAP = Collections.unmodifiableMap(m);
-    }
-
-    /**
-     * <p>Converts the specified primitive Class object to its corresponding
-     * wrapper Class object.</p>
-     *
-     * <p>NOTE: From v2.2, this method handles {@code Void.TYPE},
-     * returning {@code Void.TYPE}.</p>
-     *
-     * @param cls  the class to convert, may be null
-     * @return the wrapper class for {@code cls} or {@code cls} if
-     * {@code cls} is not a primitive. {@code null} if null input.
-     * @since 2.1
-     */
-    public static Class<?> primitiveToWrapper(final Class<?> cls) {
-        Class<?> convertedClass = cls;
-        if (cls != null && cls.isPrimitive()) {
-            convertedClass = PRIMITIVE_WRAPPER_MAP.get(cls);
-        }
-        return convertedClass;
-    }
-
-    public static Class<?> wrapperToPrimitive(final Class<?> cls) {
-        for (Map.Entry<Class<?>, Class<?>> primitiveEntry : PRIMITIVE_WRAPPER_MAP.entrySet()) {
-            if (primitiveEntry.getValue().equals(cls)) {
-                return primitiveEntry.getKey();
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Get the named value from the specified {@link Annotation}.
-     * @param annotation
-     * @param name
-     * @return Object value
-     * @throws IllegalAccessException
-     * @throws InvocationTargetException
-     */
-    public static Object getAnnotationValue(final Annotation annotation, final String name)
-        throws IllegalAccessException, InvocationTargetException {
-        final Method valueMethod;
-        try {
-            valueMethod = annotation.annotationType().getDeclaredMethod(name);
-        } catch (final NoSuchMethodException ex) {
-            // do nothing
-            return null;
-        }
-        final boolean mustUnset = setAccessible(valueMethod, true);
-        try {
-            return valueMethod.invoke(annotation);
-        } finally {
-            if (mustUnset) {
-                setAccessible(valueMethod, false);
-            }
-        }
-    }
-
-    /**
-     * Get a usable {@link ClassLoader}: that of {@code clazz} if {@link Thread#getContextClassLoader()} returns {@code null}.
-     * @param clazz
-     * @return {@link ClassLoader}
-     */
-    public static ClassLoader getClassLoader(final Class<?> clazz) {
-        final ClassLoader cl = Thread.currentThread().getContextClassLoader();
-        return cl == null ? clazz.getClassLoader() : cl;
-    }
-
-    public static Class<?> toClass(String className) throws ClassNotFoundException {
-        ClassLoader cl = getClassLoader(Reflection.class);
-        return toClass(className, cl);
-    }
-
-    /**
-     * Return the class for the given string, correctly handling
-     * primitive types. If the given class loader is null, the context
-     * loader of the current thread will be used.
-     *
-     * @throws RuntimeException on load error
-     */
-    public static Class<?> toClass(String className, ClassLoader loader) throws ClassNotFoundException {
-        return toClass(className, false, loader);
-    }
-
-    /**
-     * Return the class for the given string, correctly handling
-     * primitive types. If the given class loader is null, the context
-     * loader of the current thread will be used.
-     *
-     * @throws RuntimeException on load error
-     */
-    public static Class<?> toClass(String className, boolean resolve, ClassLoader loader) throws ClassNotFoundException {
-        if (className == null) {
-            throw new NullPointerException("className == null");
-        }
-
-        // array handling
-        int dims = 0;
-        while (className.endsWith("[]")) {
-            dims++;
-            className = className.substring(0, className.length() - 2);
-        }
-
-        // check against primitive types
-        boolean primitive = false;
-        if (className.indexOf('.') == -1) {
-            for (int i = 0; !primitive && (i < NATIVE_CODES.length); i++) {
-                if (NATIVE_CODES[i][1].equals(className)) {
-                    if (dims == 0) {
-                        return (Class<?>) NATIVE_CODES[i][0];
-                    }
-                    className = (String) NATIVE_CODES[i][2];
-                    primitive = true;
-                }
-            }
-        }
-
-        if (dims > 0) {
-            StringBuilder buf = new StringBuilder(className.length() + dims + 2);
-            for (int i = 0; i < dims; i++) {
-                buf.append('[');
-            }
-            if (!primitive) {
-                buf.append('L');
-            }
-            buf.append(className);
-            if (!primitive) {
-                buf.append(';');
-            }
-            className = buf.toString();
-        }
-
-        if (loader == null) {
-            loader = Thread.currentThread().getContextClassLoader();
-        }
-
-        return Class.forName(className, resolve, loader);
-    }
-
-
-    /**
-     * Convenient point for {@link Privilizing} {@link System#getProperty(String)}.
-     * @param name
-     * @return String
-     */
-    public static String getProperty(final String name) {
-        return System.getProperty(name);
-    }
-
-    /**
-     * Get the declared field from {@code clazz}.
-     * @param clazz
-     * @param fieldName
-     * @return {@link Field} or {@code null}
-     */
-    public static Field getDeclaredField(final Class<?> clazz, final String fieldName) {
-        try {
-            return clazz.getDeclaredField(fieldName);
-        } catch (final NoSuchFieldException e) {
-            return null;
-        }
-    }
-
-    /**
-     * Convenient point for {@link Privilizing} {@link Class#getDeclaredFields()}.
-     * @param clazz
-     * @return {@link Field} array
-     */
-    public static Field[] getDeclaredFields(final Class<?> clazz) {
-        return clazz.getDeclaredFields();
-    }
-
-    /**
-     * Get the declared constructor from {@code clazz}.
-     * @param clazz
-     * @param parameters
-     * @return {@link Constructor} or {@code null}
-     */
-    public static <T> Constructor<T> getDeclaredConstructor(final Class<T> clazz, final Class<?>... parameters) {
-        try {
-            return clazz.getDeclaredConstructor(parameters);
-        } catch (final NoSuchMethodException e) {
-            return null;
-        }
-    }
-
-    /**
-     * Get the declared method from {@code clazz}.
-     * @param clazz
-     * @param name
-     * @param parameters
-     * @return {@link Method} or {@code null}
-     */
-    public static Method getDeclaredMethod(final Class<?> clazz, final String name, final Class<?>... parameters) {
-        try {
-            return clazz.getDeclaredMethod(name, parameters);
-        } catch (final NoSuchMethodException e) {
-            return null;
-        }
-    }
-
-    /**
-     * Convenient point for {@link Privilizing} {@link Class#getDeclaredMethods()}.
-     * @param clazz
-     * @return {@link Method} array
-     */
-    public static Method[] getDeclaredMethods(final Class<?> clazz) {
-        return clazz.getDeclaredMethods();
-    }
-
-    /**
-     * Convenient point for {@link Privilizing} {@link Class#getDeclaredConstructors()}.
-     * @param clazz
-     * @return {@link Constructor} array
-     */
-    public static Constructor<?>[] getDeclaredConstructors(final Class<?> clazz) {
-        return clazz.getDeclaredConstructors();
-    }
-
-    /**
-     * Get the specified {@code public} {@link Method} from {@code clazz}.
-     * @param clazz
-     * @param methodName
-     * @return {@link Method} or {@code null}
-     */
-    public static Method getPublicMethod(final Class<?> clazz, final String methodName, Class<?>... parameterTypes) {
-        try {
-            return clazz.getMethod(methodName, parameterTypes);
-        } catch (final NoSuchMethodException e) {
-            return null;
-        }
-    }
-
-    /**
-     * Perform a search against the class hierarchy.
-     * @param clazz
-     * @param search
-     * @return T or {@code null}
-     */
-    public static <T> T find(final Class<?> clazz, Function<Class<?>, T> search) {
-        for (Class<?> t : hierarchy(clazz, Interfaces.INCLUDE)) {
-            final T value = search.apply(t);
-            if (value != null) {
-                return value;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Construct a new instance of {@code cls} using its default constructor.
-     * @param cls
-     * @return T
-     */
-    public static <T> T newInstance(final Class<T> cls) {
-        try {
-            return cls.getConstructor().newInstance();
-        } catch (final Exception ex) {
-            throw new RuntimeException("Cannot instantiate : " + cls, ex);
-        }
-    }
-
-    /**
-     * Set the accessibility of {@code o} to {@code accessible}. If running without a {@link SecurityManager}
-     * and {@code accessible == false}, this call is ignored (because any code could reflectively make any
-     * object accessible at any time).
-     * @param o
-     * @param accessible
-     * @return whether a change was made.
-     */
-    public static boolean setAccessible(final AccessibleObject o, boolean accessible) {
-        if (o == null || o.isAccessible() == accessible) {
-            return false;
-        }
-        if (!accessible && System.getSecurityManager() == null) {
-            return false;
-        }
-        final Member m = (Member) o;
-
-        // For public members whose declaring classes are public, we need do nothing:
-        if (Modifier.isPublic(m.getModifiers()) && Modifier.isPublic(m.getDeclaringClass().getModifiers())) {
-            return false;
-        }
-        o.setAccessible(accessible);
-        return true;
-    }
-
-    /**
-     * Get an {@link Iterable} that can iterate over a class hierarchy in ascending (subclass to superclass) order.
-     * Taken from commons-lang3.
-     *
-     * @param type the type to get the class hierarchy from
-     * @param interfacesBehavior switch indicating whether to include or exclude interfaces
-     * @return Iterable an Iterable over the class hierarchy of the given class
-     */
-    public static Iterable<Class<?>> hierarchy(final Class<?> type, final Interfaces interfacesBehavior) {
-        if (type == null) {
-            return Collections.emptySet();
-        }
-        final Iterable<Class<?>> classes = new Iterable<Class<?>>() {
-
-            @Override
-            public Iterator<Class<?>> iterator() {
-                return new Iterator<Class<?>>() {
-                    Optional<Class<?>> next;
-                    {
-                        next = Optional.of(type);
-                    }
-
-                    @Override
-                    public boolean hasNext() {
-                        return next.isPresent();
-                    }
-
-                    @Override
-                    public Class<?> next() {
-                        final Class<?> result = next.orElseThrow(NoSuchElementException::new);
-                        next = Optional.ofNullable(result.getSuperclass());
-                        return result;
-                    }
-
-                    @Override
-                    public void remove() {
-                        throw new UnsupportedOperationException();
-                    }
-                };
-            }
-        };
-        if (interfacesBehavior != Interfaces.INCLUDE) {
-            return classes;
-        }
-        return new Iterable<Class<?>>() {
-
-            @Override
-            public Iterator<Class<?>> iterator() {
-                final Set<Class<?>> seenInterfaces = new HashSet<Class<?>>();
-                final Iterator<Class<?>> wrapped = classes.iterator();
-    
-                return new Iterator<Class<?>>() {
-                    Iterator<Class<?>> interfaces = Collections.emptyIterator();
-
-                    @Override
-                    public boolean hasNext() {
-                        return interfaces.hasNext() || wrapped.hasNext();
-                    }
-
-                    @Override
-                    public Class<?> next() {
-                        if (interfaces.hasNext()) {
-                            final Class<?> nextInterface = interfaces.next();
-                            seenInterfaces.add(nextInterface);
-                            return nextInterface;
-                        }
-                        final Class<?> nextSuperclass = wrapped.next();
-                        final Set<Class<?>> currentInterfaces = new LinkedHashSet<>();
-                        walkInterfaces(currentInterfaces, nextSuperclass);
-                        interfaces = currentInterfaces.iterator();
-                        return nextSuperclass;
-                    }
-
-                    private void walkInterfaces(final Set<Class<?>> addTo, final Class<?> c) {
-                        for (final Class<?> iface : c.getInterfaces()) {
-                            if (!seenInterfaces.contains(iface)) {
-                                addTo.add(iface);
-                            }
-                            walkInterfaces(addTo, iface);
-                        }
-                    }
-
-                    @Override
-                    public void remove() {
-                        throw new UnsupportedOperationException();
-                    }
-                };
-            }
-        };
-    }
-}


[4/8] bval git commit: remove obsolete modules, moving required core code to jsr

Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/pom.xml
----------------------------------------------------------------------
diff --git a/bval-jsr/pom.xml b/bval-jsr/pom.xml
index f95f794..8913f7c 100644
--- a/bval-jsr/pom.xml
+++ b/bval-jsr/pom.xml
@@ -151,15 +151,6 @@
 
     <dependencies>
         <dependency>
-            <groupId>org.apache.bval</groupId>
-            <artifactId>bval-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-        </dependency>
-        <dependency>
             <groupId>commons-beanutils</groupId>
             <artifactId>commons-beanutils-core</artifactId>
             <optional>true</optional>
@@ -176,6 +167,18 @@
             <!-- don't pull into OSGi bundle -->
             <scope>provided</scope>
             <optional>true</optional>
+            <exclusions>
+            <exclusion>
+          <groupId>org.apache.bval</groupId>
+          <artifactId>bval-core</artifactId>
+        </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+            <scope>provided</scope>
+            <optional>true</optional>
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
@@ -270,11 +273,29 @@
                 </configuration>
             </plugin>
 
+            <!-- create mainClass attribute -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-jar-plugin</artifactId>
                 <executions>
                     <execution>
+                        <id>default-jar</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <configuration>
+                            <archive>
+                                <manifest>
+                                   <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+                                   <mainClass>org.apache.bval.util.BValVersion</mainClass>
+                                </manifest>
+                                <manifestEntries>
+                                    <Implementation-Build>${buildNumber}</Implementation-Build>
+                                </manifestEntries>
+                            </archive>
+                        </configuration>
+                    </execution>
+                    <execution>
                         <id>test-jar</id>
                         <phase>package</phase>
                         <goals>
@@ -298,6 +319,36 @@
                 <groupId>org.apache.commons</groupId>
                 <artifactId>commons-weaver-maven-plugin</artifactId>
             </plugin>
+            <!--
+                get the project version
+                and set it in a properties file for later retrieval
+            -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>set version info</id>
+                        <phase>compile</phase>
+                        <configuration>
+                            <target>
+                                <echo>Version: ${project.version}</echo>
+                                <echo>Date: ${timestamp}</echo>
+                                <mkdir dir="${project.build.outputDirectory}/META-INF" />
+                                <echo file="${project.build.outputDirectory}/META-INF/org.apache.bval.revision.properties">
+# Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
+project.name=Apache BVal
+project.version=${project.version}
+build.timestamp=${timestamp}
+                                </echo>
+                            </target>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/src/main/java/org/apache/bval/routines/EMailValidationUtils.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/routines/EMailValidationUtils.java b/bval-jsr/src/main/java/org/apache/bval/routines/EMailValidationUtils.java
new file mode 100644
index 0000000..0835bae
--- /dev/null
+++ b/bval-jsr/src/main/java/org/apache/bval/routines/EMailValidationUtils.java
@@ -0,0 +1,75 @@
+/*
+ *  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.routines;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Description: holds the regexp to validate an email address<br>
+ * User: roman.stumm<br>
+ * Date: 17.06.2010<br>
+ * Time: 10:40:59<br>
+ */
+public class EMailValidationUtils {
+    private static String ATOM = "[^\\x00-\\x1F\\(\\)\\<\\>\\@\\,\\;\\:\\\\\\\"\\.\\[\\]\\s]";
+    private static String DOMAIN = "(" + ATOM + "+(\\." + ATOM + "+)*";
+    private static String IP_DOMAIN = "\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\]";
+    public static final Pattern DEFAULT_EMAIL_PATTERN;
+
+    static {
+        DEFAULT_EMAIL_PATTERN = Pattern.compile("^" + ATOM + "+(\\." + ATOM + "+)*@" + DOMAIN + "|" + IP_DOMAIN + ")$",
+            Pattern.CASE_INSENSITIVE);
+    }
+
+    /**
+     * Learn whether a given object is a valid email address.
+     * 
+     * @param value
+     *            to check
+     * @return <code>true</code> if the validation passes
+     */
+    public static boolean isValid(Object value) {
+        return isValid(value, DEFAULT_EMAIL_PATTERN);
+    }
+
+    /**
+     * Learn whether a particular value matches a given pattern per
+     * {@link Matcher#matches()}.
+     * 
+     * @param value
+     * @param aPattern
+     * @return <code>true</code> if <code>value</code> was a <code>String</code>
+     *         matching <code>aPattern</code>
+     */
+    // TODO it would seem to make sense to move or reduce the visibility of this
+    // method as it is more general than email.
+    public static boolean isValid(Object value, Pattern aPattern) {
+        if (value == null) {
+            return true;
+        }
+        if (!(value instanceof CharSequence)) {
+            return false;
+        }
+        CharSequence seq = (CharSequence) value;
+        if (seq.length() == 0) {
+            return true;
+        }
+        return aPattern.matcher(seq).matches();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/src/main/java/org/apache/bval/util/BValVersion.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/util/BValVersion.java b/bval-jsr/src/main/java/org/apache/bval/util/BValVersion.java
new file mode 100644
index 0000000..01b5c58
--- /dev/null
+++ b/bval-jsr/src/main/java/org/apache/bval/util/BValVersion.java
@@ -0,0 +1,195 @@
+/*
+ * 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.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import org.apache.bval.util.reflection.Reflection;
+import org.apache.commons.weaver.privilizer.Privilizing;
+import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
+
+/**
+ * This class contains version information for BVal.
+ * It uses Ant's filter tokens to convert the template into a java
+ * file with current information.
+ */
+@Privilizing(@CallTo(Reflection.class))
+public class BValVersion {
+
+    /** Project name */
+    public static final String PROJECT_NAME = "Apache BVal";
+    /** Unique id of the current project/version/revision */
+    public static final String PROJECT_ID;
+    /** Version number */
+    public static final String VERSION_NUMBER;
+    /** Major release number */
+    public static final int MAJOR_RELEASE;
+    /** Minor release number */
+    public static final int MINOR_RELEASE;
+    /** Patch/point release number */
+    public static final int PATCH_RELEASE;
+    /** Release status */
+    public static final String RELEASE_STATUS;
+    /** Version control revision number */
+    public static final String REVISION_NUMBER;
+
+    static {
+        Properties revisionProps = new Properties();
+        try (InputStream in = BValVersion.class.getResourceAsStream("/META-INF/org.apache.bval.revision.properties")) {
+            if (in != null) {
+                revisionProps.load(in);
+            }
+        } catch (IOException ioe) {
+        }
+
+        String vers = revisionProps.getProperty("project.version");
+        if (StringUtils.isBlank(vers)) {
+            vers = "0.0.0";
+        }
+        VERSION_NUMBER = vers;
+
+        StringTokenizer tok = new StringTokenizer(VERSION_NUMBER, ".-");
+        int major, minor, patch;
+        try {
+            major = tok.hasMoreTokens() ? Integer.parseInt(tok.nextToken()) : 0;
+        } catch (Exception e) {
+            major = 0;
+        }
+
+        try {
+            minor = tok.hasMoreTokens() ? Integer.parseInt(tok.nextToken()) : 0;
+        } catch (Exception e) {
+            minor = 0;
+        }
+
+        try {
+            patch = tok.hasMoreTokens() ? Integer.parseInt(tok.nextToken()) : 0;
+        } catch (Exception e) {
+            patch = 0;
+        }
+
+        String revision = revisionProps.getProperty("svn.revision");
+        if (StringUtils.isBlank(revision)) {
+            revision = "unknown";
+        } else {
+            tok = new StringTokenizer(revision, ":");
+            String strTok = null;
+            while (tok.hasMoreTokens()) {
+                try {
+                    strTok = tok.nextToken();
+                } catch (Exception e) {
+                }
+            }
+            if (strTok != null) {
+                revision = strTok;
+            }
+        }
+
+        MAJOR_RELEASE = major;
+        MINOR_RELEASE = minor;
+        PATCH_RELEASE = patch;
+        RELEASE_STATUS = tok.hasMoreTokens() ? tok.nextToken("!") : "";
+        REVISION_NUMBER = revision;
+        PROJECT_ID = PROJECT_NAME + " " + VERSION_NUMBER + "-r" + REVISION_NUMBER;
+    }
+
+    /**
+     * Get the project version number.
+     * @return String
+     */
+    public static String getVersion() {
+        return VERSION_NUMBER;
+    }
+
+    /**
+     * Get the version control revision number.
+     * @return String
+     */
+    public static String getRevision() {
+        return REVISION_NUMBER;
+    }
+
+    /**
+     * Get the project name.
+     * @return String
+     */
+    public static String getName() {
+        return PROJECT_NAME;
+    }
+
+    /**
+     * Get the fully-qualified project id.
+     * @return String
+     */
+    public static String getID() {
+        return PROJECT_ID;
+    }
+
+    /**
+     * Main method of this class that prints the {@link #toString()} to <code>System.out</code>.
+     * @param args ignored
+     */
+    public static void main(String[] args) {
+        System.out.println(new BValVersion().toString());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder buf = new StringBuilder(80 * 40);
+        appendBanner(buf);
+        buf.append("\n");
+
+        appendProperty("os.name", buf).append("\n");
+        appendProperty("os.version", buf).append("\n");
+        appendProperty("os.arch", buf).append("\n\n");
+
+        appendProperty("java.version", buf).append("\n");
+        appendProperty("java.vendor", buf).append("\n\n");
+
+        buf.append("java.class.path:\n");
+        final StringTokenizer tok = new StringTokenizer(Reflection.getProperty("java.class.path"));
+        while (tok.hasMoreTokens()) {
+            buf.append("\t").append(tok.nextToken());
+            buf.append("\n");
+        }
+        buf.append("\n");
+
+        appendProperty("user.dir", buf).append("\n");
+        return buf.toString();
+    }
+
+    private void appendBanner(StringBuilder buf) {
+        buf.append("Project").append(": ").append(getName());
+        buf.append("\n");
+        buf.append("Version").append(": ").append(getVersion());
+        buf.append("\n");
+        buf.append("Revision").append(": ").append(getRevision());
+        buf.append("\n");
+    }
+
+    private StringBuilder appendProperty(String prop, StringBuilder buf) {
+        return buf.append(prop).append(": ").append(Reflection.getProperty(prop));
+    }
+}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/src/main/java/org/apache/bval/util/Exceptions.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/util/Exceptions.java b/bval-jsr/src/main/java/org/apache/bval/util/Exceptions.java
new file mode 100644
index 0000000..9487cde
--- /dev/null
+++ b/bval-jsr/src/main/java/org/apache/bval/util/Exceptions.java
@@ -0,0 +1,125 @@
+/*
+ *  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.util;
+
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import java.util.stream.Stream;
+
+/**
+ * Utility class for the creation and throwing of Exceptions.
+ */
+public class Exceptions {
+
+    public static <E extends Exception> E create(Function<? super String, ? extends E> fn, String format,
+        Object... args) {
+        return create(fn, () -> String.format(format, args));
+    }
+
+    public static <E extends Exception, C extends Throwable> E create(
+        BiFunction<? super String, ? super C, ? extends E> fn, C cause, String format, Object... args) {
+        return create(fn, cause, () -> String.format(format, args));
+    }
+
+    public static <E extends Exception> E create(Function<? super String, ? extends E> fn, Supplier<String> message) {
+        return elideStackTrace(fn.apply(message.get()));
+    }
+
+    public static <E extends Exception, C extends Throwable> E create(
+        BiFunction<? super String, ? super C, ? extends E> fn, C cause, Supplier<String> message) {
+        return elideStackTrace(fn.apply(message.get(), cause));
+    }
+
+    public static <E extends Exception, R> R raise(Function<? super String, ? extends E> fn, String format,
+        Object... args) throws E {
+        throw create(fn, format, args);
+    }
+
+    public static <E extends Exception> void raiseIf(boolean condition, Function<? super String, ? extends E> fn,
+        String format, Object... args) throws E {
+        if (condition) {
+            raise(fn, format, args);
+        }
+    }
+
+    public static <E extends Exception> void raiseUnless(boolean condition, Function<? super String, ? extends E> fn,
+        String format, Object... args) throws E {
+        raiseIf(!condition, fn, format, args);
+    }
+
+    public static <E extends Exception, R> R raise(Function<? super String, ? extends E> fn, Supplier<String> message)
+        throws E {
+        throw create(fn, message);
+    }
+
+    public static <E extends Exception> void raiseIf(boolean condition, Function<? super String, ? extends E> fn,
+        Supplier<String> message) throws E {
+        if (condition) {
+            raise(fn, message);
+        }
+    }
+
+    public static <E extends Exception> void raiseUnless(boolean condition, Function<? super String, ? extends E> fn,
+        Supplier<String> message) throws E {
+        raiseIf(!condition, fn, message);
+    }
+
+    public static <E extends Exception, C extends Throwable, R> R raise(
+        BiFunction<? super String, ? super C, ? extends E> fn, C cause, String format, Object... args) throws E {
+        throw create(fn, cause, format, args);
+    }
+
+    public static <E extends Exception, C extends Throwable> void raiseIf(boolean condition,
+        BiFunction<? super String, ? super C, ? extends E> fn, C cause, String format, Object... args) throws E {
+        if (condition) {
+            raise(fn, cause, format, args);
+        }
+    }
+
+    public static <E extends Exception, C extends Throwable> void raiseUnless(boolean condition,
+        BiFunction<? super String, ? super C, ? extends E> fn, C cause, String format, Object... args) throws E {
+        raiseIf(!condition, fn, cause, format, args);
+    }
+
+    public static <E extends Exception, C extends Throwable, R> R raise(
+        BiFunction<? super String, ? super C, ? extends E> fn, C cause, Supplier<String> message) throws E {
+        throw create(fn, cause, message);
+    }
+
+    public static <E extends Exception, C extends Throwable> void raiseIf(boolean condition,
+        BiFunction<? super String, ? super C, ? extends E> fn, C cause, Supplier<String> message) throws E {
+        if (condition) {
+            raise(fn, cause, message);
+        }
+    }
+
+    public static <E extends Exception, C extends Throwable> void raiseUnless(boolean condition,
+        BiFunction<? super String, ? super C, ? extends E> fn, C cause, Supplier<String> message) throws E {
+        raiseIf(!condition, fn, cause, message);
+    }
+
+    private static <T extends Throwable> T elideStackTrace(T t) {
+        final StackTraceElement[] stackTrace = t.fillInStackTrace().getStackTrace();
+        t.setStackTrace(Stream.of(stackTrace).filter(e -> !Exceptions.class.getName().equals(e.getClassName()))
+            .toArray(StackTraceElement[]::new));
+        return t;
+    }
+
+    private Exceptions() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/src/main/java/org/apache/bval/util/Lazy.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/util/Lazy.java b/bval-jsr/src/main/java/org/apache/bval/util/Lazy.java
new file mode 100644
index 0000000..4796de3
--- /dev/null
+++ b/bval-jsr/src/main/java/org/apache/bval/util/Lazy.java
@@ -0,0 +1,62 @@
+/*
+ *  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.util;
+
+import java.util.Optional;
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+/**
+ * @since 2.0
+ *
+ * @param <T>
+ */
+public class Lazy<T> implements Supplier<T> {
+    private T value;
+    private volatile Supplier<T> init;
+
+    public Lazy(Supplier<T> init) {
+        reset(init);
+    }
+
+    public Lazy<T> reset(Supplier<T> init) {
+        this.init = Validate.notNull(init);
+        return this;
+    }
+
+    @Override
+    public T get() {
+        if (init != null) {
+            synchronized (this) {
+                if (init != null) {
+                    value = init.get();
+                    init = null;
+                }
+            }
+        }
+        return value;
+    }
+
+    public Optional<T> optional() {
+        return Optional.ofNullable(value);
+    }
+
+    public <U> Consumer<U> consumer(BiConsumer<? super T, ? super U> delegate) {
+        return u -> delegate.accept(get(), u);
+    }
+}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/src/main/java/org/apache/bval/util/LazyInt.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/util/LazyInt.java b/bval-jsr/src/main/java/org/apache/bval/util/LazyInt.java
new file mode 100644
index 0000000..b866226
--- /dev/null
+++ b/bval-jsr/src/main/java/org/apache/bval/util/LazyInt.java
@@ -0,0 +1,49 @@
+/*
+ *  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.util;
+
+import java.util.OptionalInt;
+import java.util.function.IntSupplier;
+
+/**
+ * @since 2.0
+ */
+public class LazyInt implements IntSupplier {
+    private int value;
+    private volatile IntSupplier init;
+
+    public LazyInt(IntSupplier init) {
+        this.init = Validate.notNull(init);
+    }
+
+    @Override
+    public int getAsInt() {
+        if (init != null) {
+            synchronized (this) {
+                if (init != null) {
+                    value = init.getAsInt();
+                    init = null;
+                }
+            }
+        }
+        return value;
+    }
+
+    public synchronized OptionalInt optional() {
+        return init == null ? OptionalInt.of(value) : OptionalInt.empty();
+    }
+}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/src/main/java/org/apache/bval/util/ObjectUtils.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/util/ObjectUtils.java b/bval-jsr/src/main/java/org/apache/bval/util/ObjectUtils.java
new file mode 100644
index 0000000..1c5a728
--- /dev/null
+++ b/bval-jsr/src/main/java/org/apache/bval/util/ObjectUtils.java
@@ -0,0 +1,98 @@
+/*
+ * 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.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
+import java.util.Objects;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+
+public final class ObjectUtils {
+    public static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[0];
+    public static final String[] EMPTY_STRING_ARRAY = new String[0];
+    public static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
+
+    private ObjectUtils() {
+    }
+
+    /**
+     * <p>Returns a default value if the object passed is {@code null}.</p>
+     *
+     * <pre>
+     * ObjectUtils.defaultIfNull(null, null)      = null
+     * ObjectUtils.defaultIfNull(null, "")        = ""
+     * ObjectUtils.defaultIfNull(null, "zz")      = "zz"
+     * ObjectUtils.defaultIfNull("abc", *)        = "abc"
+     * ObjectUtils.defaultIfNull(Boolean.TRUE, *) = Boolean.TRUE
+     * </pre>
+     *
+     * @param <T> the type of the object
+     * @param object  the {@code Object} to test, may be {@code null}
+     * @param defaultValue  the default value to return, may be {@code null}
+     * @return {@code object} if it is not {@code null}, defaultValue otherwise
+     */
+    public static <T> T defaultIfNull(final T object, final T defaultValue) {
+        return object == null ? defaultValue : object;
+    }
+
+    public static <T> boolean isNotEmpty(final T[] array) {
+        return !isEmpty(array);
+    }
+
+    public static boolean isEmpty(final Object[] array) {
+        return array == null || array.length == 0;
+    }
+
+    /**
+     * <p>Checks if the object is in the given array.
+     *
+     * <p>The method returns {@code false} if a {@code null} array is passed in.
+     *
+     * @param array  the array to search through
+     * @param objectToFind  the object to find
+     * @return {@code true} if the array contains the object
+     */
+    public static boolean arrayContains(final Object[] array, final Object objectToFind) {
+        if (array == null) {
+            return false;
+        }
+        return Stream.of(array).anyMatch(Predicate.isEqual(objectToFind));
+    }
+
+    public static int indexOf(final Object[] array, final Object objectToFind) {
+        for (int i = 0; i < array.length; i++) {
+            if (Objects.equals(array[i], objectToFind)) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    public static <T> T[] arrayAdd(T[] array, T objectToAdd) {
+        if (array == null && objectToAdd == null) {
+            throw new IllegalArgumentException("Arguments cannot both be null");
+        }
+        final int arrayLength = Array.getLength(array);
+        @SuppressWarnings("unchecked")
+        T[] newArray = (T[]) Array.newInstance(array.getClass().getComponentType(), arrayLength + 1);
+        System.arraycopy(array, 0, newArray, 0, arrayLength);
+        newArray[newArray.length - 1] = objectToAdd;
+
+        return newArray;
+    }
+}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/src/main/java/org/apache/bval/util/ObjectWrapper.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/util/ObjectWrapper.java b/bval-jsr/src/main/java/org/apache/bval/util/ObjectWrapper.java
new file mode 100644
index 0000000..8483745
--- /dev/null
+++ b/bval-jsr/src/main/java/org/apache/bval/util/ObjectWrapper.java
@@ -0,0 +1,50 @@
+/*
+ * 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.util;
+
+import java.util.Optional;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+public class ObjectWrapper<T> implements Consumer<T>, Supplier<T> {
+    private T value;
+
+    public ObjectWrapper() {
+        this(null);
+    }
+
+    public ObjectWrapper(T value) {
+        super();
+        this.value = value;
+    }
+
+    @Override
+    public void accept(T value) {
+        this.value = value;
+    }
+
+    @Override
+    public T get() {
+        return value;
+    }
+
+    public Optional<T> optional() {
+        return Optional.ofNullable(value);
+    }
+}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/src/main/java/org/apache/bval/util/StringUtils.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/util/StringUtils.java b/bval-jsr/src/main/java/org/apache/bval/util/StringUtils.java
new file mode 100644
index 0000000..6b9c25d
--- /dev/null
+++ b/bval-jsr/src/main/java/org/apache/bval/util/StringUtils.java
@@ -0,0 +1,149 @@
+/*
+ * 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.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public final class StringUtils {
+    private StringUtils() {
+    }
+
+    /**
+     * Taken from commons-lang3.
+     * <p>
+     * <p>Capitalizes a String changing the first character to title case as
+     * per {@link Character#toTitleCase(char)}. No other characters are changed.</p>
+     * <p>
+     * <p>For a word based algorithm, see {@link org.apache.commons.lang3.text.WordUtils#capitalize(String)}.
+     * A {@code null} input String returns {@code null}.</p>
+     * <p>
+     * <pre>
+     * StringUtils.capitalize(null)  = null
+     * StringUtils.capitalize("")    = ""
+     * StringUtils.capitalize("cat") = "Cat"
+     * StringUtils.capitalize("cAt") = "CAt"
+     * StringUtils.capitalize("'cat'") = "'cat'"
+     * </pre>
+     *
+     * @param str the String to capitalize, may be null
+     * @return the capitalized String, {@code null} if null String input
+     * @see org.apache.commons.lang3.text.WordUtils#capitalize(String)
+     */
+    public static String capitalize(final String str) {
+        int strLen;
+        if (str == null || (strLen = str.length()) == 0) {
+            return str;
+        }
+
+        final char firstChar = str.charAt(0);
+        final char newChar = Character.toTitleCase(firstChar);
+        if (firstChar == newChar) {
+            // already capitalized
+            return str;
+        }
+
+        char[] newChars = new char[strLen];
+        newChars[0] = newChar;
+        str.getChars(1, strLen, newChars, 1);
+        return String.valueOf(newChars);
+    }
+
+    /**
+     * Taken from commons-lang3.
+     * <p>Checks if a CharSequence is whitespace, empty ("") or null.</p>
+     * <p>
+     * <pre>
+     * StringUtils.isBlank(null)      = true
+     * StringUtils.isBlank("")        = true
+     * StringUtils.isBlank(" ")       = true
+     * StringUtils.isBlank("bob")     = false
+     * StringUtils.isBlank("  bob  ") = false
+     * </pre>
+     *
+     * @param cs the CharSequence to check, may be null
+     * @return {@code true} if the CharSequence is null, empty or whitespace
+     */
+    public static boolean isBlank(final CharSequence cs) {
+        int strLen;
+        if (cs == null || (strLen = cs.length()) == 0) {
+            return true;
+        }
+        for (int i = 0; i < strLen; i++) {
+            if (Character.isWhitespace(cs.charAt(i)) == false) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Taken from commons-lang3.
+     * <p>Checks if a CharSequence is not empty (""), not null and not whitespace only.</p>
+     *
+     * <pre>
+     * StringUtils.isNotBlank(null)      = false
+     * StringUtils.isNotBlank("")        = false
+     * StringUtils.isNotBlank(" ")       = false
+     * StringUtils.isNotBlank("bob")     = true
+     * StringUtils.isNotBlank("  bob  ") = true
+     * </pre>
+     *
+     * @param cs  the CharSequence to check, may be null
+     * @return {@code true} if the CharSequence is
+     *  not empty and not null and not whitespace
+     */
+    public static boolean isNotBlank(final CharSequence cs) {
+        return !isBlank(cs);
+    }
+
+    /**
+     * <p>Splits the provided text into an array, separator is whitespace.
+     */
+    public static String[] split(String str) {
+        return split(str, null);
+    }
+
+    /**
+     * <p>Splits the provided text into an array, separator is whitespace.
+     */
+    public static String[] split(String str, Character token) {
+        if (str == null || str.isEmpty()) {
+            return ObjectUtils.EMPTY_STRING_ARRAY;
+        }
+
+        // split on token
+        List<String> ret = new ArrayList<>();
+        StringBuilder sb = new StringBuilder(str.length());
+        for (int pos = 0; pos < str.length(); pos++) {
+            char c = str.charAt(pos);
+            if ((token == null && Character.isWhitespace(c)) || (token != null && token.equals(c))) {
+                if (sb.length() > 0) {
+                    ret.add(sb.toString());
+                    sb.setLength(0); // reset the string
+                }
+            } else {
+                sb.append(c);
+            }
+        }
+        if (sb.length() > 0) {
+            ret.add(sb.toString());
+        }
+        return ret.toArray(new String[ret.size()]);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/src/main/java/org/apache/bval/util/Validate.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/util/Validate.java b/bval-jsr/src/main/java/org/apache/bval/util/Validate.java
new file mode 100644
index 0000000..042dc1b
--- /dev/null
+++ b/bval-jsr/src/main/java/org/apache/bval/util/Validate.java
@@ -0,0 +1,59 @@
+/*
+ * 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.util;
+
+import java.util.function.Function;
+
+/**
+ * Some used validations from commons.
+ */
+public final class Validate {
+    private Validate() {
+    }
+
+    public static <T> T notNull(final T object) {
+        return notNull(object, "The validated object is null");
+    }
+
+    public static <T> T notNull(final T object, final String message, final Object... values) {
+        return notNull(object, NullPointerException::new, message, values);
+    }
+
+    public static <E extends Exception, T> T notNull(final T object, Function<? super String, ? extends E> fn,
+        final String message, final Object... values) throws E {
+        Exceptions.raiseIf(object == null, fn, message, values);
+        return object;
+    }
+
+    public static void isTrue(final boolean expression, final String message, final Object... values) {
+        Exceptions.raiseUnless(expression, IllegalArgumentException::new, message, values);
+    }
+
+    public static <T> T[] noNullElements(final T[] array, final String message, final Object... values) {
+        Validate.notNull(array);
+
+        for (int i = 0; i < array.length; i++) {
+            Exceptions.raiseIf(array[i] == null, IllegalArgumentException::new, message,
+                ObjectUtils.arrayAdd(values, Integer.valueOf(i)));
+        }
+        return array;
+    }
+
+    public static void validState(final boolean expression, final String message, final Object... values) {
+        Exceptions.raiseUnless(expression, IllegalStateException::new, message, values);
+    }
+}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/src/main/java/org/apache/bval/util/reflection/Reflection.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/util/reflection/Reflection.java b/bval-jsr/src/main/java/org/apache/bval/util/reflection/Reflection.java
new file mode 100644
index 0000000..79e88fb
--- /dev/null
+++ b/bval-jsr/src/main/java/org/apache/bval/util/reflection/Reflection.java
@@ -0,0 +1,457 @@
+/*
+ *  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.util.reflection;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Function;
+
+import org.apache.commons.weaver.privilizer.Privilizing;
+
+/**
+ * Security-agnostic "blueprint" class for reflection-related operations. Intended for use by Apache BVal code.
+ */
+public class Reflection {
+    /**
+     * Inclusivity literals for {@link #hierarchy(Class, Interfaces)}.
+     * Taken from commons-lang3.
+     */
+    public enum Interfaces {
+        INCLUDE, EXCLUDE
+    }
+
+    private static final Object[][] NATIVE_CODES = new Object[][]{
+            { byte.class, "byte", "B" },
+            { char.class, "char", "C" },
+            { double.class, "double", "D" },
+            { float.class, "float", "F" },
+            { int.class, "int", "I" },
+            { long.class, "long", "J" },
+            { short.class, "short", "S" },
+            { boolean.class, "boolean", "Z" },
+            { void.class, "void", "V" }
+    };
+
+    /**
+     * Maps primitive {@code Class}es to their corresponding wrapper {@code Class}.
+     */
+    private static final Map<Class<?>, Class<?>> PRIMITIVE_WRAPPER_MAP;
+    static {
+        final Map<Class<?>, Class<?>> m = new HashMap<>();
+        m.put(Boolean.TYPE, Boolean.class);
+        m.put(Byte.TYPE, Byte.class);
+        m.put(Character.TYPE, Character.class);
+        m.put(Short.TYPE, Short.class);
+        m.put(Integer.TYPE, Integer.class);
+        m.put(Long.TYPE, Long.class);
+        m.put(Double.TYPE, Double.class);
+        m.put(Float.TYPE, Float.class);
+        m.put(Void.TYPE, Void.TYPE);
+        PRIMITIVE_WRAPPER_MAP = Collections.unmodifiableMap(m);
+    }
+
+    /**
+     * <p>Converts the specified primitive Class object to its corresponding
+     * wrapper Class object.</p>
+     *
+     * <p>NOTE: From v2.2, this method handles {@code Void.TYPE},
+     * returning {@code Void.TYPE}.</p>
+     *
+     * @param cls  the class to convert, may be null
+     * @return the wrapper class for {@code cls} or {@code cls} if
+     * {@code cls} is not a primitive. {@code null} if null input.
+     * @since 2.1
+     */
+    public static Class<?> primitiveToWrapper(final Class<?> cls) {
+        Class<?> convertedClass = cls;
+        if (cls != null && cls.isPrimitive()) {
+            convertedClass = PRIMITIVE_WRAPPER_MAP.get(cls);
+        }
+        return convertedClass;
+    }
+
+    public static Class<?> wrapperToPrimitive(final Class<?> cls) {
+        for (Map.Entry<Class<?>, Class<?>> primitiveEntry : PRIMITIVE_WRAPPER_MAP.entrySet()) {
+            if (primitiveEntry.getValue().equals(cls)) {
+                return primitiveEntry.getKey();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Get the named value from the specified {@link Annotation}.
+     * @param annotation
+     * @param name
+     * @return Object value
+     * @throws IllegalAccessException
+     * @throws InvocationTargetException
+     */
+    public static Object getAnnotationValue(final Annotation annotation, final String name)
+        throws IllegalAccessException, InvocationTargetException {
+        final Method valueMethod;
+        try {
+            valueMethod = annotation.annotationType().getDeclaredMethod(name);
+        } catch (final NoSuchMethodException ex) {
+            // do nothing
+            return null;
+        }
+        final boolean mustUnset = setAccessible(valueMethod, true);
+        try {
+            return valueMethod.invoke(annotation);
+        } finally {
+            if (mustUnset) {
+                setAccessible(valueMethod, false);
+            }
+        }
+    }
+
+    /**
+     * Get a usable {@link ClassLoader}: that of {@code clazz} if {@link Thread#getContextClassLoader()} returns {@code null}.
+     * @param clazz
+     * @return {@link ClassLoader}
+     */
+    public static ClassLoader getClassLoader(final Class<?> clazz) {
+        final ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        return cl == null ? clazz.getClassLoader() : cl;
+    }
+
+    public static Class<?> toClass(String className) throws ClassNotFoundException {
+        ClassLoader cl = getClassLoader(Reflection.class);
+        return toClass(className, cl);
+    }
+
+    /**
+     * Return the class for the given string, correctly handling
+     * primitive types. If the given class loader is null, the context
+     * loader of the current thread will be used.
+     *
+     * @throws RuntimeException on load error
+     */
+    public static Class<?> toClass(String className, ClassLoader loader) throws ClassNotFoundException {
+        return toClass(className, false, loader);
+    }
+
+    /**
+     * Return the class for the given string, correctly handling
+     * primitive types. If the given class loader is null, the context
+     * loader of the current thread will be used.
+     *
+     * @throws RuntimeException on load error
+     */
+    public static Class<?> toClass(String className, boolean resolve, ClassLoader loader) throws ClassNotFoundException {
+        if (className == null) {
+            throw new NullPointerException("className == null");
+        }
+
+        // array handling
+        int dims = 0;
+        while (className.endsWith("[]")) {
+            dims++;
+            className = className.substring(0, className.length() - 2);
+        }
+
+        // check against primitive types
+        boolean primitive = false;
+        if (className.indexOf('.') == -1) {
+            for (int i = 0; !primitive && (i < NATIVE_CODES.length); i++) {
+                if (NATIVE_CODES[i][1].equals(className)) {
+                    if (dims == 0) {
+                        return (Class<?>) NATIVE_CODES[i][0];
+                    }
+                    className = (String) NATIVE_CODES[i][2];
+                    primitive = true;
+                }
+            }
+        }
+
+        if (dims > 0) {
+            StringBuilder buf = new StringBuilder(className.length() + dims + 2);
+            for (int i = 0; i < dims; i++) {
+                buf.append('[');
+            }
+            if (!primitive) {
+                buf.append('L');
+            }
+            buf.append(className);
+            if (!primitive) {
+                buf.append(';');
+            }
+            className = buf.toString();
+        }
+
+        if (loader == null) {
+            loader = Thread.currentThread().getContextClassLoader();
+        }
+
+        return Class.forName(className, resolve, loader);
+    }
+
+
+    /**
+     * Convenient point for {@link Privilizing} {@link System#getProperty(String)}.
+     * @param name
+     * @return String
+     */
+    public static String getProperty(final String name) {
+        return System.getProperty(name);
+    }
+
+    /**
+     * Get the declared field from {@code clazz}.
+     * @param clazz
+     * @param fieldName
+     * @return {@link Field} or {@code null}
+     */
+    public static Field getDeclaredField(final Class<?> clazz, final String fieldName) {
+        try {
+            return clazz.getDeclaredField(fieldName);
+        } catch (final NoSuchFieldException e) {
+            return null;
+        }
+    }
+
+    /**
+     * Convenient point for {@link Privilizing} {@link Class#getDeclaredFields()}.
+     * @param clazz
+     * @return {@link Field} array
+     */
+    public static Field[] getDeclaredFields(final Class<?> clazz) {
+        return clazz.getDeclaredFields();
+    }
+
+    /**
+     * Get the declared constructor from {@code clazz}.
+     * @param clazz
+     * @param parameters
+     * @return {@link Constructor} or {@code null}
+     */
+    public static <T> Constructor<T> getDeclaredConstructor(final Class<T> clazz, final Class<?>... parameters) {
+        try {
+            return clazz.getDeclaredConstructor(parameters);
+        } catch (final NoSuchMethodException e) {
+            return null;
+        }
+    }
+
+    /**
+     * Get the declared method from {@code clazz}.
+     * @param clazz
+     * @param name
+     * @param parameters
+     * @return {@link Method} or {@code null}
+     */
+    public static Method getDeclaredMethod(final Class<?> clazz, final String name, final Class<?>... parameters) {
+        try {
+            return clazz.getDeclaredMethod(name, parameters);
+        } catch (final NoSuchMethodException e) {
+            return null;
+        }
+    }
+
+    /**
+     * Convenient point for {@link Privilizing} {@link Class#getDeclaredMethods()}.
+     * @param clazz
+     * @return {@link Method} array
+     */
+    public static Method[] getDeclaredMethods(final Class<?> clazz) {
+        return clazz.getDeclaredMethods();
+    }
+
+    /**
+     * Convenient point for {@link Privilizing} {@link Class#getDeclaredConstructors()}.
+     * @param clazz
+     * @return {@link Constructor} array
+     */
+    public static Constructor<?>[] getDeclaredConstructors(final Class<?> clazz) {
+        return clazz.getDeclaredConstructors();
+    }
+
+    /**
+     * Get the specified {@code public} {@link Method} from {@code clazz}.
+     * @param clazz
+     * @param methodName
+     * @return {@link Method} or {@code null}
+     */
+    public static Method getPublicMethod(final Class<?> clazz, final String methodName, Class<?>... parameterTypes) {
+        try {
+            return clazz.getMethod(methodName, parameterTypes);
+        } catch (final NoSuchMethodException e) {
+            return null;
+        }
+    }
+
+    /**
+     * Perform a search against the class hierarchy.
+     * @param clazz
+     * @param search
+     * @return T or {@code null}
+     */
+    public static <T> T find(final Class<?> clazz, Function<Class<?>, T> search) {
+        for (Class<?> t : hierarchy(clazz, Interfaces.INCLUDE)) {
+            final T value = search.apply(t);
+            if (value != null) {
+                return value;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Construct a new instance of {@code cls} using its default constructor.
+     * @param cls
+     * @return T
+     */
+    public static <T> T newInstance(final Class<T> cls) {
+        try {
+            return cls.getConstructor().newInstance();
+        } catch (final Exception ex) {
+            throw new RuntimeException("Cannot instantiate : " + cls, ex);
+        }
+    }
+
+    /**
+     * Set the accessibility of {@code o} to {@code accessible}. If running without a {@link SecurityManager}
+     * and {@code accessible == false}, this call is ignored (because any code could reflectively make any
+     * object accessible at any time).
+     * @param o
+     * @param accessible
+     * @return whether a change was made.
+     */
+    public static boolean setAccessible(final AccessibleObject o, boolean accessible) {
+        if (o == null || o.isAccessible() == accessible) {
+            return false;
+        }
+        if (!accessible && System.getSecurityManager() == null) {
+            return false;
+        }
+        final Member m = (Member) o;
+
+        // For public members whose declaring classes are public, we need do nothing:
+        if (Modifier.isPublic(m.getModifiers()) && Modifier.isPublic(m.getDeclaringClass().getModifiers())) {
+            return false;
+        }
+        o.setAccessible(accessible);
+        return true;
+    }
+
+    /**
+     * Get an {@link Iterable} that can iterate over a class hierarchy in ascending (subclass to superclass) order.
+     * Taken from commons-lang3.
+     *
+     * @param type the type to get the class hierarchy from
+     * @param interfacesBehavior switch indicating whether to include or exclude interfaces
+     * @return Iterable an Iterable over the class hierarchy of the given class
+     */
+    public static Iterable<Class<?>> hierarchy(final Class<?> type, final Interfaces interfacesBehavior) {
+        if (type == null) {
+            return Collections.emptySet();
+        }
+        final Iterable<Class<?>> classes = new Iterable<Class<?>>() {
+
+            @Override
+            public Iterator<Class<?>> iterator() {
+                return new Iterator<Class<?>>() {
+                    Optional<Class<?>> next;
+                    {
+                        next = Optional.of(type);
+                    }
+
+                    @Override
+                    public boolean hasNext() {
+                        return next.isPresent();
+                    }
+
+                    @Override
+                    public Class<?> next() {
+                        final Class<?> result = next.orElseThrow(NoSuchElementException::new);
+                        next = Optional.ofNullable(result.getSuperclass());
+                        return result;
+                    }
+
+                    @Override
+                    public void remove() {
+                        throw new UnsupportedOperationException();
+                    }
+                };
+            }
+        };
+        if (interfacesBehavior != Interfaces.INCLUDE) {
+            return classes;
+        }
+        return new Iterable<Class<?>>() {
+
+            @Override
+            public Iterator<Class<?>> iterator() {
+                final Set<Class<?>> seenInterfaces = new HashSet<Class<?>>();
+                final Iterator<Class<?>> wrapped = classes.iterator();
+    
+                return new Iterator<Class<?>>() {
+                    Iterator<Class<?>> interfaces = Collections.emptyIterator();
+
+                    @Override
+                    public boolean hasNext() {
+                        return interfaces.hasNext() || wrapped.hasNext();
+                    }
+
+                    @Override
+                    public Class<?> next() {
+                        if (interfaces.hasNext()) {
+                            final Class<?> nextInterface = interfaces.next();
+                            seenInterfaces.add(nextInterface);
+                            return nextInterface;
+                        }
+                        final Class<?> nextSuperclass = wrapped.next();
+                        final Set<Class<?>> currentInterfaces = new LinkedHashSet<>();
+                        walkInterfaces(currentInterfaces, nextSuperclass);
+                        interfaces = currentInterfaces.iterator();
+                        return nextSuperclass;
+                    }
+
+                    private void walkInterfaces(final Set<Class<?>> addTo, final Class<?> c) {
+                        for (final Class<?> iface : c.getInterfaces()) {
+                            if (!seenInterfaces.contains(iface)) {
+                                addTo.add(iface);
+                            }
+                            walkInterfaces(addTo, iface);
+                        }
+                    }
+
+                    @Override
+                    public void remove() {
+                        throw new UnsupportedOperationException();
+                    }
+                };
+            }
+        };
+    }
+}


[5/8] bval git commit: remove obsolete modules, moving required core code to jsr

Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/reflection/TypeUtils.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/reflection/TypeUtils.java b/bval-core/src/main/java/org/apache/bval/util/reflection/TypeUtils.java
deleted file mode 100644
index a75e1ad..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/reflection/TypeUtils.java
+++ /dev/null
@@ -1,1557 +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.util.reflection;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Stream;
-
-import org.apache.bval.util.ObjectUtils;
-import org.apache.bval.util.Validate;
-
-/**
- * Taken from commons-lang3.
- *
- * <p> Utility methods focusing on type inspection, particularly with regard to
- * generics. </p>
- *
- * @since 1.1.2
- */
-public class TypeUtils {
-
-    /**
-     * {@link WildcardType} builder.
-     */
-    public static class WildcardTypeBuilder {
-        /**
-         * Constructor
-         */
-        private WildcardTypeBuilder() {
-        }
-        
-        private Type[] upperBounds;
-        private Type[] lowerBounds;
-
-        /**
-         * Specify upper bounds of the wildcard type to build.
-         * @param bounds to set
-         * @return {@code this}
-         */
-        public WildcardTypeBuilder withUpperBounds(final Type... bounds) {
-            this.upperBounds = bounds;
-            return this;
-        }
-
-        /**
-         * Specify lower bounds of the wildcard type to build.
-         * @param bounds to set
-         * @return {@code this}
-         */
-        public WildcardTypeBuilder withLowerBounds(final Type... bounds) {
-            this.lowerBounds = bounds;
-            return this;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public WildcardType build() {
-            return new WildcardTypeImpl(upperBounds, lowerBounds);
-        }
-    }
-
-    /**
-     * ParameterizedType implementation class.
-     */
-    private static final class ParameterizedTypeImpl implements ParameterizedType {
-        private final Class<?> raw;
-        private final Type useOwner;
-        private final Type[] typeArguments;
-
-        /**
-         * Constructor
-         * @param raw type
-         * @param useOwner owner type to use, if any
-         * @param typeArguments formal type arguments
-         */
-        private ParameterizedTypeImpl(final Class<?> raw, final Type useOwner, final Type[] typeArguments) {
-            this.raw = raw;
-            this.useOwner = useOwner;
-            this.typeArguments = typeArguments.clone();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public Type getRawType() {
-            return raw;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public Type getOwnerType() {
-            return useOwner;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public Type[] getActualTypeArguments() {
-            return typeArguments.clone();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public String toString() {
-            return TypeUtils.toString(this);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public boolean equals(final Object obj) {
-            return obj == this || obj instanceof ParameterizedType && TypeUtils.equals(this, ((ParameterizedType) obj));
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public int hashCode() {
-            return Objects.hash(raw, useOwner, typeArguments);
-        }
-    }
-
-    /**
-     * WildcardType implementation class.
-     */
-    private static final class WildcardTypeImpl implements WildcardType {
-        private static final Type[] EMPTY_UPPER_BOUNDS = { Object.class };
-        private static final Type[] EMPTY_LOWER_BOUNDS = new Type[0];
-
-        private final Type[] upperBounds;
-        private final Type[] lowerBounds;
-
-        /**
-         * Constructor
-         * @param upperBounds of this type
-         * @param lowerBounds of this type
-         */
-        private WildcardTypeImpl(final Type[] upperBounds, final Type[] lowerBounds) {
-            this.upperBounds = ObjectUtils.isEmpty(upperBounds) ? EMPTY_UPPER_BOUNDS : upperBounds;
-            this.lowerBounds = lowerBounds == null ? EMPTY_LOWER_BOUNDS : lowerBounds;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public Type[] getUpperBounds() {
-            return upperBounds.clone();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public Type[] getLowerBounds() {
-            return lowerBounds.clone();
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public String toString() {
-            return TypeUtils.toString(this);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public boolean equals(final Object obj) {
-            return obj == this || obj instanceof WildcardType && TypeUtils.equals(this, (WildcardType) obj);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public int hashCode() {
-            return Objects.hash(upperBounds, lowerBounds);
-        }
-    }
-
-    /**
-     * <p>{@code TypeUtils} instances should NOT be constructed in standard
-     * programming. Instead, the class should be used as
-     * {@code TypeUtils.isAssignable(cls, toClass)}.</p> <p>This
-     * constructor is public to permit tools that require a JavaBean instance to
-     * operate.</p>
-     */
-    private TypeUtils() {
-    }
-
-    /**
-     * <p>Checks if the subject type may be implicitly cast to the target type
-     * following the Java generics rules. If both types are {@link Class}
-     * objects, the method returns the result of
-     * {@link Class#isAssignableFrom(Class)}.</p>
-     *
-     * @param type the subject type to be assigned to the target type
-     * @param toType the target type
-     * @return {@code true} if {@code type} is assignable to {@code toType}.
-     */
-    public static boolean isAssignable(final Type type, final Type toType) {
-        return isAssignable(type, toType, null);
-    }
-
-    /**
-     * <p>Checks if the subject type may be implicitly cast to the target type
-     * following the Java generics rules.</p>
-     *
-     * @param type the subject type to be assigned to the target type
-     * @param toType the target type
-     * @param typeVarAssigns optional map of type variable assignments
-     * @return {@code true} if {@code type} is assignable to {@code toType}.
-     */
-    private static boolean isAssignable(final Type type, final Type toType,
-            final Map<TypeVariable<?>, Type> typeVarAssigns) {
-        if (toType == null || toType instanceof Class<?>) {
-            return isAssignable(type, (Class<?>) toType);
-        }
-
-        if (toType instanceof ParameterizedType) {
-            return isAssignable(type, (ParameterizedType) toType, typeVarAssigns);
-        }
-
-        if (toType instanceof GenericArrayType) {
-            return isAssignable(type, (GenericArrayType) toType, typeVarAssigns);
-        }
-
-        if (toType instanceof WildcardType) {
-            return isAssignable(type, (WildcardType) toType, typeVarAssigns);
-        }
-
-        if (toType instanceof TypeVariable<?>) {
-            return isAssignable(type, (TypeVariable<?>) toType, typeVarAssigns);
-        }
-
-        throw new IllegalStateException("found an unhandled type: " + toType);
-    }
-
-    /**
-     * <p>Checks if the subject type may be implicitly cast to the target class
-     * following the Java generics rules.</p>
-     *
-     * @param type the subject type to be assigned to the target type
-     * @param toClass the target class
-     * @return {@code true} if {@code type} is assignable to {@code toClass}.
-     */
-    private static boolean isAssignable(final Type type, final Class<?> toClass) {
-        if (type == null) {
-            // consistency with ClassUtils.isAssignable() behavior
-            return toClass == null || !toClass.isPrimitive();
-        }
-
-        // only a null type can be assigned to null type which
-        // would have cause the previous to return true
-        if (toClass == null) {
-            return false;
-        }
-
-        // all types are assignable to themselves
-        if (toClass.equals(type)) {
-            return true;
-        }
-
-        if (type instanceof Class<?>) {
-            // just comparing two classes
-            // also take primitives into account!
-            return isAssignable((Class<?>) type, toClass);
-        }
-
-        if (type instanceof ParameterizedType) {
-            // only have to compare the raw type to the class
-            return isAssignable(getRawType((ParameterizedType) type), toClass);
-        }
-
-        // *
-        if (type instanceof TypeVariable<?>) {
-            // if any of the bounds are assignable to the class, then the
-            // type is assignable to the class.
-            return Stream.of(((TypeVariable<?>) type).getBounds()).anyMatch(bound -> isAssignable(bound, toClass));
-        }
-
-        // the only classes to which a generic array type can be assigned
-        // are class Object and array classes
-        if (type instanceof GenericArrayType) {
-            return Object.class.equals(toClass)
-                    || toClass.isArray()
-                    && isAssignable(((GenericArrayType) type).getGenericComponentType(), toClass
-                            .getComponentType());
-        }
-
-        // wildcard types are not assignable to a class (though one would think
-        // "? super Object" would be assignable to Object)
-        if (type instanceof WildcardType) {
-            return false;
-        }
-
-        throw new IllegalStateException("found an unhandled type: " + type);
-    }
-
-    private static boolean isAssignable(Class<?> cls, final Class<?> toClass) {
-        if (toClass == null) {
-            return false;
-        }
-        // have to check for null, as isAssignableFrom doesn't
-        if (cls == null) {
-            return !toClass.isPrimitive();
-        }
-
-        if (cls.isPrimitive() && !toClass.isPrimitive()) {
-            cls = Reflection.primitiveToWrapper(cls);
-            if (cls == null) {
-                return false;
-            }
-        }
-        if (toClass.isPrimitive() && !cls.isPrimitive()) {
-            cls = Reflection.wrapperToPrimitive(cls);
-            if (cls == null) {
-                return false;
-            }
-        }
-        if (cls.equals(toClass)) {
-            return true;
-        }
-        if (cls.isPrimitive()) {
-            if (toClass.isPrimitive() == false) {
-                return false;
-            }
-            if (Integer.TYPE.equals(cls)) {
-                return Long.TYPE.equals(toClass)
-                        || Float.TYPE.equals(toClass)
-                        || Double.TYPE.equals(toClass);
-            }
-            if (Long.TYPE.equals(cls)) {
-                return Float.TYPE.equals(toClass)
-                        || Double.TYPE.equals(toClass);
-            }
-            if (Boolean.TYPE.equals(cls)) {
-                return false;
-            }
-            if (Double.TYPE.equals(cls)) {
-                return false;
-            }
-            if (Float.TYPE.equals(cls)) {
-                return Double.TYPE.equals(toClass);
-            }
-            if (Character.TYPE.equals(cls)) {
-                return Integer.TYPE.equals(toClass)
-                        || Long.TYPE.equals(toClass)
-                        || Float.TYPE.equals(toClass)
-                        || Double.TYPE.equals(toClass);
-            }
-            if (Short.TYPE.equals(cls)) {
-                return Integer.TYPE.equals(toClass)
-                        || Long.TYPE.equals(toClass)
-                        || Float.TYPE.equals(toClass)
-                        || Double.TYPE.equals(toClass);
-            }
-            if (Byte.TYPE.equals(cls)) {
-                return Short.TYPE.equals(toClass)
-                        || Integer.TYPE.equals(toClass)
-                        || Long.TYPE.equals(toClass)
-                        || Float.TYPE.equals(toClass)
-                        || Double.TYPE.equals(toClass);
-            }
-            // should never get here
-            return false;
-        }
-        return toClass.isAssignableFrom(cls);
-
-    }
-
-    /**
-     * <p>Checks if the subject type may be implicitly cast to the target
-     * parameterized type following the Java generics rules.</p>
-     *
-     * @param type the subject type to be assigned to the target type
-     * @param toParameterizedType the target parameterized type
-     * @param typeVarAssigns a map with type variables
-     * @return {@code true} if {@code type} is assignable to {@code toType}.
-     */
-    private static boolean isAssignable(final Type type, final ParameterizedType toParameterizedType,
-            final Map<TypeVariable<?>, Type> typeVarAssigns) {
-        if (type == null) {
-            return true;
-        }
-
-        // only a null type can be assigned to null type which
-        // would have cause the previous to return true
-        if (toParameterizedType == null) {
-            return false;
-        }
-
-        // all types are assignable to themselves
-        if (toParameterizedType.equals(type)) {
-            return true;
-        }
-
-        // get the target type's raw type
-        final Class<?> toClass = getRawType(toParameterizedType);
-        // get the subject type's type arguments including owner type arguments
-        // and supertype arguments up to and including the target class.
-        final Map<TypeVariable<?>, Type> fromTypeVarAssigns = getTypeArguments(type, toClass, null);
-
-        // null means the two types are not compatible
-        if (fromTypeVarAssigns == null) {
-            return false;
-        }
-
-        // compatible types, but there's no type arguments. this is equivalent
-        // to comparing Map< ?, ? > to Map, and raw types are always assignable
-        // to parameterized types.
-        if (fromTypeVarAssigns.isEmpty()) {
-            return true;
-        }
-
-        // get the target type's type arguments including owner type arguments
-        final Map<TypeVariable<?>, Type> toTypeVarAssigns = getTypeArguments(toParameterizedType,
-                toClass, typeVarAssigns);
-
-        // now to check each type argument
-        for (final TypeVariable<?> var : toTypeVarAssigns.keySet()) {
-            final Type toTypeArg = unrollVariableAssignments(var, toTypeVarAssigns);
-            final Type fromTypeArg = unrollVariableAssignments(var, fromTypeVarAssigns);
-
-            if (toTypeArg == null && fromTypeArg instanceof Class) {
-                continue;
-            }
-
-            // parameters must either be absent from the subject type, within
-            // the bounds of the wildcard type, or be an exact match to the
-            // parameters of the target type.
-            if (fromTypeArg != null
-                    && !toTypeArg.equals(fromTypeArg)
-                    && !(toTypeArg instanceof WildcardType && isAssignable(fromTypeArg, toTypeArg,
-                            typeVarAssigns))) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Look up {@code var} in {@code typeVarAssigns} <em>transitively</em>,
-     * i.e. keep looking until the value found is <em>not</em> a type variable.
-     * @param var the type variable to look up
-     * @param typeVarAssigns the map used for the look up
-     * @return Type or {@code null} if some variable was not in the map
-     */
-    private static Type unrollVariableAssignments(TypeVariable<?> var, final Map<TypeVariable<?>, Type> typeVarAssigns) {
-        Type result;
-        do {
-            result = typeVarAssigns.get(var);
-            if (result instanceof TypeVariable<?> && !result.equals(var)) {
-                var = (TypeVariable<?>) result;
-                continue;
-            }
-            break;
-        } while (true);
-        return result;
-    }
-
-    /**
-     * <p>Checks if the subject type may be implicitly cast to the target
-     * generic array type following the Java generics rules.</p>
-     *
-     * @param type the subject type to be assigned to the target type
-     * @param toGenericArrayType the target generic array type
-     * @param typeVarAssigns a map with type variables
-     * @return {@code true} if {@code type} is assignable to
-     * {@code toGenericArrayType}.
-     */
-    private static boolean isAssignable(final Type type, final GenericArrayType toGenericArrayType,
-            final Map<TypeVariable<?>, Type> typeVarAssigns) {
-        if (type == null) {
-            return true;
-        }
-
-        // only a null type can be assigned to null type which
-        // would have cause the previous to return true
-        if (toGenericArrayType == null) {
-            return false;
-        }
-
-        // all types are assignable to themselves
-        if (toGenericArrayType.equals(type)) {
-            return true;
-        }
-
-        final Type toComponentType = toGenericArrayType.getGenericComponentType();
-
-        if (type instanceof Class<?>) {
-            final Class<?> cls = (Class<?>) type;
-
-            // compare the component types
-            return cls.isArray()
-                    && isAssignable(cls.getComponentType(), toComponentType, typeVarAssigns);
-        }
-
-        if (type instanceof GenericArrayType) {
-            // compare the component types
-            return isAssignable(((GenericArrayType) type).getGenericComponentType(),
-                    toComponentType, typeVarAssigns);
-        }
-
-        if (type instanceof WildcardType) {
-            // so long as one of the upper bounds is assignable, it's good
-            return Stream.of(getImplicitUpperBounds((WildcardType) type))
-                .anyMatch(bound -> isAssignable(bound, toGenericArrayType));
-        }
-
-        if (type instanceof TypeVariable<?>) {
-            // probably should remove the following logic and just return false.
-            // type variables cannot specify arrays as bounds.
-            return Stream.of(getImplicitBounds((TypeVariable<?>) type))
-                .anyMatch(bound -> isAssignable(bound, toGenericArrayType));
-        }
-
-        if (type instanceof ParameterizedType) {
-            // the raw type of a parameterized type is never an array or
-            // generic array, otherwise the declaration would look like this:
-            // Collection[]< ? extends String > collection;
-            return false;
-        }
-
-        throw new IllegalStateException("found an unhandled type: " + type);
-    }
-
-    /**
-     * <p>Checks if the subject type may be implicitly cast to the target
-     * wildcard type following the Java generics rules.</p>
-     *
-     * @param type the subject type to be assigned to the target type
-     * @param toWildcardType the target wildcard type
-     * @param typeVarAssigns a map with type variables
-     * @return {@code true} if {@code type} is assignable to
-     * {@code toWildcardType}.
-     */
-    private static boolean isAssignable(final Type type, final WildcardType toWildcardType,
-            final Map<TypeVariable<?>, Type> typeVarAssigns) {
-        if (type == null) {
-            return true;
-        }
-
-        // only a null type can be assigned to null type which
-        // would have cause the previous to return true
-        if (toWildcardType == null) {
-            return false;
-        }
-
-        // all types are assignable to themselves
-        if (toWildcardType.equals(type)) {
-            return true;
-        }
-
-        final Type[] toUpperBounds = getImplicitUpperBounds(toWildcardType);
-        final Type[] toLowerBounds = getImplicitLowerBounds(toWildcardType);
-
-        if (type instanceof WildcardType) {
-            final WildcardType wildcardType = (WildcardType) type;
-            final Type[] upperBounds = getImplicitUpperBounds(wildcardType);
-            final Type[] lowerBounds = getImplicitLowerBounds(wildcardType);
-
-            for (Type toBound : toUpperBounds) {
-                // if there are assignments for unresolved type variables,
-                // now's the time to substitute them.
-                toBound = substituteTypeVariables(toBound, typeVarAssigns);
-
-                // each upper bound of the subject type has to be assignable to
-                // each
-                // upper bound of the target type
-                for (final Type bound : upperBounds) {
-                    if (!isAssignable(bound, toBound, typeVarAssigns)) {
-                        return false;
-                    }
-                }
-            }
-
-            for (Type toBound : toLowerBounds) {
-                // if there are assignments for unresolved type variables,
-                // now's the time to substitute them.
-                toBound = substituteTypeVariables(toBound, typeVarAssigns);
-
-                // each lower bound of the target type has to be assignable to
-                // each
-                // lower bound of the subject type
-                for (final Type bound : lowerBounds) {
-                    if (!isAssignable(toBound, bound, typeVarAssigns)) {
-                        return false;
-                    }
-                }
-            }
-            return true;
-        }
-
-        for (final Type toBound : toUpperBounds) {
-            // if there are assignments for unresolved type variables,
-            // now's the time to substitute them.
-            if (!isAssignable(type, substituteTypeVariables(toBound, typeVarAssigns),
-                    typeVarAssigns)) {
-                return false;
-            }
-        }
-
-        for (final Type toBound : toLowerBounds) {
-            // if there are assignments for unresolved type variables,
-            // now's the time to substitute them.
-            if (!isAssignable(substituteTypeVariables(toBound, typeVarAssigns), type,
-                    typeVarAssigns)) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * <p>Checks if the subject type may be implicitly cast to the target type
-     * variable following the Java generics rules.</p>
-     *
-     * @param type the subject type to be assigned to the target type
-     * @param toTypeVariable the target type variable
-     * @param typeVarAssigns a map with type variables
-     * @return {@code true} if {@code type} is assignable to
-     * {@code toTypeVariable}.
-     */
-    private static boolean isAssignable(final Type type, final TypeVariable<?> toTypeVariable,
-            final Map<TypeVariable<?>, Type> typeVarAssigns) {
-        if (type == null) {
-            return true;
-        }
-
-        // only a null type can be assigned to null type which
-        // would have cause the previous to return true
-        if (toTypeVariable == null) {
-            return false;
-        }
-
-        // all types are assignable to themselves
-        if (toTypeVariable.equals(type)) {
-            return true;
-        }
-
-        if (type instanceof TypeVariable<?>) {
-            // a type variable is assignable to another type variable, if
-            // and only if the former is the latter, extends the latter, or
-            // is otherwise a descendant of the latter.
-            final Type[] bounds = getImplicitBounds((TypeVariable<?>) type);
-
-            for (final Type bound : bounds) {
-                if (isAssignable(bound, toTypeVariable, typeVarAssigns)) {
-                    return true;
-                }
-            }
-        }
-
-        if (type instanceof Class<?> || type instanceof ParameterizedType
-                || type instanceof GenericArrayType || type instanceof WildcardType) {
-            return false;
-        }
-
-        throw new IllegalStateException("found an unhandled type: " + type);
-    }
-
-    /**
-     * <p>Find the mapping for {@code type} in {@code typeVarAssigns}.</p>
-     *
-     * @param type the type to be replaced
-     * @param typeVarAssigns the map with type variables
-     * @return the replaced type
-     * @throws IllegalArgumentException if the type cannot be substituted
-     */
-    private static Type substituteTypeVariables(final Type type, final Map<TypeVariable<?>, Type> typeVarAssigns) {
-        if (type instanceof TypeVariable<?> && typeVarAssigns != null) {
-            final Type replacementType = typeVarAssigns.get(type);
-
-            if (replacementType == null) {
-                throw new IllegalArgumentException("missing assignment type for type variable "
-                        + type);
-            }
-            return replacementType;
-        }
-        return type;
-    }
-
-    /**
-     * <p>Retrieves all the type arguments for this parameterized type
-     * including owner hierarchy arguments such as
-     * {@code Outer<K,V>.Inner<T>.DeepInner<E>} .
-     * The arguments are returned in a
-     * {@link Map} specifying the argument type for each {@link TypeVariable}.
-     * </p>
-     *
-     * @param type specifies the subject parameterized type from which to
-     *             harvest the parameters.
-     * @return a {@code Map} of the type arguments to their respective type
-     * variables.
-     */
-    public static Map<TypeVariable<?>, Type> getTypeArguments(final ParameterizedType type) {
-        return getTypeArguments(type, getRawType(type), null);
-    }
-
-    /**
-     * <p>Gets the type arguments of a class/interface based on a subtype. For
-     * instance, this method will determine that both of the parameters for the
-     * interface {@link Map} are {@link Object} for the subtype
-     * {@link java.util.Properties Properties} even though the subtype does not
-     * directly implement the {@code Map} interface.</p>
-     * <p>This method returns {@code null} if {@code type} is not assignable to
-     * {@code toClass}. It returns an empty map if none of the classes or
-     * interfaces in its inheritance hierarchy specify any type arguments.</p>
-     * <p>A side effect of this method is that it also retrieves the type
-     * arguments for the classes and interfaces that are part of the hierarchy
-     * between {@code type} and {@code toClass}. So with the above
-     * example, this method will also determine that the type arguments for
-     * {@link java.util.Hashtable Hashtable} are also both {@code Object}.
-     * In cases where the interface specified by {@code toClass} is
-     * (indirectly) implemented more than once (e.g. where {@code toClass}
-     * specifies the interface {@link Iterable Iterable} and
-     * {@code type} specifies a parameterized type that implements both
-     * {@link Set Set} and {@link java.util.Collection Collection}),
-     * this method will look at the inheritance hierarchy of only one of the
-     * implementations/subclasses; the first interface encountered that isn't a
-     * subinterface to one of the others in the {@code type} to
-     * {@code toClass} hierarchy.</p>
-     *
-     * @param type the type from which to determine the type parameters of
-     * {@code toClass}
-     * @param toClass the class whose type parameters are to be determined based
-     * on the subtype {@code type}
-     * @return a {@code Map} of the type assignments for the type variables in
-     * each type in the inheritance hierarchy from {@code type} to
-     * {@code toClass} inclusive.
-     */
-    public static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass) {
-        return getTypeArguments(type, toClass, null);
-    }
-
-    /**
-     * <p>Return a map of the type arguments of @{code type} in the context of {@code toClass}.</p>
-     *
-     * @param type the type in question
-     * @param toClass the class
-     * @param subtypeVarAssigns a map with type variables
-     * @return the {@code Map} with type arguments
-     */
-    private static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass,
-            final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
-        if (type instanceof Class<?>) {
-            return getTypeArguments((Class<?>) type, toClass, subtypeVarAssigns);
-        }
-
-        if (type instanceof ParameterizedType) {
-            return getTypeArguments((ParameterizedType) type, toClass, subtypeVarAssigns);
-        }
-
-        if (type instanceof GenericArrayType) {
-            return getTypeArguments(((GenericArrayType) type).getGenericComponentType(), toClass
-                    .isArray() ? toClass.getComponentType() : toClass, subtypeVarAssigns);
-        }
-
-        // since wildcard types are not assignable to classes, should this just
-        // return null?
-        if (type instanceof WildcardType) {
-            for (final Type bound : getImplicitUpperBounds((WildcardType) type)) {
-                // find the first bound that is assignable to the target class
-                if (isAssignable(bound, toClass)) {
-                    return getTypeArguments(bound, toClass, subtypeVarAssigns);
-                }
-            }
-
-            return null;
-        }
-
-        if (type instanceof TypeVariable<?>) {
-            for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) {
-                // find the first bound that is assignable to the target class
-                if (isAssignable(bound, toClass)) {
-                    return getTypeArguments(bound, toClass, subtypeVarAssigns);
-                }
-            }
-
-            return null;
-        }
-        throw new IllegalStateException("found an unhandled type: " + type);
-    }
-
-    /**
-     * <p>Return a map of the type arguments of a parameterized type in the context of {@code toClass}.</p>
-     *
-     * @param parameterizedType the parameterized type
-     * @param toClass the class
-     * @param subtypeVarAssigns a map with type variables
-     * @return the {@code Map} with type arguments
-     */
-    private static Map<TypeVariable<?>, Type> getTypeArguments(
-            final ParameterizedType parameterizedType, final Class<?> toClass,
-            final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
-        final Class<?> cls = getRawType(parameterizedType);
-
-        // make sure they're assignable
-        if (!isAssignable(cls, toClass)) {
-            return null;
-        }
-
-        final Type ownerType = parameterizedType.getOwnerType();
-        Map<TypeVariable<?>, Type> typeVarAssigns;
-
-        if (ownerType instanceof ParameterizedType) {
-            // get the owner type arguments first
-            final ParameterizedType parameterizedOwnerType = (ParameterizedType) ownerType;
-            typeVarAssigns = getTypeArguments(parameterizedOwnerType,
-                    getRawType(parameterizedOwnerType), subtypeVarAssigns);
-        } else {
-            // no owner, prep the type variable assignments map
-            typeVarAssigns = subtypeVarAssigns == null ? new HashMap<>() : new HashMap<>(subtypeVarAssigns);
-        }
-
-        // get the subject parameterized type's arguments
-        final Type[] typeArgs = parameterizedType.getActualTypeArguments();
-        // and get the corresponding type variables from the raw class
-        final TypeVariable<?>[] typeParams = cls.getTypeParameters();
-
-        // map the arguments to their respective type variables
-        for (int i = 0; i < typeParams.length; i++) {
-            final Type typeArg = typeArgs[i];
-            typeVarAssigns.put(typeParams[i], typeVarAssigns.containsKey(typeArg) ? typeVarAssigns
-                    .get(typeArg) : typeArg);
-        }
-
-        if (toClass.equals(cls)) {
-            // target class has been reached. Done.
-            return typeVarAssigns;
-        }
-
-        // walk the inheritance hierarchy until the target class is reached
-        return getTypeArguments(getClosestParentType(cls, toClass), toClass, typeVarAssigns);
-    }
-
-    /**
-     * <p>Return a map of the type arguments of a class in the context of @{code toClass}.</p>
-     *
-     * @param cls the class in question
-     * @param toClass the context class
-     * @param subtypeVarAssigns a map with type variables
-     * @return the {@code Map} with type arguments
-     */
-    private static Map<TypeVariable<?>, Type> getTypeArguments(Class<?> cls, final Class<?> toClass,
-            final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
-        // make sure they're assignable
-        if (!isAssignable(cls, toClass)) {
-            return null;
-        }
-
-        // can't work with primitives
-        if (cls.isPrimitive()) {
-            // both classes are primitives?
-            if (toClass.isPrimitive()) {
-                // dealing with widening here. No type arguments to be
-                // harvested with these two types.
-                return new HashMap<>();
-            }
-
-            // work with wrapper the wrapper class instead of the primitive
-            cls = Reflection.primitiveToWrapper(cls);
-        }
-
-        // create a copy of the incoming map, or an empty one if it's null
-        final Map<TypeVariable<?>, Type> typeVarAssigns =
-            subtypeVarAssigns == null ? new HashMap<>() : new HashMap<>(subtypeVarAssigns);
-
-        // has target class been reached?
-        if (toClass.equals(cls)) {
-            return typeVarAssigns;
-        }
-
-        // walk the inheritance hierarchy until the target class is reached
-        return getTypeArguments(getClosestParentType(cls, toClass), toClass, typeVarAssigns);
-    }
-
-    /**
-     * <p>Get the closest parent type to the
-     * super class specified by {@code superClass}.</p>
-     *
-     * @param cls the class in question
-     * @param superClass the super class
-     * @return the closes parent type
-     */
-    private static Type getClosestParentType(final Class<?> cls, final Class<?> superClass) {
-        // only look at the interfaces if the super class is also an interface
-        if (superClass.isInterface()) {
-            // get the generic interfaces of the subject class
-            final Type[] interfaceTypes = cls.getGenericInterfaces();
-            // will hold the best generic interface match found
-            Type genericInterface = null;
-
-            // find the interface closest to the super class
-            for (final Type midType : interfaceTypes) {
-                Class<?> midClass = null;
-
-                if (midType instanceof ParameterizedType) {
-                    midClass = getRawType((ParameterizedType) midType);
-                } else if (midType instanceof Class<?>) {
-                    midClass = (Class<?>) midType;
-                } else {
-                    throw new IllegalStateException("Unexpected generic"
-                            + " interface type found: " + midType);
-                }
-
-                // check if this interface is further up the inheritance chain
-                // than the previously found match
-                if (isAssignable(midClass, superClass)
-                        && isAssignable(genericInterface, (Type) midClass)) {
-                    genericInterface = midType;
-                }
-            }
-
-            // found a match?
-            if (genericInterface != null) {
-                return genericInterface;
-            }
-        }
-
-        // none of the interfaces were descendants of the target class, so the
-        // super class has to be one, instead
-        return cls.getGenericSuperclass();
-    }
-
-    /**
-     * <p>Checks if the given value can be assigned to the target type
-     * following the Java generics rules.</p>
-     *
-     * @param value the value to be checked
-     * @param type the target type
-     * @return {@code true} if {@code value} is an instance of {@code type}.
-     */
-    public static boolean isInstance(final Object value, final Type type) {
-        if (type == null) {
-            return false;
-        }
-
-        return value == null ? !(type instanceof Class<?>) || type == void.class || !((Class<?>) type).isPrimitive()
-                : isAssignable(value.getClass(), type, null);
-    }
-
-    /**
-     * <p>This method strips out the redundant upper bound types in type
-     * variable types and wildcard types (or it would with wildcard types if
-     * multiple upper bounds were allowed).</p> <p>Example, with the variable
-     * type declaration:
-     *
-     * <pre>&lt;K extends java.util.Collection&lt;String&gt; &amp;
-     * java.util.List&lt;String&gt;&gt;</pre>
-     *
-     * <p>
-     * since {@code List} is a subinterface of {@code Collection},
-     * this method will return the bounds as if the declaration had been:
-     * </p>
-     *
-     * <pre>&lt;K extends java.util.List&lt;String&gt;&gt;</pre>
-     *
-     * @param bounds an array of types representing the upper bounds of either
-     * {@link WildcardType} or {@link TypeVariable}, not {@code null}.
-     * @return an array containing the values from {@code bounds} minus the
-     * redundant types.
-     */
-    public static Type[] normalizeUpperBounds(final Type[] bounds) {
-        Validate.notNull(bounds, "null value specified for bounds array");
-        // don't bother if there's only one (or none) type
-        if (bounds.length < 2) {
-            return bounds;
-        }
-
-        final Set<Type> types = new HashSet<>(bounds.length);
-
-        for (final Type type1 : bounds) {
-            boolean subtypeFound = false;
-
-            for (final Type type2 : bounds) {
-                if (type1 != type2 && isAssignable(type2, type1, null)) {
-                    subtypeFound = true;
-                    break;
-                }
-            }
-
-            if (!subtypeFound) {
-                types.add(type1);
-            }
-        }
-
-        return types.toArray(new Type[types.size()]);
-    }
-
-    /**
-     * <p>Returns an array containing the sole type of {@link Object} if
-     * {@link TypeVariable#getBounds()} returns an empty array. Otherwise, it
-     * returns the result of {@link TypeVariable#getBounds()} passed into
-     * {@link #normalizeUpperBounds}.</p>
-     *
-     * @param typeVariable the subject type variable, not {@code null}
-     * @return a non-empty array containing the bounds of the type variable.
-     */
-    public static Type[] getImplicitBounds(final TypeVariable<?> typeVariable) {
-        Validate.notNull(typeVariable, "typeVariable is null");
-        final Type[] bounds = typeVariable.getBounds();
-
-        return bounds.length == 0 ? new Type[] { Object.class } : normalizeUpperBounds(bounds);
-    }
-
-    /**
-     * <p>Returns an array containing the sole value of {@link Object} if
-     * {@link WildcardType#getUpperBounds()} returns an empty array. Otherwise,
-     * it returns the result of {@link WildcardType#getUpperBounds()}
-     * passed into {@link #normalizeUpperBounds}.</p>
-     *
-     * @param wildcardType the subject wildcard type, not {@code null}
-     * @return a non-empty array containing the upper bounds of the wildcard
-     * type.
-     */
-    public static Type[] getImplicitUpperBounds(final WildcardType wildcardType) {
-        Validate.notNull(wildcardType, "wildcardType is null");
-        final Type[] bounds = wildcardType.getUpperBounds();
-
-        return bounds.length == 0 ? new Type[] { Object.class } : normalizeUpperBounds(bounds);
-    }
-
-    /**
-     * <p>Returns an array containing a single value of {@code null} if
-     * {@link WildcardType#getLowerBounds()} returns an empty array. Otherwise,
-     * it returns the result of {@link WildcardType#getLowerBounds()}.</p>
-     *
-     * @param wildcardType the subject wildcard type, not {@code null}
-     * @return a non-empty array containing the lower bounds of the wildcard
-     * type.
-     */
-    public static Type[] getImplicitLowerBounds(final WildcardType wildcardType) {
-        Validate.notNull(wildcardType, "wildcardType is null");
-        final Type[] bounds = wildcardType.getLowerBounds();
-
-        return bounds.length == 0 ? new Type[] { null } : bounds;
-    }
-
-    /**
-     * <p>Transforms the passed in type to a {@link Class} object. Type-checking method of convenience.</p>
-     *
-     * @param parameterizedType the type to be converted
-     * @return the corresponding {@code Class} object
-     * @throws IllegalStateException if the conversion fails
-     */
-    private static Class<?> getRawType(final ParameterizedType parameterizedType) {
-        final Type rawType = parameterizedType.getRawType();
-
-        // check if raw type is a Class object
-        // not currently necessary, but since the return type is Type instead of
-        // Class, there's enough reason to believe that future versions of Java
-        // may return other Type implementations. And type-safety checking is
-        // rarely a bad idea.
-        if (!(rawType instanceof Class<?>)) {
-            throw new IllegalStateException("Wait... What!? Type of rawType: " + rawType);
-        }
-
-        return (Class<?>) rawType;
-    }
-
-    /**
-     * <p>Get the raw type of a Java type, given its context. Primarily for use
-     * with {@link TypeVariable}s and {@link GenericArrayType}s, or when you do
-     * not know the runtime type of {@code type}: if you know you have a
-     * {@link Class} instance, it is already raw; if you know you have a
-     * {@link ParameterizedType}, its raw type is only a method call away.</p>
-     *
-     * @param type to resolve
-     * @param assigningType type to be resolved against
-     * @return the resolved {@link Class} object or {@code null} if
-     * the type could not be resolved
-     */
-    public static Class<?> getRawType(final Type type, final Type assigningType) {
-        if (type instanceof Class<?>) {
-            // it is raw, no problem
-            return (Class<?>) type;
-        }
-
-        if (type instanceof ParameterizedType) {
-            // simple enough to get the raw type of a ParameterizedType
-            return getRawType((ParameterizedType) type);
-        }
-
-        if (type instanceof TypeVariable<?>) {
-            if (assigningType == null) {
-                return null;
-            }
-
-            // get the entity declaring this type variable
-            final Object genericDeclaration = ((TypeVariable<?>) type).getGenericDeclaration();
-
-            // can't get the raw type of a method- or constructor-declared type
-            // variable
-            if (!(genericDeclaration instanceof Class<?>)) {
-                return null;
-            }
-
-            // get the type arguments for the declaring class/interface based
-            // on the enclosing type
-            final Map<TypeVariable<?>, Type> typeVarAssigns = getTypeArguments(assigningType,
-                    (Class<?>) genericDeclaration);
-
-            // enclosingType has to be a subclass (or subinterface) of the
-            // declaring type
-            if (typeVarAssigns == null) {
-                return null;
-            }
-
-            // get the argument assigned to this type variable
-            final Type typeArgument = typeVarAssigns.get(type);
-
-            if (typeArgument == null) {
-                return null;
-            }
-
-            // get the argument for this type variable
-            return getRawType(typeArgument, assigningType);
-        }
-
-        if (type instanceof GenericArrayType) {
-            // get raw component type
-            final Class<?> rawComponentType = getRawType(((GenericArrayType) type)
-                    .getGenericComponentType(), assigningType);
-
-            // create array type from raw component type and return its class
-            return Array.newInstance(rawComponentType, 0).getClass();
-        }
-
-        // (hand-waving) this is not the method you're looking for
-        if (type instanceof WildcardType) {
-            return null;
-        }
-
-        throw new IllegalArgumentException("unknown type: " + type);
-    }
-
-    /**
-     * Learn whether the specified type denotes an array type.
-     * @param type the type to be checked
-     * @return {@code true} if {@code type} is an array class or a {@link GenericArrayType}.
-     */
-    public static boolean isArrayType(final Type type) {
-        return type instanceof GenericArrayType || type instanceof Class<?> && ((Class<?>) type).isArray();
-    }
-
-    /**
-     * Get the array component type of {@code type}.
-     * @param type the type to be checked
-     * @return component type or null if type is not an array type
-     */
-    public static Type getArrayComponentType(final Type type) {
-        if (type instanceof Class<?>) {
-            final Class<?> clazz = (Class<?>) type;
-            return clazz.isArray() ? clazz.getComponentType() : null;
-        }
-        if (type instanceof GenericArrayType) {
-            return ((GenericArrayType) type).getGenericComponentType();
-        }
-        return null;
-    }
-
-    /**
-     * Get a type representing {@code type} with variable assignments "unrolled."
-     *
-     * @param typeArguments as from {@link TypeUtils#getTypeArguments(Type, Class)}
-     * @param type the type to unroll variable assignments for
-     * @return Type
-     */
-    public static Type unrollVariables(Map<TypeVariable<?>, Type> typeArguments, final Type type) {
-        if (typeArguments == null) {
-            typeArguments = Collections.<TypeVariable<?>, Type> emptyMap();
-        }
-        if (containsTypeVariables(type)) {
-            if (type instanceof TypeVariable<?>) {
-                return unrollVariables(typeArguments, typeArguments.get(type));
-            }
-            if (type instanceof ParameterizedType) {
-                final ParameterizedType p = (ParameterizedType) type;
-                final Map<TypeVariable<?>, Type> parameterizedTypeArguments;
-                if (p.getOwnerType() == null) {
-                    parameterizedTypeArguments = typeArguments;
-                } else {
-                    parameterizedTypeArguments = new HashMap<>(typeArguments);
-                    parameterizedTypeArguments.putAll(TypeUtils.getTypeArguments(p));
-                }
-                final Type[] args = p.getActualTypeArguments();
-                for (int i = 0; i < args.length; i++) {
-                    final Type unrolled = unrollVariables(parameterizedTypeArguments, args[i]);
-                    if (unrolled != null) {
-                        args[i] = unrolled;
-                    }
-                }
-                return parameterizeWithOwner(p.getOwnerType(), (Class<?>) p.getRawType(), args);
-            }
-            if (type instanceof WildcardType) {
-                final WildcardType wild = (WildcardType) type;
-                return wildcardType().withUpperBounds(unrollBounds(typeArguments, wild.getUpperBounds()))
-                    .withLowerBounds(unrollBounds(typeArguments, wild.getLowerBounds())).build();
-            }
-        }
-        return type;
-    }
-
-    /**
-     * Local helper method to unroll variables in a type bounds array.
-     * 
-     * @param typeArguments assignments {@link Map}
-     * @param bounds in which to expand variables
-     * @return {@code bounds} with any variables reassigned
-     */
-    private static Type[] unrollBounds(final Map<TypeVariable<?>, Type> typeArguments, final Type[] bounds) {
-        Type[] result = bounds;
-        int i = 0;
-        for (; i < result.length; i++) {
-            final Type unrolled = unrollVariables(typeArguments, result[i]);
-            if (unrolled == null) {
-                List<Type> types = Arrays.asList(result);
-                types.remove(i--);
-                result = types.toArray(new Type[types.size()]);
-            } else {
-                result[i] = unrolled;
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Learn, recursively, whether any of the type parameters associated with {@code type} are bound to variables.
-     *
-     * @param type the type to check for type variables
-     * @return boolean
-     */
-    public static boolean containsTypeVariables(final Type type) {
-        if (type instanceof TypeVariable<?>) {
-            return true;
-        }
-        if (type instanceof Class<?>) {
-            return ((Class<?>) type).getTypeParameters().length > 0;
-        }
-        if (type instanceof ParameterizedType) {
-            for (final Type arg : ((ParameterizedType) type).getActualTypeArguments()) {
-                if (containsTypeVariables(arg)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-        if (type instanceof WildcardType) {
-            final WildcardType wild = (WildcardType) type;
-            return containsTypeVariables(TypeUtils.getImplicitLowerBounds(wild)[0])
-                || containsTypeVariables(TypeUtils.getImplicitUpperBounds(wild)[0]);
-        }
-        return false;
-    }
-
-
-    /**
-     * Create a parameterized type instance.
-     *
-     * @param owner the owning type
-     * @param raw the raw class to create a parameterized type instance for
-     * @param typeArguments the types used for parameterization
-     *
-     * @return {@link ParameterizedType}
-     */
-    public static final ParameterizedType parameterizeWithOwner(final Type owner, final Class<?> raw,
-        final Type... typeArguments) {
-        Validate.notNull(raw, "raw class is null");
-        final Type useOwner;
-        if (raw.getEnclosingClass() == null) {
-            Validate.isTrue(owner == null, "no owner allowed for top-level %s", raw);
-            useOwner = null;
-        } else if (owner == null) {
-            useOwner = raw.getEnclosingClass();
-        } else {
-            Validate.isTrue(TypeUtils.isAssignable(owner, raw.getEnclosingClass()),
-                "%s is invalid owner type for parameterized %s", owner, raw);
-            useOwner = owner;
-        }
-        Validate.isTrue(raw.getTypeParameters().length == typeArguments.length,
-            "invalid number of type parameters specified: expected %d, got %d", raw.getTypeParameters().length,
-            typeArguments.length);
-
-        return new ParameterizedTypeImpl(raw, useOwner, typeArguments);
-    }
-
-    /**
-     * Get a {@link WildcardTypeBuilder}.
-     * @return {@link WildcardTypeBuilder}
-     */
-    public static WildcardTypeBuilder wildcardType() {
-        return new WildcardTypeBuilder();
-    }
-
-    /**
-     * Check equality of types.
-     *
-     * @param t1 the first type
-     * @param t2 the second type
-     * @return boolean
-     */
-    public static boolean equals(final Type t1, final Type t2) {
-        if (t1 == t2) {
-            return true;
-        }
-        if (t1 == null || t2 == null) {
-            return false;
-        }
-
-        if (t1.equals(t2)) {
-            return true;
-        }
-        if (t1 instanceof ParameterizedType) {
-            return equals((ParameterizedType) t1, t2);
-        }
-        if (t1 instanceof GenericArrayType) {
-            return equals((GenericArrayType) t1, t2);
-        }
-        if (t1 instanceof WildcardType) {
-            return equals((WildcardType) t1, t2);
-        }
-        return false;
-    }
-
-    /**
-     * Learn whether {@code t} equals {@code p}.
-     * @param p LHS
-     * @param t RHS
-     * @return boolean
-     */
-    private static boolean equals(final ParameterizedType p, final Type t) {
-        if (t instanceof ParameterizedType) {
-            final ParameterizedType other = (ParameterizedType) t;
-            if (equals(p.getRawType(), other.getRawType()) && equals(p.getOwnerType(), other.getOwnerType())) {
-                return equals(p.getActualTypeArguments(), other.getActualTypeArguments());
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Learn whether {@code t} equals {@code a}.
-     * @param a LHS
-     * @param t RHS
-     * @return boolean
-     */
-    private static boolean equals(final GenericArrayType a, final Type t) {
-        return t instanceof GenericArrayType
-            && equals(a.getGenericComponentType(), ((GenericArrayType) t).getGenericComponentType());
-    }
-
-    /**
-     * Learn whether {@code t} equals {@code w}.
-     * @param w LHS
-     * @param t RHS
-     * @return boolean
-     */
-    private static boolean equals(final WildcardType w, final Type t) {
-        if (t instanceof WildcardType) {
-            final WildcardType other = (WildcardType) t;
-            return equals(getImplicitLowerBounds(w), getImplicitLowerBounds(other))
-                && equals(getImplicitUpperBounds(w), getImplicitUpperBounds(other));
-        }
-        return false;
-    }
-
-    /**
-     * Learn whether {@code t1} equals {@code t2}.
-     * @param t1 LHS
-     * @param t2 RHS
-     * @return boolean
-     */
-    private static boolean equals(final Type[] t1, final Type[] t2) {
-        if (t1.length == t2.length) {
-            for (int i = 0; i < t1.length; i++) {
-                if (!equals(t1[i], t2[i])) {
-                    return false;
-                }
-            }
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Present a given type as a Java-esque String.
-     *
-     * @param type the type to create a String representation for, not {@code null}
-     * @return String
-     */
-    public static String toString(final Type type) {
-        Validate.notNull(type);
-        if (type instanceof Class<?>) {
-            return classToString((Class<?>) type);
-        }
-        if (type instanceof ParameterizedType) {
-            return parameterizedTypeToString((ParameterizedType) type);
-        }
-        if (type instanceof WildcardType) {
-            return wildcardTypeToString((WildcardType) type);
-        }
-        if (type instanceof TypeVariable<?>) {
-            return typeVariableToString((TypeVariable<?>) type);
-        }
-        if (type instanceof GenericArrayType) {
-            return genericArrayTypeToString((GenericArrayType) type);
-        }
-        throw new IllegalArgumentException(type.toString());
-    }
-
-
-    /**
-     * Format a {@link Class} as a {@link String}.
-     * @param c {@code Class} to format
-     * @return String
-     */
-    private static String classToString(final Class<?> c) {
-        final StringBuilder buf = new StringBuilder();
-
-        if (c.getEnclosingClass() != null) {
-            buf.append(classToString(c.getEnclosingClass())).append('.').append(c.getSimpleName());
-        } else {
-            buf.append(c.getName());
-        }
-        if (c.getTypeParameters().length > 0) {
-            buf.append('<');
-            appendAllTo(buf, ", ", c.getTypeParameters());
-            buf.append('>');
-        }
-        return buf.toString();
-    }
-
-    /**
-     * Format a {@link TypeVariable} as a {@link String}.
-     * @param v {@code TypeVariable} to format
-     * @return String
-     */
-    private static String typeVariableToString(final TypeVariable<?> v) {
-        final StringBuilder buf = new StringBuilder(v.getName());
-        final Type[] bounds = v.getBounds();
-        if (bounds.length > 0 && !(bounds.length == 1 && Object.class.equals(bounds[0]))) {
-            buf.append(" extends ");
-            appendAllTo(buf, " & ", v.getBounds());
-        }
-        return buf.toString();
-    }
-
-    /**
-     * Format a {@link ParameterizedType} as a {@link String}.
-     * @param p {@code ParameterizedType} to format
-     * @return String
-     */
-    private static String parameterizedTypeToString(final ParameterizedType p) {
-        final StringBuilder buf = new StringBuilder();
-
-        final Type useOwner = p.getOwnerType();
-        final Class<?> raw = (Class<?>) p.getRawType();
-        final Type[] typeArguments = p.getActualTypeArguments();
-        if (useOwner == null) {
-            buf.append(raw.getName());
-        } else {
-            if (useOwner instanceof Class<?>) {
-                buf.append(((Class<?>) useOwner).getName());
-            } else {
-                buf.append(useOwner.toString());
-            }
-            buf.append('.').append(raw.getSimpleName());
-        }
-
-        appendAllTo(buf.append('<'), ", ", typeArguments).append('>');
-        return buf.toString();
-    }
-
-    /**
-     * Format a {@link WildcardType} as a {@link String}.
-     * @param w {@code WildcardType} to format
-     * @return String
-     */
-    private static String wildcardTypeToString(final WildcardType w) {
-        final StringBuilder buf = new StringBuilder().append('?');
-        final Type[] lowerBounds = w.getLowerBounds();
-        final Type[] upperBounds = w.getUpperBounds();
-        if (lowerBounds.length > 1 || lowerBounds.length == 1 && lowerBounds[0] != null) {
-            appendAllTo(buf.append(" super "), " & ", lowerBounds);
-        } else if (upperBounds.length > 1 || upperBounds.length == 1 && !Object.class.equals(upperBounds[0])) {
-            appendAllTo(buf.append(" extends "), " & ", upperBounds);
-        }
-        return buf.toString();
-    }
-
-    /**
-     * Format a {@link GenericArrayType} as a {@link String}.
-     * @param g {@code GenericArrayType} to format
-     * @return String
-     */
-    private static String genericArrayTypeToString(final GenericArrayType g) {
-        return String.format("%s[]", toString(g.getGenericComponentType()));
-    }
-
-    /**
-     * Append {@code types} to @{code buf} with separator {@code sep}.
-     * @param buf destination
-     * @param sep separator
-     * @param types to append
-     * @return {@code buf}
-     */
-    private static StringBuilder appendAllTo(final StringBuilder buf, final String sep, final Type... types) {
-        if (types.length > 0) {
-            buf.append(toString(types[0]));
-            for (int i = 1; i < types.length; i++) {
-                buf.append(sep).append(toString(types[i]));
-            }
-        }
-        return buf;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java
----------------------------------------------------------------------
diff --git a/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java b/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java
deleted file mode 100644
index 785621e..0000000
--- a/bval-core/src/test/java/org/apache/bval/ValidationResultsTest.java
+++ /dev/null
@@ -1,52 +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;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.bval.model.MetaProperty;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * ValidationResults Tester.
- */
-public class ValidationResultsTest {
-    private ValidationResults results;
-
-    @Before
-    public void setUp() throws Exception {
-        results = new ValidationResults();
-    }
-
-    @Test
-    public void testValidationResults() throws Exception {
-        assertTrue(results.isEmpty());
-        BeanValidationContext<ValidationResults> ctx = new BeanValidationContext<ValidationResults>(results);
-        ctx.setBean(this);
-        ctx.setMetaProperty(new MetaProperty());
-        ctx.getMetaProperty().setName("prop");
-        results.addError("test", ctx);
-        assertFalse(results.isEmpty());
-        assertTrue(results.hasErrorForReason("test"));
-        assertTrue(results.hasError(this, "prop"));
-        assertTrue(results.hasError(this, null));
-        assertFalse(results.hasError(this, "prop2"));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/test/java/org/apache/bval/model/ExampleEnum.java
----------------------------------------------------------------------
diff --git a/bval-core/src/test/java/org/apache/bval/model/ExampleEnum.java b/bval-core/src/test/java/org/apache/bval/model/ExampleEnum.java
deleted file mode 100644
index 10f87a9..0000000
--- a/bval-core/src/test/java/org/apache/bval/model/ExampleEnum.java
+++ /dev/null
@@ -1,27 +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.model;
-
-/**
- * Description: <br>
- * User: roman.stumm<br>
- * Date: 17.06.2010<br>
- * Time: 18:00:12<br>
- */
-public enum ExampleEnum {
-    VALUE1, VALUE2, VALUE3
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/test/java/org/apache/bval/model/MetaPropertyTest.java
----------------------------------------------------------------------
diff --git a/bval-core/src/test/java/org/apache/bval/model/MetaPropertyTest.java b/bval-core/src/test/java/org/apache/bval/model/MetaPropertyTest.java
deleted file mode 100644
index 88a34ba..0000000
--- a/bval-core/src/test/java/org/apache/bval/model/MetaPropertyTest.java
+++ /dev/null
@@ -1,43 +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.model;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/**
- * MetaProperty Tester.
- *
- * @author <Authors name>
- * @since <pre>02/12/2009</pre>
- * @version 1.0
- */
-public class MetaPropertyTest {
-
-    @Test
-    public void testGetTypeClass() throws Exception {
-        MetaProperty prop = new MetaProperty();
-        prop.setType(String.class);
-        assertEquals(String.class, prop.getTypeClass());
-        assertEquals(String.class, prop.getType());
-        prop.setType(new DynaTypeEnum(ExampleEnum.class, ExampleEnum.VALUE1.name(), ExampleEnum.VALUE3.name()));
-        assertEquals(ExampleEnum.class, prop.getTypeClass());
-        assertEquals(2, ((DynaTypeEnum) prop.getType()).getEnumConstants().length);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/test/java/org/apache/bval/util/StringUtilsTest.java
----------------------------------------------------------------------
diff --git a/bval-core/src/test/java/org/apache/bval/util/StringUtilsTest.java b/bval-core/src/test/java/org/apache/bval/util/StringUtilsTest.java
deleted file mode 100644
index 1939081..0000000
--- a/bval-core/src/test/java/org/apache/bval/util/StringUtilsTest.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.util;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class StringUtilsTest {
-
-    @Test
-    public void testStringSplit() {
-        Assert.assertArrayEquals(new String[0], StringUtils.split(null));
-        Assert.assertArrayEquals(new String[0], StringUtils.split(""));
-        Assert.assertArrayEquals(new String[0], StringUtils.split("  "));
-        Assert.assertArrayEquals(new String[0], StringUtils.split("  \n  "));
-        Assert.assertArrayEquals(new String[] { "a", "bbb", "cccc" }, StringUtils.split(" a bbb cccc"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/bval-core/src/test/resources/log4j.xml b/bval-core/src/test/resources/log4j.xml
deleted file mode 100644
index 3c4bb67..0000000
--- a/bval-core/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- ===================================================================== -->
-<!--                                                                       -->
-<!--  Log4j Configuration                                                  -->
-<!--                                                                       -->
-<!-- ===================================================================== -->
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
-
-  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
-    <param name="Threshold" value="DEBUG"/>
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d %-5p %c - %m%n"/>
-    </layout>
-  </appender>
-
-  <root>
-    <appender-ref ref="CONSOLE"/>
-  </root>
-
-</log4j:configuration>

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-json/pom.xml
----------------------------------------------------------------------
diff --git a/bval-json/pom.xml b/bval-json/pom.xml
deleted file mode 100644
index 59dcb17..0000000
--- a/bval-json/pom.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<!--
-	Maven release plugin requires the project tag to be on a single line.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.bval</groupId>
-        <artifactId>bval-parent</artifactId>
-        <version>2.0.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>bval-json</artifactId>
-    <name>Apache BVal :: bval-json (optional)</name>
-    <packaging>bundle</packaging>
-
-    <description>BVal - Optional JSON Component</description>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.bval</groupId>
-            <artifactId>bval-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.bval</groupId>
-            <artifactId>bval-xstream</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.freemarker</groupId>
-            <artifactId>freemarker</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.bval</groupId>
-            <artifactId>bval-core</artifactId>
-            <version>${project.version}</version>
-            <type>test-jar</type>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.bval</groupId>
-            <artifactId>bval-xstream</artifactId>
-            <version>${project.version}</version>
-            <type>test-jar</type>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-</project>
-

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-json/src/main/appended-resources/META-INF/NOTICE.vm
----------------------------------------------------------------------
diff --git a/bval-json/src/main/appended-resources/META-INF/NOTICE.vm b/bval-json/src/main/appended-resources/META-INF/NOTICE.vm
deleted file mode 100644
index 9a0c1ee..0000000
--- a/bval-json/src/main/appended-resources/META-INF/NOTICE.vm
+++ /dev/null
@@ -1,25 +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.
-##
-
-The following copyright notice(s) were affixed to portions of this code
-with which this file is now or was at one time distributed.
-
-This product includes software developed by agimatec GmbH.
-Copyright 2007-2010 Agimatec GmbH. All rights reserved.
-

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-json/src/main/java/org/apache/bval/json/JSONGenerator.java
----------------------------------------------------------------------
diff --git a/bval-json/src/main/java/org/apache/bval/json/JSONGenerator.java b/bval-json/src/main/java/org/apache/bval/json/JSONGenerator.java
deleted file mode 100644
index 11c668b..0000000
--- a/bval-json/src/main/java/org/apache/bval/json/JSONGenerator.java
+++ /dev/null
@@ -1,76 +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.json;
-
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-import org.apache.bval.model.MetaBean;
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Description: Generate a JSON String for a collection of {@link MetaBean}s.
- * This implementation uses a freemarker template to generate the output.<br/>
- *
- * This is an optional module which requires the freemarker dependency
- * and template resource file "bean-infos-json.ftl" with it.
- */
-public class JSONGenerator {
-    private final Template template;
-
-    public JSONGenerator() throws IOException {
-        this("bean-infos-json.ftl");
-    }
-
-    public JSONGenerator(String templateName) throws IOException {
-        Configuration freemarker = new Configuration();
-        freemarker.setNumberFormat("0.######"); // prevent locale-sensitive number format
-        freemarker.setClassForTemplateLoading(getClass(), "");
-        template = freemarker.getTemplate(templateName);
-    }
-
-    public JSONGenerator(Template template) {
-        this.template = template;
-    }
-
-    public String toJSON(MetaBean metaBean) throws IOException, TemplateException {
-        List<MetaBean> metaBeans = new ArrayList<MetaBean>(1);
-        metaBeans.add(metaBean);
-        return toJSON(metaBeans);
-    }
-
-    public String toJSON(Collection<MetaBean> metaBeans) throws IOException, TemplateException {
-        final StringWriter out = new StringWriter();
-        toJSON(metaBeans, out);
-        return out.toString();
-    }
-
-    public void toJSON(Collection<MetaBean> metaBeans, Writer out) throws IOException, TemplateException {
-        Map<String, Object> rootMap = new HashMap<String, Object>();
-        rootMap.put("metaBeans", metaBeans);
-        rootMap.put("generator", this);
-        template.process(rootMap, out);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-json/src/main/resources/org/apache/bval/json/bean-infos-json.ftl
----------------------------------------------------------------------
diff --git a/bval-json/src/main/resources/org/apache/bval/json/bean-infos-json.ftl b/bval-json/src/main/resources/org/apache/bval/json/bean-infos-json.ftl
deleted file mode 100644
index 63012ad..0000000
--- a/bval-json/src/main/resources/org/apache/bval/json/bean-infos-json.ftl
+++ /dev/null
@@ -1,85 +0,0 @@
-bval.namespace("bval.metadata");
-
-<#-- 
- 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.
--->
-
-
-(function(){
-<#assign var = 0>
-<#assign varrefs = {}>
-
-<#list metaBeans as metaBean>
-<#assign varrefs = varrefs + {metaBean.id : var}>
-var metaBean${var} = {
- "id" : "${metaBean.id}",
- <#if metaBean.beanClass??>"beanClass" : "${metaBean.beanClass.name}",</#if>
- <#if metaBean.name??>"name" : "${metaBean.name}",</#if>
- "features" :{<#rt/>
-   <#list metaBean.features?keys as featureKey>
-      <#assign value = metaBean.features[featureKey]>
-   "${featureKey}" : <#if
-          value?is_string>"${value}"<#elseif
-          value?is_boolean>${value?string}<#elseif
-          value?is_number>${value}<#elseif
-          value?is_date>${value?string.full}<#elseif
-          !(value??)>null<#elseif value?is_sequence>[<#list value as v>"${v}"<#if v_has_next>,</#if></#list>]<#elseif
-          value?is_hash>{<#list value?keys as key>"${key}" : "${value[key]}"<#if key_has_next>,</#if></#list>}<#else
-          >"?"</#if><#rt/><#if
-          featureKey_has_next>,</#if>
-   </#list>
-   <#lt/>},
- "properties" :{
-   <#list metaBean.properties as property>
-     "${property.name}":{
-       "name" : "${property.name}",
-       <#if property.type??>"type" : "${property.type}",</#if>
-       <#if property.typeClass??>"typeClass" : "${property.typeClass.name}",</#if>
-       "features" : {<#if property.type?? &&
-       property.type.enum!false>"enum" : {<#list property.type.enumConstants as enum>"${enum.name()}": "${enum.name()}"<#if enum_has_next>, </#if></#list>}<#if property.features?size &gt; 0>,</#if></#if><#list
-       property.features?keys as featureKey>
-       <#assign value = property.features[featureKey]>
-       "${featureKey}" : <#rt/><#if
-          value?is_string>"${value}"<#elseif
-          value?is_boolean>${value?string}<#elseif
-          value?is_number>${value}<#elseif
-          value?is_date>${value?string.full}<#elseif
-          !(value??)>null<#elseif value?is_sequence>[<#list value as v>"${v}"<#if v_has_next>,</#if></#list>]<#elseif
-          value?is_hash_ex>{<#list value?keys as key>"${key}" : "${value[key]}"<#if key_has_next>,</#if></#list>}<#else
-          >"?"</#if><#rt/><#if featureKey_has_next>,</#if>
-       </#list>
-       }
-     }<#if property_has_next>,</#if>
-   </#list>
-   }
-};
-<#assign var = var + 1>
-</#list>
-
-<#assign var = 0>
-<#list metaBeans as metaBean><#list
-    metaBean.properties as property><#if
-    property.metaBean?? && varrefs[property.metaBean.id]??>
-metaBean${var}.properties.${property.name}.metaBean = metaBean${varrefs[property.metaBean.id]};
-</#if></#list><#assign var = var + 1></#list><#assign var = 0>
-bval.metadata.metaBeans = {
-<#list metaBeans as metaBean>
-       "${metaBean.id}" : metaBean${var}<#if metaBean_has_next>,</#if>
-       <#assign var = var + 1>
-</#list>};
-})();

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java
----------------------------------------------------------------------
diff --git a/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java b/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java
deleted file mode 100644
index ab24d93..0000000
--- a/bval-json/src/test/java/org/apache/bval/json/JSONGeneratorTest.java
+++ /dev/null
@@ -1,104 +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.json;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.bval.example.BusinessEnum;
-import org.apache.bval.example.BusinessObject;
-import org.apache.bval.example.BusinessObjectAddress;
-import org.apache.bval.model.DynaTypeEnum;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.xml.XMLMetaBeanManager;
-import org.apache.bval.xml.XMLMetaBeanURLLoader;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Description: <br>
- * Author: roman.stumm<br>
- */
-public class JSONGeneratorTest {
-    private XMLMetaBeanManager mbm;
-
-    @Before
-    public void setUp() throws Exception {
-        mbm = new XMLMetaBeanManager();
-        mbm.addLoader(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos.xml")));
-    }
-
-    @Test
-    public void testBeanInfosCustomPatchGenerated() throws Exception {
-        MetaBean mbean = mbm.findForClass(BusinessObject.class);
-        MetaProperty mprop = mbean.getProperty("lastName");
-        assertTrue(mprop.isMandatory());
-
-        mbm.getCache().removeFromCache(mbean);
-        mbm.addLoader(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos-custom.xml")));
-        mbean = mbm.findForClass(BusinessObject.class);
-        mprop = mbean.getProperty("lastName");
-        assertTrue(!mprop.isMandatory());
-
-        JSONGenerator converter = new JSONGenerator();
-
-        List<MetaBean> metaBeans = new ArrayList<MetaBean>(2);
-        metaBeans.add(mbean);
-        MetaBean mbean2 = mbm.findForId("UnknownObject");
-        metaBeans.add(mbean2);
-        String json = converter.toJSON(metaBeans);
-        assertNotNull(json);
-    }
-
-    @Test
-    public void testJSON() throws Exception {
-        MetaBean info = mbm.findForClass(BusinessObject.class);
-        MetaBean info2 = info.getProperty("address").getMetaBean();
-
-        // empty default bean without xml backup
-        MetaBean info3 = mbm.findForClass(BusinessObjectAddress.class);
-        JSONGenerator converter = new JSONGenerator();
-
-        List<MetaBean> metaBeans = new ArrayList<MetaBean>(2);
-        metaBeans.add(info);
-        metaBeans.add(info2);
-        metaBeans.add(info3);
-        String json = converter.toJSON(metaBeans);
-        assertNotNull(json);
-    }
-
-    @Test
-    public void testJSON_dynaTypeEnum() throws Exception {
-        MetaBean info = mbm.findForClass(BusinessObject.class);
-        MetaProperty choice = info.getProperty("choice");
-        choice.setType(new DynaTypeEnum(BusinessEnum.class, "CUSTOM_1", "CUSTOM_2"));
-
-        JSONGenerator converter = new JSONGenerator();
-
-        List<MetaBean> metaBeans = new ArrayList<MetaBean>(1);
-        metaBeans.add(info);
-        String json = converter.toJSON(metaBeans);
-        assertNotNull(json);
-        assertTrue(json.indexOf("CUSTOM_1") > 0);
-        assertTrue(json.indexOf("CUSTOM_2") > 0);
-        assertTrue(json.indexOf("VALUE1") < 0);
-    }
-}


[7/8] bval git commit: remove obsolete modules, moving required core code to jsr

Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java b/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
deleted file mode 100644
index bd7464b..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java
+++ /dev/null
@@ -1,186 +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.model;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * Description: abstract superclass of meta objects that support a map of
- * features.<br/>
- */
-public abstract class FeaturesCapable implements Serializable {
-    private static final long serialVersionUID = -4045110242904814218L;
-
-    private ConcurrentMap<String, Object> features = createFeaturesMap();
-
-    /** key = validation id, value = the validation */
-    private Validation[] validations = new Validation[0];
-
-    /**
-     * Create a new FeaturesCapable instance.
-     */
-    public FeaturesCapable() {
-        super();
-    }
-
-    /**
-     * Get the (live) map of features.
-     * 
-     * @return Map<String, Object>
-     */
-    public Map<String, Object> getFeatures() {
-        return features;
-    }
-
-    /**
-     * Get the specified feature.
-     * 
-     * @param <T>
-     * @param key
-     * @return T
-     */
-    public <T> T getFeature(String key) {
-        return getFeature(key, (T) null);
-    }
-
-    /**
-     * Get the specified feature, returning <code>defaultValue</code> if
-     * undeclared.
-     * 
-     * @param <T>
-     * @param key
-     * @param defaultValue
-     * @return T
-     */
-    @SuppressWarnings("unchecked")
-    public <T> T getFeature(String key, T defaultValue) {
-        final T value = (T) features.get(key);
-        if (value == null) {
-            return defaultValue;
-        }
-        return value;
-    }
-
-    /**
-     * Convenience method to set a particular feature value.
-     *
-     * @param key
-     * @param value
-     */
-    public <T> void putFeature(final String key, final T value) {
-        features.put(key, value);
-    }
-
-    public <T> T initFeature(final String key, final T value) {
-        @SuppressWarnings("unchecked")
-        final T faster = (T) features.putIfAbsent(key, value);
-        return faster == null ? value : faster;
-    }
-
-    /**
-     * Create a deep copy (copy receiver and copy properties).
-     * 
-     * @param <T>
-     * @return new T instance
-     */
-    public <T extends FeaturesCapable> T copy() {
-        try {
-            @SuppressWarnings("unchecked")
-            final T self = (T) clone();
-            copyInto(self);
-            return self;
-        } catch (CloneNotSupportedException e) {
-            throw new IllegalStateException("cannot clone() " + this, e);
-        }
-    }
-
-    /**
-     * Copy this {@link FeaturesCapable} into another {@link FeaturesCapable}
-     * instance.
-     * 
-     * @param target
-     */
-    protected void copyInto(FeaturesCapable target) {
-        target.features = target.createFeaturesMap();
-        target.features.putAll(features);
-        target.validations = validations != null ? validations.clone() : null;
-    }
-
-    /**
-     * Get any validations set for this {@link FeaturesCapable}.
-     * 
-     * @return Validation array
-     */
-    public Validation[] getValidations() {
-        return validations != null ? validations.clone() : null;
-    }
-
-    /**
-     * Set the validations for this {@link FeaturesCapable}.
-     * 
-     * @param validations
-     */
-    public void setValidations(Validation[] validations) {
-        this.validations = validations != null ? validations.clone() : null;
-    }
-
-    /**
-     * Add a validation to this {@link FeaturesCapable}.
-     * 
-     * @param validation
-     *            to add
-     */
-    public void addValidation(Validation validation) {
-        if (this.validations == null) {
-            this.validations = new Validation[] { validation };
-        } else {
-            Validation[] newValidations = new Validation[this.validations.length + 1];
-            System.arraycopy(this.validations, 0, newValidations, 0, this.validations.length);
-            newValidations[validations.length] = validation;
-            this.validations = newValidations;
-        }
-    }
-
-    /**
-     * Search for an equivalent validation among those configured.
-     * 
-     * @param aValidation
-     * @return true if found
-     */
-    public boolean hasValidation(Validation aValidation) {
-        if (validations == null) {
-            return false;
-        }
-        for (Validation validation : validations) {
-            if (validation.equals(aValidation)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Create a features map for this {@link FeaturesCapable} object.
-     * @return ConcurrentMap
-     */
-    protected ConcurrentMap<String, Object> createFeaturesMap() {
-        return new ConcurrentHashMap<String, Object>();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/Meta.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/Meta.java b/bval-core/src/main/java/org/apache/bval/model/Meta.java
deleted file mode 100644
index e539b1d..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/Meta.java
+++ /dev/null
@@ -1,29 +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.model;
-
-public abstract class Meta extends FeaturesCapable {
-    private static final long serialVersionUID = 1L;
-
-    protected MetaBean parentMetaBean;
-
-    public MetaBean getParentMetaBean() {
-        return parentMetaBean;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/MetaAnnotated.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/MetaAnnotated.java b/bval-core/src/main/java/org/apache/bval/model/MetaAnnotated.java
deleted file mode 100755
index e2ab2f9..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/MetaAnnotated.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.model;
-
-import java.lang.annotation.Annotation;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.bval.util.ObjectUtils;
-
-public abstract class MetaAnnotated extends Meta {
-    private static final long serialVersionUID = 1L;
-
-    private Set<Annotation> annotations = new HashSet<Annotation>();
-    private Annotation[] annArray = null;
-
-    public Annotation[] getAnnotations() {
-        if (annArray == null) {
-            annArray = annotations.isEmpty() ? ObjectUtils.EMPTY_ANNOTATION_ARRAY
-                : annotations.toArray(new Annotation[annotations.size()]);
-        }
-        return annArray;
-    }
-
-    public void addAnnotation(final Annotation annotation) {
-        this.annotations.add(annotation);
-        annArray = null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/MetaBean.java b/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
deleted file mode 100644
index 9738f23..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
+++ /dev/null
@@ -1,378 +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.model;
-
-import java.beans.Introspector;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.apache.bval.util.reflection.Reflection;
-import org.apache.commons.weaver.privilizer.Privilizing;
-import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
-
-/**
- * Description: the meta description of a bean or class. the class/bean itself can have a map of features and an array
- * of metaproperties.<br/>
- * 
- * @see MetaProperty
- */
-@Privilizing(@CallTo(Reflection.class))
-public class MetaBean extends FeaturesCapable implements Cloneable, Features.Bean {
-    private static final long serialVersionUID = 2L;
-
-    private String id;
-    private String name;
-    private Class<?> beanClass;
-
-    private Map<String, MetaProperty> properties = null;
-    private Map<Method, MetaMethod> methods = null;
-    private Map<Constructor<?>, MetaConstructor> constructors = null;
-
-    /**
-     * Get the id.
-     * 
-     * @return String
-     */
-    public String getId() {
-        return id;
-    }
-
-    /**
-     * Set the id.
-     * 
-     * @param id
-     *            the String to set
-     */
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    /**
-     * Get the name.
-     * 
-     * @return String
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Set the name.
-     * 
-     * @param name
-     *            the String to set
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    /**
-     * Get the beanClass.
-     * 
-     * @return Class
-     */
-    public Class<?> getBeanClass() {
-        return beanClass;
-    }
-
-    /**
-     * Set the beanClass.
-     * 
-     * @param beanClass
-     *            the Class<?> to set
-     */
-    public void setBeanClass(Class<?> beanClass) {
-        this.beanClass = beanClass;
-        if (beanClass != null) {
-            // order of fields to ensure correct failling order
-            final Map<String, MetaProperty> oldProperties = properties;
-            final Map<Method, MetaMethod> oldMethods = methods;
-            final Map<Constructor<?>, MetaConstructor> oldConstructors = constructors;
-
-            properties = new TreeMap<String, MetaProperty>(new FieldComparator(beanClass));
-            if (oldProperties != null) {
-                properties.putAll(oldProperties);
-            }
-            methods = new TreeMap<Method, MetaMethod>(new MethodComparator(beanClass));
-            if (oldMethods != null) {
-                methods.putAll(oldMethods);
-            }
-            constructors = new TreeMap<Constructor<?>, MetaConstructor>(new ConstructorComparator(beanClass));
-            if (oldConstructors != null) {
-                constructors.putAll(oldConstructors);
-            }
-        }
-    }
-
-    /**
-     * Get the properties.
-     * 
-     * @return MetaProperty[]
-     */
-    public MetaProperty[] getProperties() {
-        if (properties == null) {
-            return new MetaProperty[0];
-        }
-        return properties.values().toArray(new MetaProperty[this.properties.size()]);
-    }
-
-    public MetaMethod[] getMethods() {
-        if (methods == null) {
-            return new MetaMethod[0];
-        }
-        return methods.values().toArray(new MetaMethod[this.methods.size()]);
-    }
-
-    public void addMethod(final Method method, final MetaMethod meta) {
-        if (methods == null) {
-            methods = new HashMap<Method, MetaMethod>();
-        }
-        methods.put(method, meta);
-    }
-
-    public void addConstructor(final Constructor<?> constructor, final MetaConstructor meta) {
-        if (constructors == null) {
-            constructors = new HashMap<Constructor<?>, MetaConstructor>();
-        }
-        constructors.put(constructor, meta);
-    }
-
-    /**
-     * Set the properties.
-     * 
-     * @param properties
-     *            the MetaProperty[] to set
-     */
-    public void setProperties(MetaProperty[] properties) {
-        this.properties = new HashMap<String, MetaProperty>();
-        for (final MetaProperty property : properties) {
-            this.properties.put(property.getName(), property);
-        }
-    }
-
-    /**
-     * Get the specified {@link MetaProperty}.
-     * 
-     * @param name property name
-     * @return MetaProperty found or <code>null</code>
-     */
-    public MetaProperty getProperty(String name) {
-        if (properties == null) {
-            return null;
-        }
-        return this.properties.get(name);
-    }
-
-    /**
-     * Learn whether any known property is a relationship.
-     * 
-     * @see MetaProperty#isRelationship()
-     * @return true when at least one of the properties is a relationship
-     */
-    public boolean hasRelationships() {
-        if (properties == null) {
-            return false;
-        }
-        for (MetaProperty property : this.properties.values()) {
-            if (property.isRelationship()) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * bidirectional - set the relationship between a MetaProperty and its parentMetaBean
-     * 
-     * @param name property name
-     * @param property
-     *            if <code>null</code>, remove
-     */
-    public void putProperty(String name, MetaProperty property) {
-        if (properties == null) {
-            properties = new HashMap<String, MetaProperty>();
-        }
-        if (property == null) {
-            this.properties.remove(name);
-        } else {
-            property.setParentMetaBean(this);
-            this.properties.put(name, property);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return "MetaBean{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", beanClass=" + beanClass + '}';
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void copyInto(FeaturesCapable target) {
-        super.copyInto(target);
-        final MetaBean copy = (MetaBean) target;
-        if (properties != null) {
-            copy.properties = new TreeMap<String, MetaProperty>();
-            for (Map.Entry<String, MetaProperty> entry : properties.entrySet()) {
-                copy.properties.put(entry.getKey(), (MetaProperty) entry.getValue().copy());
-            }
-        }
-    }
-
-    /**
-     * <p>
-     * If this {@link MetaBean} is compatible with <code>bean</code>, return <code>this</code>, else <code>null</code>.
-     * </p>
-     * <p>
-     * Compatibility is satisfied in one of the following ways:
-     * <ul>
-     * <li><code>bean</code> is null</li>
-     * <li><code>bean</code> is an instance of our <code>beanClass</code></li>
-     * <li><code>bean</code> <em>is</em> our <code>beanClass</code> itself</li>
-     * </ul>
-     * </p>
-     * 
-     * @param bean instance
-     * @return <code>this</code> or <code>null</code>
-     */
-    public MetaBean resolveMetaBean(Object bean) {
-        return bean == null || bean == beanClass || beanClass.isInstance(bean) ? this : null;
-    }
-
-    public MetaMethod getMethod(final Method method) {
-        return methods == null ? null : methods.get(method);
-    }
-
-    public MetaConstructor getConstructor(final Constructor<?> constructor) {
-        return constructors == null ? null : constructors.get(constructor);
-    }
-
-    protected static class FieldComparator implements Comparator<String> {
-        private final Map<String, Integer> fields = new HashMap<String, Integer>();
-
-        protected FieldComparator(final Class<?> beanClass) {
-            int i = 0;
-            Class<?> clazz = beanClass;
-            while (clazz != null && clazz != Object.class) {
-                for (final Field f : Reflection.getDeclaredFields(clazz)) {
-                    final String name = f.getName();
-                    if (!fields.containsKey(name)) {
-                        fields.put(name, Integer.valueOf(++i));
-                    }
-                }
-                for (final Method m : clazz.getDeclaredMethods()) {
-                    final String name = getPropertyName(m);
-                    if (name != null && !name.isEmpty()) {
-                        if (!fields.containsKey(name)) {
-                            fields.put(name, Integer.valueOf(++i));
-                        }
-                    }
-                }
-                clazz = clazz.getSuperclass();
-            }
-        }
-
-        private String getPropertyName(Method potentialAccessor) {
-            if (potentialAccessor.getParameterTypes().length == 0) {
-                final String name = potentialAccessor.getName();
-                if (Boolean.TYPE.equals(potentialAccessor.getReturnType())
-                    && potentialAccessor.getName().startsWith("is")) {
-                    return Introspector.decapitalize(name.substring(2));
-                }
-                if (!Void.TYPE.equals(potentialAccessor.getReturnType())
-                    && potentialAccessor.getName().startsWith("get")) {
-                    return Introspector.decapitalize(name.substring(3));
-                }
-            }
-            return null;
-        }
-
-        @Override
-        public int compare(final String o1, final String o2) {
-            final Integer i1 = fields.get(o1);
-            final Integer i2 = fields.get(o2);
-            if (i1 == null) {
-                if (i2 == null) {
-                    // java.util.TreeMap requires that the comparator be consistent with #equals(),
-                    // therefore we must not incorrectly report 0 comparison for different property names
-                    // Both o1 and o2 cannot be null as they would have blown up with a NPE in fields.get already
-                    return o1.compareTo(o2);
-                }
-                return -1;
-            }
-            if (i2 == null) {
-                return 1;
-            }
-            return i1.intValue() - i2.intValue();
-        }
-
-    }
-
-    protected static class MethodComparator implements Comparator<Method> {
-        private final Map<Method, Integer> methods = new HashMap<Method, Integer>();
-
-        protected MethodComparator(final Class<?> beanClass) {
-            Class<?> clazz = beanClass;
-            while (clazz != null && clazz != Object.class) {
-                for (final Method m : Reflection.getDeclaredMethods(clazz)) {
-                    methods.put(m, Arrays.hashCode(m.getParameterTypes()));
-                }
-                clazz = clazz.getSuperclass();
-            }
-        }
-
-        @Override
-        public int compare(final Method o1, final Method o2) {
-            if (o1 == o2) {
-                return 0;
-            }
-
-            final int i = o1.getName().compareTo(o2.getName());
-            return i == 0 ? methods.get(o1) - methods.get(o2) : i;
-        }
-    }
-
-    protected static class ConstructorComparator implements Comparator<Constructor<?>> {
-        private final Map<Constructor<?>, Integer> constructors = new HashMap<Constructor<?>, Integer>();
-
-        protected ConstructorComparator(final Class<?> beanClass) {
-            for (final Constructor<?> c : Reflection.getDeclaredConstructors(beanClass)) {
-                constructors.put(c, Arrays.hashCode(c.getParameterTypes()));
-            }
-        }
-
-        @Override
-        public int compare(final Constructor<?> o1, final Constructor<?> o2) {
-            if (o1 == o2) {
-                return 0;
-            }
-
-            final int i = o1.getName().compareTo(o2.getName());
-            return i == 0 ? constructors.get(o1) - constructors.get(o2) : i;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/MetaConstructor.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/MetaConstructor.java b/bval-core/src/main/java/org/apache/bval/model/MetaConstructor.java
deleted file mode 100644
index 4a6436b..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/MetaConstructor.java
+++ /dev/null
@@ -1,34 +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.model;
-
-import java.lang.reflect.Constructor;
-
-public class MetaConstructor extends MetaInvocable {
-    private static final long serialVersionUID = 1L;
-
-    private final Constructor<?> constructor;
-
-    public MetaConstructor(final MetaBean metabean, final Constructor<?> constructor) {
-        this.parentMetaBean = metabean;
-        this.constructor = constructor;
-    }
-
-    public Constructor<?> getConstructor() {
-        return constructor;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java b/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java
deleted file mode 100644
index b5fd8ab..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java
+++ /dev/null
@@ -1,40 +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.model;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-public abstract class MetaInvocable extends MetaAnnotated {
-    private static final long serialVersionUID = 1L;
-
-    private Map<Integer, MetaParameter> parameters = new HashMap<Integer, MetaParameter>();
-
-    public Collection<MetaParameter> getParameters() {
-        return new ArrayList<MetaParameter>(parameters.values());
-    }
-
-    public void addParameter(final int idx, final MetaParameter param) {
-        parameters.put(idx, param);
-    }
-
-    public MetaParameter getParameter(final Integer index) {
-        return parameters.get(index);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/MetaMethod.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/MetaMethod.java b/bval-core/src/main/java/org/apache/bval/model/MetaMethod.java
deleted file mode 100644
index 952dc5c..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/MetaMethod.java
+++ /dev/null
@@ -1,34 +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.model;
-
-import java.lang.reflect.Method;
-
-public class MetaMethod extends MetaInvocable {
-    private static final long serialVersionUID = 1L;
-
-    private final Method method;
-
-    public MetaMethod(final MetaBean parent, final Method method) {
-        this.parentMetaBean = parent;
-        this.method = method;
-    }
-
-    public Method getMethod() {
-        return method;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/MetaParameter.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/MetaParameter.java b/bval-core/src/main/java/org/apache/bval/model/MetaParameter.java
deleted file mode 100644
index f46ef16..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/MetaParameter.java
+++ /dev/null
@@ -1,42 +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.model;
-
-public class MetaParameter extends MetaAnnotated {
-    private static final long serialVersionUID = 1L;
-
-    private final MetaInvocable invocable;
-    private final Integer index;
-
-    public MetaParameter(final MetaInvocable metaMethod, final Integer index) {
-        this.invocable = metaMethod;
-        this.index = index;
-    }
-
-    public MetaInvocable getMethod() {
-        return invocable;
-    }
-
-    public Integer getIndex() {
-        return index;
-    }
-
-    @Override
-    public MetaBean getParentMetaBean() {
-        return invocable.getParentMetaBean();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java b/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
deleted file mode 100644
index 690416f..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
+++ /dev/null
@@ -1,164 +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.model;
-
-import java.lang.reflect.Type;
-
-import org.apache.bval.util.reflection.TypeUtils;
-
-/**
- * Description: the meta description of a property of a bean. It supports a map
- * of features and multiple validations.<br/>
- *
- * @see Validation
- * @see MetaBean
- */
-public class MetaProperty extends Meta implements Cloneable, Features.Property {
-    private static final long serialVersionUID = 1L;
-
-    private String name;
-
-    private Type type;
-    private MetaBean metaBean;
-
-    /**
-     * Create a new MetaProperty instance.
-     */
-    public MetaProperty() {
-    }
-
-    /**
-     * Get the metabean of the target bean (mainly for relationships).
-     * @return MetaBean (may be null).
-     */
-    public MetaBean getMetaBean() {
-        return metaBean;
-    }
-
-    /**
-     * Set the MetaBean of this {@link MetaProperty}.
-     * @param metaBean to set
-     */
-    public void setMetaBean(MetaBean metaBean) {
-        this.metaBean = metaBean;
-    }
-
-    /**
-     * Set the metabean that owns this property (usually called by MetaBean.putProperty())
-     * @param parentMetaBean
-     */
-    void setParentMetaBean(MetaBean parentMetaBean) {
-        this.parentMetaBean = parentMetaBean;
-    }
-
-    /**
-     * Learn whether this property is considered a relationship.
-     * @return <code>true</code> if it has a MetaBean of its own
-     */
-    public boolean isRelationship() {
-        return metaBean != null;
-    }
-
-    /**
-     * Set the type of this property.
-     * @param type to set
-     */
-    public void setType(Type type) {
-        this.type = type;
-    }
-
-    /**
-     * Get the type of this property.
-     * @return
-     */
-    public Type getType() {
-        return type;
-    }
-
-    /**
-     * Resolve the type of this property to a class.
-     * @return Class, <code>null</code> if cannot be determined
-     */
-    public Class<?> getTypeClass() {
-        Type targetType = type instanceof DynaType ? ((DynaType) type).getRawType() : type;
-        if (targetType == null) {
-            return null;
-        }
-        Type assigningType = getParentMetaBean() == null ? null : getParentMetaBean().getBeanClass();
-        return TypeUtils.getRawType(targetType, assigningType);
-    }
-
-    /**
-     * Get the name of this property.
-     * @return String
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Learn whether this property is considered mandatory.
-     * @return <code>true</code> if the <code>MANDATORY</code> feature is set to <code>true</code>.
-     * @see {@link Features.Property#MANDATORY}
-     */
-    public boolean isMandatory() {
-        return getFeature(MANDATORY, Boolean.FALSE).booleanValue();
-    }
-
-    /**
-     * Set this property as being mandatory (or not).
-     * @param mandatory
-     * @see {@link Features.Property#MANDATORY}
-     */
-    public void setMandatory(boolean mandatory) {
-        putFeature(MANDATORY, Boolean.valueOf(mandatory));
-    }
-
-    /**
-     * Get javascript validations of this property.
-     * @return String[]
-     * @deprecated
-     */
-    @Deprecated // remove this method?
-    public String[] getJavaScriptValidations() {
-        return getFeature(JAVASCRIPT_VALIDATION_FUNCTIONS);
-    }
-
-    /**
-     * Set the name of this property.
-     * @param name to set
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public MetaProperty clone() throws CloneNotSupportedException {
-        return (MetaProperty) super.clone();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return "MetaProperty{" + "name='" + name + '\'' + ", type=" + type + '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/Validation.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/Validation.java b/bval-core/src/main/java/org/apache/bval/model/Validation.java
deleted file mode 100644
index a81e731..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/Validation.java
+++ /dev/null
@@ -1,30 +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.model;
-
-/**
- * Description: Interface for a single validation <br/>
- */
-public interface Validation {
-    /**
-     * Perform a single validation routine.
-     * Validate the object or property according to the current ValidationContext.
-     *
-     * @param context - to access the property, value, constraints
-     */
-    <T extends ValidationListener> void validate(ValidationContext<T> context);
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java b/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java
deleted file mode 100644
index c26d2b7..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java
+++ /dev/null
@@ -1,137 +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.model;
-
-import org.apache.bval.util.AccessStrategy;
-
-/**
- * Description: Interface of the context that holds all state information
- * during the validation process<br/>
- */
-public interface ValidationContext<T extends ValidationListener> {
-    /**
-     * Get the property value.
-     * @return {@link Object}
-     */
-    Object getPropertyValue();
-
-    /**
-     * Get the value by using the given access strategy.
-     * @param access
-     * @return {@link Object}
-     */
-    Object getPropertyValue(AccessStrategy access);
-
-    /**
-     * Get the property name.
-     * @return {@link String}
-     */
-    String getPropertyName();
-
-    /**
-     * Get the {@link ValidationListener}.
-     * @return T
-     */
-    T getListener();
-
-    /**
-     * Get the bean.
-     * @return {@link Object}
-     */
-    Object getBean();
-
-    /**
-     * Get the model meta-bean.
-     * @return {@link MetaBean}
-     */
-    MetaBean getMetaBean();
-
-    /**
-     * Set the model meta-bean.
-     * @param metaBean
-     */
-    void setMetaBean(MetaBean metaBean);
-
-    /**
-     * Get the model meta-property.
-     * @return {@link MetaProperty}
-     */
-    MetaProperty getMetaProperty();
-
-    /**
-     * Set the bean.
-     * @param bean
-     */
-    void setBean(Object bean);
-
-    /**
-     * Avoid recursion by recording the current state of this context as having been validated.
-     * <p/>
-     *
-     * @return true when this state had not already been recorded
-     */
-    boolean collectValidated();
-
-    /**
-     * Set the current bean/metabean.
-     * @param aBean
-     * @param aMetaBean
-     */
-    void setBean(Object aBean, MetaBean aMetaBean);
-
-    /**
-     * Set the current meta-property.
-     * @param metaProperty
-     */
-    void setMetaProperty(MetaProperty metaProperty);
-
-    /**
-     * Step deeper into association at 'prop' 
-     * @param prop
-     * @param access
-     */
-    void moveDown(MetaProperty prop, AccessStrategy access);
-
-    void moveDown(String prop);
-
-    /**
-     * Step out from a validation of associated objects.
-     * @param bean
-     * @param metaBean
-     */
-    void moveUp(Object bean, MetaBean metaBean);
-
-    /**
-     * Set the index of the object currently validated into the context.
-     * used to create the propertyPath with [index] information for collections.
-     * @param index
-     */
-    void setCurrentIndex(Integer index);
-
-    /**
-     * set the key of the object in a map currently validated into the context.
-     * used to create the propertyPath with [key] information for maps.
-     * @param key
-     */
-    void setCurrentKey(Object key);
-
-    /**
-     * Get the current access strategy.
-     * @return {@link AccessStrategy}
-     */
-    AccessStrategy getAccess();
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java b/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java
deleted file mode 100644
index 76e4fab..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java
+++ /dev/null
@@ -1,99 +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.model;
-
-import java.io.Serializable;
-
-/**
- * Description: The interface to collect errors found during validation<br/>
- */
-public interface ValidationListener {
-    /**
-     * Simple API to add an error reason during validation.
-     * Error notification added from a {@link org.apache.bval.model.Validation} with context information
-     * taken from the given {@link org.apache.bval.model.ValidationContext}.
-     *
-     * @param reason  a constant describing the reason. This is normally the key of the
-     *                feature that was violated in the object 'owner' for property 'propertyName'
-     * @param context - contains
-     *                bean =         the object that contains the error (owner)
-     *                propertyName = the Name of the attribute that caused the error
-     */
-    <T extends ValidationListener> void addError(String reason, ValidationContext<T> context);
-
-    /** Alternative method to add a fully initialized {@link ValidationListener.Error} object. */
-    <T extends ValidationListener> void addError(Error error, ValidationContext<T> context);
-
-    /**
-     * An object holding a single validation constraint violation
-     * found during the validation process.
-     */
-    public class Error implements Serializable {
-        private static final long serialVersionUID = 1L;
-
-        /** Reason */
-        final String reason;
-        /** Owner */
-        final Object owner;
-        /** Property name*/
-        final String propertyName;
-
-        /**
-         * Create a new Error instance.
-         * @param aReason
-         * @param aOwner
-         * @param aPropertyName
-         */
-        public Error(String aReason, Object aOwner, String aPropertyName) {
-            this.reason = aReason;
-            this.owner = aOwner;
-            this.propertyName = aPropertyName;
-        }
-
-        /**
-         * Get the reason.
-         * @return String
-         */
-        public String getReason() {
-            return reason;
-        }
-
-        /**
-         * Get the owner.
-         * @return Object
-         */
-        public Object getOwner() {
-            return owner;
-        }
-
-        /**
-         * Get the propertyName.
-         * @return String
-         */
-        public String getPropertyName() {
-            return propertyName;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public String toString() {
-            return "Error{" + "reason='" + reason + '\'' + ", propertyName='" + propertyName + '\'' + '}';
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java b/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java
deleted file mode 100644
index 0835bae..0000000
--- a/bval-core/src/main/java/org/apache/bval/routines/EMailValidationUtils.java
+++ /dev/null
@@ -1,75 +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.routines;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Description: holds the regexp to validate an email address<br>
- * User: roman.stumm<br>
- * Date: 17.06.2010<br>
- * Time: 10:40:59<br>
- */
-public class EMailValidationUtils {
-    private static String ATOM = "[^\\x00-\\x1F\\(\\)\\<\\>\\@\\,\\;\\:\\\\\\\"\\.\\[\\]\\s]";
-    private static String DOMAIN = "(" + ATOM + "+(\\." + ATOM + "+)*";
-    private static String IP_DOMAIN = "\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\]";
-    public static final Pattern DEFAULT_EMAIL_PATTERN;
-
-    static {
-        DEFAULT_EMAIL_PATTERN = Pattern.compile("^" + ATOM + "+(\\." + ATOM + "+)*@" + DOMAIN + "|" + IP_DOMAIN + ")$",
-            Pattern.CASE_INSENSITIVE);
-    }
-
-    /**
-     * Learn whether a given object is a valid email address.
-     * 
-     * @param value
-     *            to check
-     * @return <code>true</code> if the validation passes
-     */
-    public static boolean isValid(Object value) {
-        return isValid(value, DEFAULT_EMAIL_PATTERN);
-    }
-
-    /**
-     * Learn whether a particular value matches a given pattern per
-     * {@link Matcher#matches()}.
-     * 
-     * @param value
-     * @param aPattern
-     * @return <code>true</code> if <code>value</code> was a <code>String</code>
-     *         matching <code>aPattern</code>
-     */
-    // TODO it would seem to make sense to move or reduce the visibility of this
-    // method as it is more general than email.
-    public static boolean isValid(Object value, Pattern aPattern) {
-        if (value == null) {
-            return true;
-        }
-        if (!(value instanceof CharSequence)) {
-            return false;
-        }
-        CharSequence seq = (CharSequence) value;
-        if (seq.length() == 0) {
-            return true;
-        }
-        return aPattern.matcher(seq).matches();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/AccessStrategy.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/AccessStrategy.java b/bval-core/src/main/java/org/apache/bval/util/AccessStrategy.java
deleted file mode 100644
index 5118a26..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/AccessStrategy.java
+++ /dev/null
@@ -1,59 +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.util;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Type;
-
-/**
- * Description: abstract class to encapsulate different strategies
- * to get the value of a Property.  This class is designed such that
- * subclasses are intended to know internally to which property they refer,
- * with only the particular target instance being externally required
- * to calculate the property's value.  One intent of this design is
- * that the notion of the very definition of a property is abstracted
- * along with the mechanism for accessing that property.<br/>
- */
-public abstract class AccessStrategy {
-    /**
-     * Get the value from the given instance.
-     * @param instance
-     * @return the value
-     * @throws IllegalArgumentException in case of an error
-     */
-    public abstract Object get(Object instance);
-
-    /**
-     * Get the Java program {@link ElementType} used by this {@link AccessStrategy}
-     * to determine property values.
-     * @return ElementType
-     */
-    public abstract ElementType getElementType();
-
-    /**
-     * Get the type of the property
-     * @return Type
-     */
-    public abstract Type getJavaType();
-
-    /**
-     * Get a name representative of this property.
-     * @return String
-     */
-    public abstract String getPropertyName();
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/BValVersion.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/BValVersion.java b/bval-core/src/main/java/org/apache/bval/util/BValVersion.java
deleted file mode 100644
index 13d1fa3..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/BValVersion.java
+++ /dev/null
@@ -1,195 +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.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import org.apache.bval.util.reflection.Reflection;
-import org.apache.commons.weaver.privilizer.Privilizing;
-import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
-
-/**
- * This class contains version information for BVal.
- * It uses Ant's filter tokens to convert the template into a java
- * file with current information.
- */
-@Privilizing(@CallTo(Reflection.class))
-public class BValVersion {
-
-    /** Project name */
-    public static final String PROJECT_NAME = "Apache BVal";
-    /** Unique id of the current project/version/revision */
-    public static final String PROJECT_ID;
-    /** Version number */
-    public static final String VERSION_NUMBER;
-    /** Major release number */
-    public static final int MAJOR_RELEASE;
-    /** Minor release number */
-    public static final int MINOR_RELEASE;
-    /** Patch/point release number */
-    public static final int PATCH_RELEASE;
-    /** Release status */
-    public static final String RELEASE_STATUS;
-    /** Version control revision number */
-    public static final String REVISION_NUMBER;
-
-    static {
-        Properties revisionProps = new Properties();
-        try (InputStream in = BValVersion.class.getResourceAsStream("/META-INF/org.apache.bval.revision.properties")) {
-            if (in != null) {
-                revisionProps.load(in);
-            }
-        } catch (IOException ioe) {
-        }
-
-        String vers = revisionProps.getProperty("project.version");
-        if (vers == null || "".equals(vers.trim())) {
-            vers = "0.0.0";
-        }
-        VERSION_NUMBER = vers;
-
-        StringTokenizer tok = new StringTokenizer(VERSION_NUMBER, ".-");
-        int major, minor, patch;
-        try {
-            major = tok.hasMoreTokens() ? Integer.parseInt(tok.nextToken()) : 0;
-        } catch (Exception e) {
-            major = 0;
-        }
-
-        try {
-            minor = tok.hasMoreTokens() ? Integer.parseInt(tok.nextToken()) : 0;
-        } catch (Exception e) {
-            minor = 0;
-        }
-
-        try {
-            patch = tok.hasMoreTokens() ? Integer.parseInt(tok.nextToken()) : 0;
-        } catch (Exception e) {
-            patch = 0;
-        }
-
-        String revision = revisionProps.getProperty("svn.revision");
-        if (StringUtils.isBlank(revision)) {
-            revision = "unknown";
-        } else {
-            tok = new StringTokenizer(revision, ":");
-            String strTok = null;
-            while (tok.hasMoreTokens()) {
-                try {
-                    strTok = tok.nextToken();
-                } catch (Exception e) {
-                }
-            }
-            if (strTok != null) {
-                revision = strTok;
-            }
-        }
-
-        MAJOR_RELEASE = major;
-        MINOR_RELEASE = minor;
-        PATCH_RELEASE = patch;
-        RELEASE_STATUS = tok.hasMoreTokens() ? tok.nextToken("!") : "";
-        REVISION_NUMBER = revision;
-        PROJECT_ID = PROJECT_NAME + " " + VERSION_NUMBER + "-r" + REVISION_NUMBER;
-    }
-
-    /**
-     * Get the project version number.
-     * @return String
-     */
-    public static String getVersion() {
-        return VERSION_NUMBER;
-    }
-
-    /**
-     * Get the version control revision number.
-     * @return String
-     */
-    public static String getRevision() {
-        return REVISION_NUMBER;
-    }
-
-    /**
-     * Get the project name.
-     * @return String
-     */
-    public static String getName() {
-        return PROJECT_NAME;
-    }
-
-    /**
-     * Get the fully-qualified project id.
-     * @return String
-     */
-    public static String getID() {
-        return PROJECT_ID;
-    }
-
-    /**
-     * Main method of this class that prints the {@link #toString()} to <code>System.out</code>.
-     * @param args ignored
-     */
-    public static void main(String[] args) {
-        System.out.println(new BValVersion().toString());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        final StringBuilder buf = new StringBuilder(80 * 40);
-        appendBanner(buf);
-        buf.append("\n");
-
-        appendProperty("os.name", buf).append("\n");
-        appendProperty("os.version", buf).append("\n");
-        appendProperty("os.arch", buf).append("\n\n");
-
-        appendProperty("java.version", buf).append("\n");
-        appendProperty("java.vendor", buf).append("\n\n");
-
-        buf.append("java.class.path:\n");
-        final StringTokenizer tok = new StringTokenizer(Reflection.getProperty("java.class.path"));
-        while (tok.hasMoreTokens()) {
-            buf.append("\t").append(tok.nextToken());
-            buf.append("\n");
-        }
-        buf.append("\n");
-
-        appendProperty("user.dir", buf).append("\n");
-        return buf.toString();
-    }
-
-    private void appendBanner(StringBuilder buf) {
-        buf.append("Project").append(": ").append(getName());
-        buf.append("\n");
-        buf.append("Version").append(": ").append(getVersion());
-        buf.append("\n");
-        buf.append("Revision").append(": ").append(getRevision());
-        buf.append("\n");
-    }
-
-    private StringBuilder appendProperty(String prop, StringBuilder buf) {
-        return buf.append(prop).append(": ").append(Reflection.getProperty(prop));
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/BeanUtilsPropertyAccess.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/BeanUtilsPropertyAccess.java b/bval-core/src/main/java/org/apache/bval/util/BeanUtilsPropertyAccess.java
deleted file mode 100755
index c189e72..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/BeanUtilsPropertyAccess.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.util;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.apache.commons.beanutils.DynaBean;
-import org.apache.commons.beanutils.PropertyUtils;
-
-/**
- * Commons BeanUtils-specific {@link PropertyAccess} subclass.
- * 
- * @since 1.1.2
- */
-class BeanUtilsPropertyAccess extends PropertyAccess {
-
-    public BeanUtilsPropertyAccess(Class<?> clazz, String propertyName) {
-        super(clazz, propertyName);
-    }
-
-    @Override
-    protected Object getPublicProperty(Object bean)
-        throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
-        if (bean instanceof DynaBean) {
-            return PropertyUtils.getSimpleProperty(bean, getPropertyName());
-        }
-        return super.getPublicProperty(bean);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/Exceptions.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/Exceptions.java b/bval-core/src/main/java/org/apache/bval/util/Exceptions.java
deleted file mode 100644
index 9487cde..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/Exceptions.java
+++ /dev/null
@@ -1,125 +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.util;
-
-import java.util.function.BiFunction;
-import java.util.function.Function;
-import java.util.function.Supplier;
-import java.util.stream.Stream;
-
-/**
- * Utility class for the creation and throwing of Exceptions.
- */
-public class Exceptions {
-
-    public static <E extends Exception> E create(Function<? super String, ? extends E> fn, String format,
-        Object... args) {
-        return create(fn, () -> String.format(format, args));
-    }
-
-    public static <E extends Exception, C extends Throwable> E create(
-        BiFunction<? super String, ? super C, ? extends E> fn, C cause, String format, Object... args) {
-        return create(fn, cause, () -> String.format(format, args));
-    }
-
-    public static <E extends Exception> E create(Function<? super String, ? extends E> fn, Supplier<String> message) {
-        return elideStackTrace(fn.apply(message.get()));
-    }
-
-    public static <E extends Exception, C extends Throwable> E create(
-        BiFunction<? super String, ? super C, ? extends E> fn, C cause, Supplier<String> message) {
-        return elideStackTrace(fn.apply(message.get(), cause));
-    }
-
-    public static <E extends Exception, R> R raise(Function<? super String, ? extends E> fn, String format,
-        Object... args) throws E {
-        throw create(fn, format, args);
-    }
-
-    public static <E extends Exception> void raiseIf(boolean condition, Function<? super String, ? extends E> fn,
-        String format, Object... args) throws E {
-        if (condition) {
-            raise(fn, format, args);
-        }
-    }
-
-    public static <E extends Exception> void raiseUnless(boolean condition, Function<? super String, ? extends E> fn,
-        String format, Object... args) throws E {
-        raiseIf(!condition, fn, format, args);
-    }
-
-    public static <E extends Exception, R> R raise(Function<? super String, ? extends E> fn, Supplier<String> message)
-        throws E {
-        throw create(fn, message);
-    }
-
-    public static <E extends Exception> void raiseIf(boolean condition, Function<? super String, ? extends E> fn,
-        Supplier<String> message) throws E {
-        if (condition) {
-            raise(fn, message);
-        }
-    }
-
-    public static <E extends Exception> void raiseUnless(boolean condition, Function<? super String, ? extends E> fn,
-        Supplier<String> message) throws E {
-        raiseIf(!condition, fn, message);
-    }
-
-    public static <E extends Exception, C extends Throwable, R> R raise(
-        BiFunction<? super String, ? super C, ? extends E> fn, C cause, String format, Object... args) throws E {
-        throw create(fn, cause, format, args);
-    }
-
-    public static <E extends Exception, C extends Throwable> void raiseIf(boolean condition,
-        BiFunction<? super String, ? super C, ? extends E> fn, C cause, String format, Object... args) throws E {
-        if (condition) {
-            raise(fn, cause, format, args);
-        }
-    }
-
-    public static <E extends Exception, C extends Throwable> void raiseUnless(boolean condition,
-        BiFunction<? super String, ? super C, ? extends E> fn, C cause, String format, Object... args) throws E {
-        raiseIf(!condition, fn, cause, format, args);
-    }
-
-    public static <E extends Exception, C extends Throwable, R> R raise(
-        BiFunction<? super String, ? super C, ? extends E> fn, C cause, Supplier<String> message) throws E {
-        throw create(fn, cause, message);
-    }
-
-    public static <E extends Exception, C extends Throwable> void raiseIf(boolean condition,
-        BiFunction<? super String, ? super C, ? extends E> fn, C cause, Supplier<String> message) throws E {
-        if (condition) {
-            raise(fn, cause, message);
-        }
-    }
-
-    public static <E extends Exception, C extends Throwable> void raiseUnless(boolean condition,
-        BiFunction<? super String, ? super C, ? extends E> fn, C cause, Supplier<String> message) throws E {
-        raiseIf(!condition, fn, cause, message);
-    }
-
-    private static <T extends Throwable> T elideStackTrace(T t) {
-        final StackTraceElement[] stackTrace = t.fillInStackTrace().getStackTrace();
-        t.setStackTrace(Stream.of(stackTrace).filter(e -> !Exceptions.class.getName().equals(e.getClassName()))
-            .toArray(StackTraceElement[]::new));
-        return t;
-    }
-
-    private Exceptions() {
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java b/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java
deleted file mode 100644
index 720d1db..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/FieldAccess.java
+++ /dev/null
@@ -1,116 +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.util;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Field;
-import java.lang.reflect.Type;
-
-import org.apache.bval.util.reflection.Reflection;
-import org.apache.commons.weaver.privilizer.Privilizing;
-import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
-
-/**
- * Description: direct field access strategy.<br/>
- */
-@Privilizing(@CallTo(Reflection.class))
-public class FieldAccess extends AccessStrategy {
-
-    private final Field field;
-
-    /**
-     * Create a new FieldAccess instance.
-     * @param field
-     */
-    public FieldAccess(final Field field) {
-        this.field = field;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Object get(final Object instance) {
-        final boolean mustUnset = Reflection.setAccessible(field, true);
-        try {
-            return field.get(instance);
-        } catch (IllegalAccessException e) {
-            throw new IllegalArgumentException(e);
-        } finally {
-            if (mustUnset) {
-                Reflection.setAccessible(field, false);
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ElementType getElementType() {
-        return ElementType.FIELD;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Type getJavaType() {
-        return field.getGenericType();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getPropertyName() {
-        return field.getName();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return field.toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-
-        FieldAccess that = (FieldAccess) o;
-
-        return field.equals(that.field);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int hashCode() {
-        return field.hashCode();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/IndexedAccess.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/IndexedAccess.java b/bval-core/src/main/java/org/apache/bval/util/IndexedAccess.java
deleted file mode 100644
index ab6a937..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/IndexedAccess.java
+++ /dev/null
@@ -1,121 +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.util;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Array;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.bval.util.reflection.TypeUtils;
-
-/**
- * {@link AccessStrategy} to get an indexed member of an {@link Iterable} or
- * array object.
- */
-public class IndexedAccess extends AccessStrategy {
-    private static final TypeVariable<?> ITERABLE_TYPE = Iterable.class.getTypeParameters()[0];
-
-    /**
-     * Get the Java element type of a particular container type.
-     * 
-     * @param containerType
-     * @return Type or <code>null</code> if <code>containerType</code> is not
-     *         some type of {@link Iterable} or array
-     */
-    public static Type getJavaElementType(Type containerType) {
-        if (TypeUtils.isArrayType(containerType)) {
-            return TypeUtils.getArrayComponentType(containerType);
-        }
-        if (TypeUtils.isAssignable(containerType, Iterable.class)) {
-            Map<TypeVariable<?>, Type> typeArguments = TypeUtils.getTypeArguments(containerType, Iterable.class);
-            Type type = TypeUtils.unrollVariables(typeArguments, ITERABLE_TYPE);
-            return type != null ? type : Object.class;
-        }
-        return null;
-    }
-
-    private final Type containerType;
-    private final Integer index;
-
-    /**
-     * Create a new IndexedAccessStrategy instance.
-     * 
-     * @param containerType
-     * @param index
-     */
-    public IndexedAccess(Type containerType, Integer index) {
-        super();
-        this.containerType = containerType;
-        this.index = index;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Object get(Object instance) {
-        if (index == null) {
-            throw new UnsupportedOperationException("Cannot read null index");
-        }
-        if (instance != null && instance.getClass().isArray()) {
-            if (Array.getLength(instance) - index > 0) {
-                return Array.get(instance, index);
-            }
-        } else if (instance instanceof List<?>) {
-            List<?> list = (List<?>) instance;
-            if (list.size() - index > 0) {
-                return list.get(index);
-            }
-        } else if (instance instanceof Iterable<?>) {
-            int i = 0;
-            for (Object o : (Iterable<?>) instance) {
-                if (++i == index) {
-                    return o;
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ElementType getElementType() {
-        return ElementType.METHOD;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Type getJavaType() {
-        return getJavaElementType(containerType);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getPropertyName() {
-        return String.format("[%d]", index);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/KeyedAccess.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/KeyedAccess.java b/bval-core/src/main/java/org/apache/bval/util/KeyedAccess.java
deleted file mode 100644
index 700287d..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/KeyedAccess.java
+++ /dev/null
@@ -1,121 +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.util;
-
-import org.apache.bval.util.reflection.TypeUtils;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.util.Map;
-
-/**
- * {@link AccessStrategy} to get a keyed value from a {@link Map}. Contains
- * special handling when a string key is used against a container type whose key
- * parameter is not assignable from {@link String}: against a map whose key type
- * is an enum class, it will be interpreted as a named enum constant; other key
- * types will be compared via {@link Object#toString()}.
- */
-public class KeyedAccess extends AccessStrategy {
-    private static final TypeVariable<?>[] MAP_TYPEVARS = Map.class.getTypeParameters();
-
-    /**
-     * Get the Java element type of a particular container type.
-     * 
-     * @param containerType
-     * @return Type or <code>null</code> if <code>containerType</code> is not
-     *         some kind of {@link Map}
-     */
-    public static Type getJavaElementType(Type containerType) {
-        if (TypeUtils.isAssignable(containerType, Map.class)) {
-            Map<TypeVariable<?>, Type> typeArguments = TypeUtils.getTypeArguments(containerType, Map.class);
-            return ObjectUtils.defaultIfNull(TypeUtils.unrollVariables(typeArguments, MAP_TYPEVARS[1]), Object.class);
-        }
-        return null;
-    }
-
-    private final Type containerType;
-    private final Object key;
-
-    /**
-     * Create a new KeyedAccess instance.
-     * 
-     * @param containerType
-     * @param key
-     */
-    public KeyedAccess(Type containerType, Object key) {
-        super();
-        this.containerType = containerType;
-        this.key = key;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Object get(Object instance) {
-        if (instance instanceof Map<?, ?>) {
-            Map<?, ?> map = (Map<?, ?>) instance;
-            Map<TypeVariable<?>, Type> typeArguments = TypeUtils.getTypeArguments(containerType, Map.class);
-            Type keyType = TypeUtils.unrollVariables(typeArguments, MAP_TYPEVARS[0]);
-            if (key == null || keyType == null || TypeUtils.isInstance(key, keyType)) {
-                return map.get(key);
-            }
-            if (key instanceof String) {
-                String name = (String) key;
-                Class<?> rawKeyType = TypeUtils.getRawType(keyType, containerType);
-                if (rawKeyType.isEnum()) {
-                    @SuppressWarnings({ "unchecked", "rawtypes" })
-                    final Object result = map.get(Enum.valueOf((Class<? extends Enum>) rawKeyType, name));
-                    return result;
-                }
-                for (Map.Entry<?, ?> e : map.entrySet()) {
-                    if (name.equals(e.getKey())) {
-                        return e.getValue();
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ElementType getElementType() {
-        return ElementType.METHOD;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Type getJavaType() {
-        final Type result = getJavaElementType(containerType);
-        return result == null ? Object.class : result;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getPropertyName() {
-        return String.format("[%s]", key);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/Lazy.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/Lazy.java b/bval-core/src/main/java/org/apache/bval/util/Lazy.java
deleted file mode 100644
index 4796de3..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/Lazy.java
+++ /dev/null
@@ -1,62 +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.util;
-
-import java.util.Optional;
-import java.util.function.BiConsumer;
-import java.util.function.Consumer;
-import java.util.function.Supplier;
-
-/**
- * @since 2.0
- *
- * @param <T>
- */
-public class Lazy<T> implements Supplier<T> {
-    private T value;
-    private volatile Supplier<T> init;
-
-    public Lazy(Supplier<T> init) {
-        reset(init);
-    }
-
-    public Lazy<T> reset(Supplier<T> init) {
-        this.init = Validate.notNull(init);
-        return this;
-    }
-
-    @Override
-    public T get() {
-        if (init != null) {
-            synchronized (this) {
-                if (init != null) {
-                    value = init.get();
-                    init = null;
-                }
-            }
-        }
-        return value;
-    }
-
-    public Optional<T> optional() {
-        return Optional.ofNullable(value);
-    }
-
-    public <U> Consumer<U> consumer(BiConsumer<? super T, ? super U> delegate) {
-        return u -> delegate.accept(get(), u);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/LazyInt.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/LazyInt.java b/bval-core/src/main/java/org/apache/bval/util/LazyInt.java
deleted file mode 100644
index b866226..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/LazyInt.java
+++ /dev/null
@@ -1,49 +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.util;
-
-import java.util.OptionalInt;
-import java.util.function.IntSupplier;
-
-/**
- * @since 2.0
- */
-public class LazyInt implements IntSupplier {
-    private int value;
-    private volatile IntSupplier init;
-
-    public LazyInt(IntSupplier init) {
-        this.init = Validate.notNull(init);
-    }
-
-    @Override
-    public int getAsInt() {
-        if (init != null) {
-            synchronized (this) {
-                if (init != null) {
-                    value = init.getAsInt();
-                    init = null;
-                }
-            }
-        }
-        return value;
-    }
-
-    public synchronized OptionalInt optional() {
-        return init == null ? OptionalInt.of(value) : OptionalInt.empty();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java b/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java
deleted file mode 100644
index 298272e..0000000
--- a/bval-core/src/main/java/org/apache/bval/util/MethodAccess.java
+++ /dev/null
@@ -1,151 +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.util;
-
-import java.beans.Introspector;
-import java.lang.annotation.ElementType;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-
-import org.apache.bval.util.reflection.Reflection;
-import org.apache.commons.weaver.privilizer.Privilizing;
-import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
-
-/**
- * Description: invoke a zero-argument method (getter)<br/>
- */
-@Privilizing(@CallTo(Reflection.class))
-public class MethodAccess extends AccessStrategy {
-    private final Method method;
-    private final String propertyName;
-
-    /**
-     * Create a new MethodAccess instance.
-     * @param method
-     */
-    public MethodAccess(Method method) {
-        this(getPropertyName(method), method);
-    }
-
-    /**
-     * Create a new MethodAccess instance.
-     * @param propertyName
-     * @param method
-     */
-    public MethodAccess(String propertyName, final Method method) {
-        this.method = method;
-        this.propertyName = propertyName;
-    }
-
-    /**
-     * Process bean properties getter by applying the JavaBean naming conventions.
-     *
-     * @param member the member for which to get the property name.
-     * @return The bean method name with the "is" or "get" prefix stripped off, <code>null</code>
-     *         the method name id not according to the JavaBeans standard.
-     */
-    public static String getPropertyName(Method member) {
-        final String methodName = member.getName();
-        if (methodName.startsWith("is")) {
-            return Introspector.decapitalize(methodName.substring(2));
-        }
-        if (methodName.startsWith("get")) {
-            return Introspector.decapitalize(methodName.substring(3));
-        }
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     * normally the propertyName of the getter method, e.g.<br>
-     * method: getName() -> propertyName: name<br>
-     * method: isValid() -> propertyName: valid<br>
-     */
-    @Override
-    public String getPropertyName() {
-        return propertyName;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Object get(final Object instance) {
-        final boolean mustUnset = Reflection.setAccessible(method, true);
-        try {
-            return method.invoke(instance);
-        } catch (IllegalAccessException e) {
-            throw new IllegalArgumentException(e);
-        } catch (InvocationTargetException e) {
-            throw new IllegalArgumentException(e);
-        } finally {
-            if (mustUnset) {
-                Reflection.setAccessible(method, false);
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public ElementType getElementType() {
-        return ElementType.METHOD;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Type getJavaType() {
-        return method.getGenericReturnType();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return method.toString();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-
-        MethodAccess that = (MethodAccess) o;
-
-        return method.equals(that.method);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int hashCode() {
-        return method.hashCode();
-    }
-}


[2/8] bval git commit: remove obsolete modules, moving required core code to jsr

Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMapper.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMapper.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMapper.java
deleted file mode 100644
index 69562b8..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMapper.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.xml;
-
-import com.thoughtworks.xstream.XStream;
-
-/**
- * Description: <br/>
- */
-public class XMLMapper {
-    private static final XMLMapper instance = new XMLMapper();
-
-    private final XStream xStream;
-
-    private XMLMapper() {
-        xStream = new XStream();
-        xStream.processAnnotations(new Class[] { XMLFeaturesCapable.class, XMLMetaFeature.class, XMLMetaBean.class,
-            XMLMetaBeanInfos.class, XMLMetaBeanReference.class, XMLMetaElement.class, XMLMetaProperty.class,
-            XMLMetaValidator.class, XMLMetaValidatorReference.class });
-        xStream.setMode(XStream.NO_REFERENCES);
-    }
-
-    public static XMLMapper getInstance() {
-        return instance;
-    }
-
-    public XStream getXStream() {
-        return xStream;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBean.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBean.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBean.java
deleted file mode 100644
index 4aab9ab..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBean.java
+++ /dev/null
@@ -1,161 +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.xml;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
-import com.thoughtworks.xstream.annotations.XStreamImplicit;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Description: <br/>
- */
-@XStreamAlias("bean")
-public class XMLMetaBean extends XMLFeaturesCapable {
-    /** Serialization version */
-    private static final long serialVersionUID = 1L;
-
-    @XStreamAsAttribute()
-    private String id;
-    @XStreamAsAttribute()
-    private String name;
-    @XStreamAsAttribute()
-    private String impl;
-    @XStreamImplicit
-    private List<XMLMetaProperty> properties;
-    @XStreamImplicit
-    private List<XMLMetaBeanReference> beanRelations;
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getImpl() {
-        return impl;
-    }
-
-    public void setImpl(String impl) {
-        this.impl = impl;
-    }
-
-    public List<XMLMetaProperty> getProperties() {
-        return properties;
-    }
-
-    public void setProperties(List<XMLMetaProperty> properties) {
-        this.properties = properties;
-    }
-
-    public void addProperty(XMLMetaProperty property) {
-        if (properties == null)
-            properties = new ArrayList<XMLMetaProperty>();
-        properties.add(property);
-    }
-
-    public void putProperty(XMLMetaProperty property) {
-        if (property.getName() != null) {
-            XMLMetaProperty prop = findProperty(property.getName());
-            if (prop != null) {
-                properties.remove(prop);
-            }
-        }
-        addProperty(property);
-    }
-
-    public XMLMetaProperty removeProperty(String name) {
-        XMLMetaProperty prop = findProperty(name);
-        if (prop != null) {
-            properties.remove(prop);
-        }
-        return prop;
-    }
-
-    public XMLMetaProperty getProperty(String name) {
-        return findProperty(name);
-    }
-
-    private XMLMetaProperty findProperty(String name) {
-        if (properties == null)
-            return null;
-        for (XMLMetaProperty prop : properties) {
-            if (name.equals(prop.getName()))
-                return prop;
-        }
-        return null;
-    }
-
-    public List<XMLMetaBeanReference> getBeanRefs() {
-        return beanRelations;
-    }
-
-    public void setBeanRefs(List<XMLMetaBeanReference> beanRelations) {
-        this.beanRelations = beanRelations;
-    }
-
-    public void addBeanRef(XMLMetaBeanReference beanRelation) {
-        if (beanRelations == null)
-            beanRelations = new ArrayList<XMLMetaBeanReference>();
-        beanRelations.add(beanRelation);
-    }
-
-    public void putBeanRef(XMLMetaBeanReference beanRelation) {
-        if (beanRelation.getName() != null) {
-            XMLMetaBeanReference relation = findBeanRef(beanRelation.getName());
-            if (relation != null) {
-                beanRelations.remove(relation);
-            }
-        }
-        addBeanRef(beanRelation);
-    }
-
-    public XMLMetaBeanReference removeBeanRef(String name) {
-        XMLMetaBeanReference relation = findBeanRef(name);
-        if (relation != null) {
-            beanRelations.remove(relation);
-        }
-        return relation;
-    }
-
-    public XMLMetaBeanReference getBeanRef(String name) {
-        return findBeanRef(name);
-    }
-
-    private XMLMetaBeanReference findBeanRef(String name) {
-        if (beanRelations == null)
-            return null;
-        for (XMLMetaBeanReference relation : beanRelations) {
-            if (name.equals(relation.getName()))
-                return relation;
-        }
-        return null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanBuilder.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanBuilder.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanBuilder.java
deleted file mode 100644
index 771b169..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanBuilder.java
+++ /dev/null
@@ -1,185 +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.xml;
-
-import org.apache.bval.IntrospectorMetaBeanFactory;
-import org.apache.bval.MetaBeanBuilder;
-import org.apache.bval.MetaBeanFactory;
-import org.apache.bval.model.MetaBean;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Description: <br>
- * User: roman.stumm<br>
- * Date: 17.06.2010<br>
- * Time: 10:10:46<br>
- */
-public class XMLMetaBeanBuilder extends MetaBeanBuilder {
-    private XMLMetaBeanFactory xmlFactory;
-
-    public XMLMetaBeanBuilder(MetaBeanFactory[] factories) {
-        setFactories(factories);
-    }
-
-    public XMLMetaBeanBuilder() {
-        setFactories(new MetaBeanFactory[] { new IntrospectorMetaBeanFactory(), new XMLMetaBeanFactory() });
-    }
-
-    @Override
-    public void setFactories(MetaBeanFactory[] factories) {
-        super.setFactories(factories);
-        updateXmlFactory();
-    }
-
-    public void addLoader(XMLMetaBeanLoader loader) {
-        assertXmlFactory();
-        xmlFactory.addLoader(loader);
-    }
-
-    @Override
-    public MetaBean buildForId(String beanInfoId) throws Exception {
-        final XMLMetaBeanFactory.Visitor v;
-        assertXmlFactory();
-        xmlFactory.visitXMLBeanMeta(beanInfoId, v = new XMLMetaBeanFactory.Visitor() {
-            private MetaBean meta;
-
-            @Override
-            public MetaBean getMetaBean() {
-                return meta;
-            }
-
-            @Override
-            public void visit(XMLMetaBean xmlMeta, XMLMetaBeanInfos xmlInfos) throws Exception {
-                if (meta == null) {
-                    meta = createMetaBean(xmlMeta);
-                }
-                xmlFactory.enrichMetaBean(meta, new XMLMetaBeanFactory.XMLResult(xmlMeta, xmlInfos));
-            }
-
-        });
-        if (v.getMetaBean() == null) {
-            throw new IllegalArgumentException("MetaBean " + beanInfoId + " not found");
-        }
-        return v.getMetaBean();
-    }
-
-    @Override
-    public Map<String, MetaBean> buildAll() throws Exception {
-        final Map<String, MetaBean> all = super.buildAll();
-        if (xmlFactory != null) {
-            xmlFactory.visitXMLBeanMeta(null, new XMLMetaBeanFactory.Visitor() {
-                @Override
-                public void visit(XMLMetaBean empty, XMLMetaBeanInfos xmlInfos) throws Exception {
-                    if (xmlInfos.getBeans() == null)
-                        return; // empty file, ignore
-                    XMLMetaBeanFactory.XMLResult carrier = new XMLMetaBeanFactory.XMLResult(null, xmlInfos);
-
-                    for (XMLMetaBean xmlMeta : xmlInfos.getBeans()) {
-                        MetaBean meta = all.get(xmlMeta.getId());
-                        if (meta == null) {
-                            meta = createMetaBean(xmlMeta);
-                            all.put(xmlMeta.getId(), meta);
-                        }
-                        carrier.xmlMeta = xmlMeta;
-                        xmlFactory.enrichMetaBean(meta, carrier);
-                    }
-                }
-
-                @Override
-                public MetaBean getMetaBean() {
-                    return null; // do nothing
-                }
-            });
-        }
-        return all;
-    }
-
-    public Map<String, MetaBean> enrichCopies(Map<String, MetaBean> all, XMLMetaBeanInfos... infosArray)
-        throws Exception {
-        assertXmlFactory();
-        final Map<String, MetaBean> copies = new HashMap<String, MetaBean>(all.size());
-        boolean nothing = true;
-        XMLMetaBeanFactory.XMLResult carrier = new XMLMetaBeanFactory.XMLResult();
-        for (XMLMetaBeanInfos xmlMetaBeanInfos : infosArray) {
-            carrier.xmlInfos = xmlMetaBeanInfos;
-            if (xmlMetaBeanInfos == null)
-                continue;
-            try {
-                for (XMLMetaBean xmlMeta : xmlMetaBeanInfos.getBeans()) {
-                    nothing = false;
-                    MetaBean copy = copies.get(xmlMeta.getId());
-                    if (copy == null) { // ist noch nicht kopiert
-                        MetaBean meta = all.get(xmlMeta.getId());
-                        if (meta == null) { // gibt es nicht
-                            copy = createMetaBean(xmlMeta);
-                        } else { // gibt es, jetzt kopieren
-                            copy = meta.copy();
-                        }
-                        copies.put(xmlMeta.getId(), copy);
-                    }
-                    carrier.xmlMeta = xmlMeta;
-                    xmlFactory.enrichMetaBean(copy, carrier);
-                }
-            } catch (IOException e) {
-                xmlFactory.handleLoadException(xmlMetaBeanInfos, e);
-            }
-        }
-        if (nothing)
-            return all;
-        for (Map.Entry<String, MetaBean> entry : all.entrySet()) {
-            /*
-             * alle unveraenderten werden AUCH KOPIERT (nur zwar nur, wegen
-             * potentieller CrossReferenzen durch Relationships)
-             */
-            if (!copies.containsKey(entry.getKey())) {
-                if (entry.getValue().hasRelationships()) {
-                    copies.put(entry.getKey(), (MetaBean) entry.getValue().copy());
-                } else { // no relationship: do not clone()
-                    copies.put(entry.getKey(), entry.getValue());
-                }
-            }
-        }
-        return copies;
-    }
-
-    private MetaBean createMetaBean(XMLMetaBean xmlMeta) throws Exception {
-        return buildForClass(findLocalClass(xmlMeta.getImpl()));
-    }
-
-    private void updateXmlFactory() {
-        for (MetaBeanFactory each : getFactories()) {
-            if (each instanceof XMLMetaBeanFactory) { // use the first one!
-                xmlFactory = (XMLMetaBeanFactory) each;
-                return;
-            }
-        }
-        xmlFactory = null; // none
-    }
-
-    public XMLMetaBeanFactory getXmlFactory() {
-        return xmlFactory;
-    }
-
-    private void assertXmlFactory() {
-        if (xmlFactory == null) {
-            throw new IllegalStateException("no xmlFactory available");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanFactory.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanFactory.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanFactory.java
deleted file mode 100644
index 27407d9..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanFactory.java
+++ /dev/null
@@ -1,234 +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.xml;
-
-import org.apache.bval.MetaBeanFactory;
-import org.apache.bval.model.FeaturesCapable;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.routines.StandardValidation;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import static org.apache.bval.model.Features.Property.JAVASCRIPT_VALIDATION_FUNCTIONS;
-
-/**
- * Description: Create or enrich MetaBeans from apache beanInfos xml<br/>
- */
-public class XMLMetaBeanFactory implements MetaBeanFactory {
-    private static final Logger logger = Logger.getLogger(XMLMetaBeanFactory.class.getName());
-
-    // use LinkedHashMap to keep sequence of loaders
-    private final Map<XMLMetaBeanLoader, XMLMetaBeanInfos> resources =
-        new LinkedHashMap<XMLMetaBeanLoader, XMLMetaBeanInfos>();
-
-    private StandardValidation standardValidation = StandardValidation.getInstance();
-
-    public interface Visitor {
-        /**
-         * @param xmlMeta  - null or the bean found
-         * @param xmlInfos - all infos in a single unit (xml file)
-         * @throws Exception
-         */
-        void visit(XMLMetaBean xmlMeta, XMLMetaBeanInfos xmlInfos) throws Exception;
-
-        MetaBean getMetaBean();
-    }
-
-    public static class XMLResult {
-        public XMLMetaBean xmlMeta;
-        public XMLMetaBeanInfos xmlInfos;
-
-        public XMLResult(XMLMetaBean metaBean, XMLMetaBeanInfos metaInfos) {
-            this.xmlMeta = metaBean;
-            this.xmlInfos = metaInfos;
-        }
-
-        public XMLResult() {
-        }
-    }
-
-    @Override
-    public void buildMetaBean(final MetaBean metaBean) throws Exception {
-        if (metaBean.getId() == null)
-            return;
-        visitXMLBeanMeta(metaBean.getId(), new Visitor() {
-            @Override
-            public void visit(XMLMetaBean xmlMeta, XMLMetaBeanInfos xmlInfos) throws Exception {
-                enrichMetaBean(metaBean, new XMLResult(xmlMeta, xmlInfos));
-            }
-
-            @Override
-            public MetaBean getMetaBean() {
-                return metaBean;
-            }
-        });
-    }
-
-    /** XMLMetaBeanLoader are used to know "locations" where to get BeanInfos from. */
-    public Collection<XMLMetaBeanLoader> getLoaders() {
-        return resources.keySet();
-    }
-
-    public void addLoader(XMLMetaBeanLoader loader) {
-        resources.put(loader, null);
-    }
-
-    public StandardValidation getStandardValidation() {
-        return standardValidation;
-    }
-
-    /** customize the implementation of standardValidation for this builder. */
-    public void setStandardValidation(StandardValidation standardValidation) {
-        this.standardValidation = standardValidation;
-    }
-
-    public void enrichMetaBean(MetaBean meta, XMLResult result) throws Exception {
-        if (result.xmlMeta.getId() != null) {
-            meta.setId(result.xmlMeta.getId());
-        }
-        if (result.xmlMeta.getName() != null) {
-            meta.setName(result.xmlMeta.getName());
-        }
-        /*        if (meta.getBeanClass() == null && result.xmlMeta.getImpl() != null) {
-            meta.setBeanClass(findLocalClass(result.xmlMeta.getImpl()));
-        }*/
-        result.xmlMeta.mergeFeaturesInto(meta);
-        enrichValidations(meta, result.xmlMeta, result, false);
-        if (result.xmlMeta.getProperties() != null) {
-            for (XMLMetaProperty xmlProp : result.xmlMeta.getProperties()) {
-                enrichElement(meta, xmlProp, result);
-            }
-        }
-        if (result.xmlMeta.getBeanRefs() != null) {
-            for (XMLMetaBeanReference xmlRef : result.xmlMeta.getBeanRefs()) {
-                enrichElement(meta, xmlRef, result);
-            }
-        }
-    }
-
-    @SuppressWarnings("deprecation")
-    protected void enrichValidations(FeaturesCapable prop, XMLFeaturesCapable xmlProp, XMLResult result,
-        boolean addStandard) throws Exception {
-        if (xmlProp.getValidators() != null) {
-            // obsolete code? remove from here --->
-            String[] func = prop.getFeature(JAVASCRIPT_VALIDATION_FUNCTIONS);
-            List<String> jsValidators =
-                new ArrayList<String>(xmlProp.getValidators().size() + (func == null ? 0 : func.length));
-            if (func != null && func.length > 0) {
-                jsValidators.addAll(Arrays.asList(func));
-            } // <--- to here
-            boolean useStandard = prop instanceof MetaProperty;
-            for (XMLMetaValidatorReference valRef : xmlProp.getValidators()) {
-                if (standardValidation != null && valRef.getRefId().equals(standardValidation.getValidationId())) {
-                    useStandard = false;
-                }
-                XMLMetaValidator validator = result.xmlInfos.getValidator(valRef.getRefId());
-                if (validator != null) {
-                    if (validator.getValidation() != null) {
-                        prop.addValidation(validator.getValidation());
-                    }
-                    if (validator.getJsFunction() != null && !jsValidators.contains(validator.getJsFunction())) {
-                        jsValidators.add(validator.getJsFunction());
-                    }
-                }
-            }
-            if (!jsValidators.isEmpty()) {
-                prop.putFeature(JAVASCRIPT_VALIDATION_FUNCTIONS, jsValidators.toArray(new String[jsValidators.size()]));
-            }
-            if (useStandard && standardValidation != null) {
-                if (!prop.hasValidation(standardValidation))
-                    prop.addValidation(standardValidation);
-            }
-        } else if (addStandard && standardValidation != null && !prop.hasValidation(standardValidation)) {
-            prop.addValidation(standardValidation);
-        }
-    }
-
-    protected MetaProperty enrichElement(MetaBean meta, XMLMetaElement xmlProp, XMLResult result) throws Exception {
-        MetaProperty prop = meta.getProperty(xmlProp.getName());
-        if (prop == null) {
-            prop = new MetaProperty();
-            prop.setName(xmlProp.getName());
-            meta.putProperty(xmlProp.getName(), prop);
-        }
-        xmlProp.mergeInto(prop);
-        enrichValidations(prop, xmlProp, result, true);
-        return prop;
-    }
-
-    public void visitXMLBeanMeta(String beanId, Visitor visitor) throws Exception {
-        for (Map.Entry<XMLMetaBeanLoader, XMLMetaBeanInfos> entry : resources.entrySet()) {
-            if (entry.getValue() == null) {
-                // load when not already loaded
-                try {
-                    entry.setValue(entry.getKey().load());
-                } catch (IOException e) {
-                    handleLoadException(entry.getKey(), e);
-                }
-            }
-            if (entry.getValue() != null) { // search in loaded infos for the 'name'
-                if (beanId == null) {
-                    visitor.visit(null, entry.getValue());
-                } else {
-                    XMLMetaBean found = entry.getValue().getBean(beanId);
-                    if (found != null) {
-                        visitor.visit(found, entry.getValue());
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * find a bean by the bean-id (=bean.name)
-     *
-     * @return null or the bean found from the first loader that has it.
-     */
-    protected XMLResult findXMLBeanMeta(String beanId) {
-        for (Map.Entry<XMLMetaBeanLoader, XMLMetaBeanInfos> entry : resources.entrySet()) {
-            if (entry.getValue() == null) {
-                // load when not already loaded
-                try {
-                    entry.setValue(entry.getKey().load());
-                } catch (IOException e) {
-                    handleLoadException(entry.getKey(), e);
-                }
-            }
-            if (entry.getValue() != null) { // search in loaded infos for the 'name'
-                XMLMetaBean found = entry.getValue().getBean(beanId);
-                if (found != null) {
-                    return new XMLResult(found, entry.getValue());
-                }
-            }
-        }
-        return null; // not found!
-    }
-
-    public void handleLoadException(Object loader, IOException e) {
-        logger.log(Level.SEVERE, String.format("Error loading %s", loader), e);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanInfos.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanInfos.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanInfos.java
deleted file mode 100644
index 0126fc6..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanInfos.java
+++ /dev/null
@@ -1,139 +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.xml;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
-import com.thoughtworks.xstream.annotations.XStreamImplicit;
-import com.thoughtworks.xstream.annotations.XStreamOmitField;
-import org.apache.bval.model.Validation;
-import org.apache.bval.util.reflection.Reflection;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Description: root element of a xml-beanInfos document<br/>
- */
-@XStreamAlias("beanInfos")
-public class XMLMetaBeanInfos {
-    @XStreamAsAttribute
-    private String id;
-    @XStreamAsAttribute
-    private String version;
-    @XStreamImplicit
-    private List<XMLMetaValidator> validators;
-    @XStreamImplicit
-    private List<XMLMetaBean> beans;
-    @XStreamOmitField
-    private Map<String, XMLMetaBean> beanLookup;
-    @XStreamOmitField
-    private Map<String, XMLMetaValidator> validationLookup;
-
-    /**
-     * used for identification, may be empty, if there is no database origin for this object.
-     * could also contain a file-name - can be used flexible...
-     */
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    /**
-     * used for change-detection, when some other component caches MetaBeans based on this
-     * object. when the version changes, the cache could compare to its version state and recompute.
-     * can be used flexible...
-     */
-    public String getVersion() {
-        return version;
-    }
-
-    public void setVersion(String version) {
-        this.version = version;
-    }
-
-    public List<XMLMetaValidator> getValidators() {
-        return validators;
-    }
-
-    public void setValidators(List<XMLMetaValidator> validators) {
-        this.validators = validators;
-    }
-
-    public List<XMLMetaBean> getBeans() {
-        return beans;
-    }
-
-    public void setBeans(List<XMLMetaBean> beans) {
-        this.beans = beans;
-    }
-
-    public XMLMetaBean getBean(String id) {
-        if (beans == null)
-            return null;
-        if (beanLookup == null)
-            initBeanLookup();
-        return beanLookup.get(id);
-    }
-
-    private void initBeanLookup() {
-        final HashMap<String, XMLMetaBean> map = new HashMap<String, XMLMetaBean>(beans.size());
-        for (XMLMetaBean bean : beans) {
-            map.put(bean.getId(), bean);
-        }
-        beanLookup = new ConcurrentHashMap<String, XMLMetaBean>(map);
-    }
-
-    private void initValidationLookup() throws Exception {
-        final HashMap<String, XMLMetaValidator> map = new HashMap<String, XMLMetaValidator>(validators.size());
-        for (XMLMetaValidator xv : validators) {
-            if (xv.getJava() != null) {
-                Validation validation = (Validation) Reflection.toClass(xv.getJava())
-                                                               .getConstructor().newInstance();
-                xv.setValidation(validation);
-                map.put(xv.getId(), xv);
-            }
-        }
-        validationLookup = new ConcurrentHashMap<String, XMLMetaValidator>(map);
-    }
-
-    public void addBean(XMLMetaBean bean) {
-        if (beans == null)
-            beans = new ArrayList<XMLMetaBean>();
-        beans.add(bean);
-    }
-
-    public XMLMetaValidator getValidator(String id) throws Exception {
-        if (validators == null)
-            return null;
-        if (validationLookup == null)
-            initValidationLookup();
-        return validationLookup.get(id);
-    }
-
-    public void addValidator(XMLMetaValidator validator) {
-        if (validators == null)
-            validators = new ArrayList<XMLMetaValidator>();
-        validators.add(validator);
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanLoader.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanLoader.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanLoader.java
deleted file mode 100644
index 851c74e..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanLoader.java
+++ /dev/null
@@ -1,26 +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.xml;
-
-import java.io.IOException;
-
-/**
- * Description: XMLMetaBeanLoader are used to know "locations" where to get BeanInfos from.<br/>
- */
-public interface XMLMetaBeanLoader {
-    XMLMetaBeanInfos load() throws IOException;
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java
deleted file mode 100644
index 38c8f94..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java
+++ /dev/null
@@ -1,138 +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.xml;
-
-import org.apache.bval.MetaBeanManager;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.util.reflection.Reflection;
-import org.apache.commons.weaver.privilizer.Privilizing;
-import org.apache.commons.weaver.privilizer.Privilizing.CallTo;
-
-import java.util.Map;
-
-import static org.apache.bval.model.Features.Property.REF_BEAN_ID;
-
-/**
- * Description: internal implementation class to construct metabeans with
- * factories and from xstream xml files. You can register different
- * XMLMetaBeanLoaders (see addLoader()) to register xstream-xml-files that
- * contain meta-data. You can merge + unify meta data with method
- * enrichCopies(). <br/>
- * User: roman.stumm<br>
- * Date: 17.06.2010<br>
- * Time: 09:47:14<br>
- */
-@Privilizing(@CallTo(Reflection.class))
-public class XMLMetaBeanManager extends MetaBeanManager implements XMLMetaBeanRegistry, MetaBeanEnricher {
-    public XMLMetaBeanManager() {
-        this(new XMLMetaBeanBuilder());
-    }
-
-    public XMLMetaBeanManager(XMLMetaBeanBuilder builder) {
-        super(builder);
-    }
-
-    @Override
-    public void addResourceLoader(String resource) {
-        addLoader(new XMLMetaBeanURLLoader(Reflection.getClassLoader(getClass()).getResource(resource)));
-    }
-
-    @Override
-    public synchronized void addLoader(XMLMetaBeanLoader loader) {
-        ((XMLMetaBeanBuilder) builder).addLoader(loader);
-        cache.clear(); // clear because new loaders can affect ALL MetaBeans
-                       // already created!
-        complete = false;
-    }
-
-    /**
-     * @param infos
-     *            - the patches to apply
-     * @return all MetaBeans for classes that have a xml descriptor and
-     *         additional the MetaBeans loaded by the given loaders. The given
-     *         loaders may also return patches for MetaBeans that have also been
-     *         returned by other loaders. The beans with patches for references
-     *         to patched beans will be copied.
-     */
-    @Override
-    public Map<String, MetaBean> enrichCopies(XMLMetaBeanInfos... infos) {
-        Map<String, MetaBean> cached = findAll();
-        try {
-            Map<String, MetaBean> patched = ((XMLMetaBeanBuilder) builder).enrichCopies(cached, infos);
-            for (Object entry : patched.values()) {
-                MetaBean meta = (MetaBean) entry;
-                computeRelationships(meta, patched);
-            }
-            return patched;
-        } catch (RuntimeException e) {
-            throw e; // do not wrap runtime exceptions
-        } catch (Exception e) {
-            throw new IllegalArgumentException("error enriching beanInfos", e);
-        }
-    }
-
-    /**
-     * 
-     * @return all MetaBeans for classes that have a xml descriptor: key =
-     *         bean.id, value = MetaBean
-     */
-    public Map<String, MetaBean> findAll() {
-        if (!complete) {
-            try {
-                Map<String, MetaBean> allBuilt = builder.buildAll();
-                for (MetaBean meta : allBuilt.values()) {
-                    MetaBean cached = cache.findForId(meta.getId());
-                    if (cached == null) {
-                        cache.cache(meta);
-                    }
-                }
-                Map<String, MetaBean> map = cache.findAll();
-                for (Object oentry : map.values()) {
-                    MetaBean meta = (MetaBean) oentry;
-                    computeRelationships(meta, map);
-                }
-                complete = true;
-                return map;
-            } catch (RuntimeException e) {
-                throw e; // do not wrap runtime exceptions
-            } catch (Exception e) {
-                throw new IllegalArgumentException("error creating beanInfos", e);
-            }
-        } else {
-            return cache.findAll();
-        }
-    }
-
-    protected void computeRelationships(MetaBean beanInfo, Map<String, MetaBean> cached) {
-        for (MetaProperty prop : beanInfo.getProperties()) {
-            String beanRef = (String) prop.getFeature(REF_BEAN_ID);
-            if (beanRef != null) {
-                prop.setMetaBean(cached.get(beanRef));
-            }
-        }
-    }
-
-    @Override
-    protected void computeRelatedMetaBean(MetaProperty prop, String beanRef) {
-        if (beanRef != null) {
-            prop.setMetaBean(findForId(beanRef));
-        } else {
-            super.computeRelatedMetaBean(prop, beanRef);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManagerFactory.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManagerFactory.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManagerFactory.java
deleted file mode 100644
index 2fea938..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManagerFactory.java
+++ /dev/null
@@ -1,62 +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.xml;
-
-import org.apache.bval.MetaBeanFinder;
-
-/**
- * Description: <br>
- * User: roman.stumm<br>
- * Date: 17.06.2010<br>
- * Time: 10:06:37<br>
- */
-public class XMLMetaBeanManagerFactory {
-    private static XMLMetaBeanManager manager = new XMLMetaBeanManager();
-
-    /**
-    * global meta bean finder.
-    * @return
-    */
-    public static MetaBeanFinder getFinder() {
-        return manager;
-    }
-
-    /**
-     * set global meta bean manager, that is responsible
-     * for finding, caching, xml registry and enrichment algorithm.
-     * @param finder
-     */
-    public static void setManager(XMLMetaBeanManager finder) {
-        manager = finder;
-    }
-
-    /**
-     * global meta bean registry
-     * @return
-     */
-    public static XMLMetaBeanRegistry getRegistry() {
-        return manager;
-    }
-
-    /**
-     * global meta bean enricher
-     * @return
-     */
-    public static MetaBeanEnricher getEnricher() {
-        return manager;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanReference.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanReference.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanReference.java
deleted file mode 100644
index 9bc1153..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanReference.java
+++ /dev/null
@@ -1,58 +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.xml;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
-import org.apache.bval.model.Features;
-import org.apache.bval.model.MetaProperty;
-
-/**
- * Description: <br/>
- */
-@XStreamAlias("relationship")
-public class XMLMetaBeanReference extends XMLMetaElement {
-    /** Serialization version */
-    private static final long serialVersionUID = 1L;
-
-    @XStreamAsAttribute
-    private String beanId;
-
-    public XMLMetaBeanReference(String refId) {
-        this.beanId = refId;
-    }
-
-    public XMLMetaBeanReference() {
-    }
-
-    /** id of referenced target bean of the relationship */
-    public String getBeanId() {
-        return beanId;
-    }
-
-    public void setBeanId(String beanId) {
-        this.beanId = beanId;
-    }
-
-    @Override
-    public void mergeInto(MetaProperty prop) throws ClassNotFoundException {
-        super.mergeInto(prop); // call super!
-        if (getBeanId() != null) {
-            prop.putFeature(Features.Property.REF_BEAN_ID, getBeanId());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanRegistry.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanRegistry.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanRegistry.java
deleted file mode 100644
index ef11f98..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanRegistry.java
+++ /dev/null
@@ -1,35 +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.xml;
-
-/**
- * Description: Interface of the object that holds all XMLMetaBeanLoaders <br/>
- */
-public interface XMLMetaBeanRegistry {
-    /**
-     * add a loader for xml bean infos.
-     * the registry should use the loader in the sequence they have been added.
-     */
-    void addLoader(XMLMetaBeanLoader loader);
-
-    /**
-     * convenience method to add a loader for a xml file in the classpath
-     *
-     * @param resource - path of xml file in classpath
-     */
-    void addResourceLoader(String resource);
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanURLLoader.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanURLLoader.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanURLLoader.java
deleted file mode 100644
index d26d0ef..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanURLLoader.java
+++ /dev/null
@@ -1,46 +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.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-/**
- * Description: <br/>
- */
-public class XMLMetaBeanURLLoader implements XMLMetaBeanLoader {
-    private final URL url;
-
-    public XMLMetaBeanURLLoader(URL url) {
-        if (url == null)
-            throw new NullPointerException("URL required");
-        this.url = url;
-    }
-
-    @Override
-    public XMLMetaBeanInfos load() throws IOException {
-        InputStream stream = url.openStream();
-        try {
-            XMLMetaBeanInfos beanInfos = (XMLMetaBeanInfos) XMLMapper.getInstance().getXStream().fromXML(stream);
-            beanInfos.setId(url.toExternalForm());
-            return beanInfos;
-        } finally {
-            stream.close();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaElement.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaElement.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaElement.java
deleted file mode 100644
index 09da499..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaElement.java
+++ /dev/null
@@ -1,148 +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.xml;
-
-import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.util.reflection.Reflection;
-
-import static org.apache.bval.model.Features.Property.DENIED;
-import static org.apache.bval.model.Features.Property.HIDDEN;
-import static org.apache.bval.model.Features.Property.MANDATORY;
-import static org.apache.bval.model.Features.Property.MAX_LENGTH;
-import static org.apache.bval.model.Features.Property.MIN_LENGTH;
-import static org.apache.bval.model.Features.Property.READONLY;
-
-/**
- * Description: <br/>
- */
-public class XMLMetaElement extends XMLFeaturesCapable {
-    /** Serialization version */
-    private static final long serialVersionUID = 1L;
-
-    @XStreamAsAttribute()
-    private String name;
-    @XStreamAsAttribute()
-    private String mandatory;
-
-    @XStreamAsAttribute()
-    private Integer minLength;
-    @XStreamAsAttribute()
-    private Integer maxLength;
-    @XStreamAsAttribute()
-    private Boolean readonly;
-    @XStreamAsAttribute()
-    private Boolean hidden;
-    @XStreamAsAttribute()
-    private Boolean denied;
-    /**
-     * normally the type is determined by the implementation class.
-     * in case, no implementation class is given, the xml can
-     * contain the type directly.
-     */
-    @XStreamAsAttribute()
-    private String type;
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getMandatory() {
-        return mandatory;
-    }
-
-    public void setMandatory(String mandatory) {
-        this.mandatory = mandatory;
-    }
-
-    public Integer getMinLength() {
-        return minLength;
-    }
-
-    public void setMinLength(Integer minLength) {
-        this.minLength = minLength;
-    }
-
-    public Integer getMaxLength() {
-        return maxLength;
-    }
-
-    public void setMaxLength(Integer maxLength) {
-        this.maxLength = maxLength;
-    }
-
-    public Boolean getReadonly() {
-        return readonly;
-    }
-
-    public void setReadonly(Boolean readonly) {
-        this.readonly = readonly;
-    }
-
-    public Boolean getDenied() {
-        return denied;
-    }
-
-    public void setDenied(Boolean denied) {
-        this.denied = denied;
-    }
-
-    public Boolean getHidden() {
-        return hidden;
-    }
-
-    public void setHidden(Boolean hidden) {
-        this.hidden = hidden;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    public void mergeInto(MetaProperty prop) throws ClassNotFoundException {
-        mergeFeaturesInto(prop);
-        if (getType() != null && getType().length() > 0) {
-            prop.setType(Reflection.toClass(getType())); // enhancement: or use getGenericType() ?
-        }
-        if (getHidden() != null) {
-            prop.putFeature(HIDDEN, getHidden().booleanValue());
-        }
-        if (getMandatory() != null) {
-            prop.putFeature(MANDATORY, getMandatory().equals("true"));
-        }
-        if (getMaxLength() != null) {
-            prop.putFeature(MAX_LENGTH, getMaxLength());
-        }
-        if (getMinLength() != null) {
-            prop.putFeature(MIN_LENGTH, getMinLength());
-        }
-        if (getReadonly() != null) {
-            prop.putFeature(READONLY, getReadonly());
-        }
-        if (getDenied() != null) {
-            prop.putFeature(DENIED, getDenied());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaFeature.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaFeature.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaFeature.java
deleted file mode 100644
index 79776b7..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaFeature.java
+++ /dev/null
@@ -1,60 +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.xml;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
-
-import java.io.Serializable;
-
-/**
- * Description: <br/>
- */
-@XStreamAlias("feature")
-public class XMLMetaFeature implements Serializable {
-    /** Serialization version */
-    private static final long serialVersionUID = 1L;
-
-    @XStreamAsAttribute
-    private String key;
-    @XStreamAsAttribute
-    private Object value;
-
-    public XMLMetaFeature(String key, Object value) {
-        this.key = key;
-        this.value = value;
-    }
-
-    public XMLMetaFeature() {
-    }
-
-    public String getKey() {
-        return key;
-    }
-
-    public void setKey(String key) {
-        this.key = key;
-    }
-
-    public Object getValue() {
-        return value;
-    }
-
-    public void setValue(Object value) {
-        this.value = value;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaProperty.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaProperty.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaProperty.java
deleted file mode 100644
index 4b22f37..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaProperty.java
+++ /dev/null
@@ -1,104 +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.xml;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
-import org.apache.bval.model.MetaProperty;
-
-import static org.apache.bval.model.Features.Property.MAX_VALUE;
-import static org.apache.bval.model.Features.Property.MIN_VALUE;
-import static org.apache.bval.model.Features.Property.REG_EXP;
-import static org.apache.bval.model.Features.Property.TIME_LAG;
-
-/**
- * Description: <br/>
- */
-@XStreamAlias("property")
-public class XMLMetaProperty extends XMLMetaElement {
-    /** Serialization version */
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * if you need other types (Long, double, String) for maxValue and
-     * minValue, configure via
-     * <pre>
-     * &lt;feature key="maxValue">
-     *   &lt;value class="java.lang.Long">1000&lt;/value>
-     * &lt;/feature>
-     * </pre>
-     * instead with explicit typing.
-     */
-    @XStreamAsAttribute()
-    private Integer maxValue; // XStream requires a non-abstract type to parse XML
-    @XStreamAsAttribute()
-    private Integer minValue; // XStream requires a non-abstract type to parse XML
-
-    private String regexp;
-
-    @XStreamAsAttribute()
-    private String timeLag;
-
-    public Integer getMaxValue() {
-        return maxValue;
-    }
-
-    public void setMaxValue(Integer maxValue) {
-        this.maxValue = maxValue;
-    }
-
-    public Integer getMinValue() {
-        return minValue;
-    }
-
-    public void setMinValue(Integer minValue) {
-        this.minValue = minValue;
-    }
-
-    public String getRegexp() {
-        return regexp;
-    }
-
-    public void setRegexp(String regexp) {
-        this.regexp = regexp;
-    }
-
-    public String getTimeLag() {
-        return timeLag;
-    }
-
-    public void setTimeLag(String timeLag) {
-        this.timeLag = timeLag;
-    }
-
-    @Override
-    public void mergeInto(MetaProperty prop) throws ClassNotFoundException {
-        super.mergeInto(prop); // call super!
-        if (getMaxValue() != null) {
-            prop.putFeature(MAX_VALUE, getMaxValue());
-        }
-        if (getMinValue() != null) {
-            prop.putFeature(MIN_VALUE, getMinValue());
-        }
-        if (getRegexp() != null) {
-            prop.putFeature(REG_EXP, getRegexp());
-        }
-        if (getTimeLag() != null) {
-            prop.putFeature(TIME_LAG, getTimeLag());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidator.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidator.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidator.java
deleted file mode 100644
index 9bb7f95..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidator.java
+++ /dev/null
@@ -1,77 +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.xml;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
-import com.thoughtworks.xstream.annotations.XStreamOmitField;
-import org.apache.bval.model.Validation;
-
-import java.io.Serializable;
-
-/**
- * Description: <br/>
- */
-@XStreamAlias("validator")
-public class XMLMetaValidator implements Serializable {
-
-    @XStreamOmitField
-    private static final long serialVersionUID = 1L;
-
-    @XStreamAsAttribute
-    private String id;
-    @XStreamAsAttribute
-    private String java; // implementation of Validation
-
-    @XStreamAsAttribute
-    private String jsFunction; // name of java script function
-
-    @XStreamOmitField
-    private transient Validation validation;
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public String getJava() {
-        return java;
-    }
-
-    public void setJava(String java) {
-        this.java = java;
-    }
-
-    public void setValidation(Validation validation) {
-        this.validation = validation;
-    }
-
-    public Validation getValidation() {
-        return validation;
-    }
-
-    public String getJsFunction() {
-        return jsFunction;
-    }
-
-    public void setJsFunction(String jsFunction) {
-        this.jsFunction = jsFunction;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidatorReference.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidatorReference.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidatorReference.java
deleted file mode 100644
index c6627c5..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidatorReference.java
+++ /dev/null
@@ -1,49 +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.xml;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
-
-import java.io.Serializable;
-
-/**
- * Description: <br/>
- */
-@XStreamAlias("validator-ref")
-public class XMLMetaValidatorReference implements Serializable {
-    /** Serialization version */
-    private static final long serialVersionUID = 1L;
-
-    @XStreamAsAttribute
-    private String refId;
-
-    public XMLMetaValidatorReference(String id) {
-        this.refId = id;
-    }
-
-    public XMLMetaValidatorReference() {
-    }
-
-    public String getRefId() {
-        return refId;
-    }
-
-    public void setRefId(String refId) {
-        this.refId = refId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValue.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValue.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValue.java
deleted file mode 100644
index 9da06ec..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValue.java
+++ /dev/null
@@ -1,34 +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.xml;
-
-/**
- * Description: <br/>
- */
-public interface XMLMetaValue {
-    // keys for Annotations
-    public static final String ANNOKEY_Widget = "WIDGET";
-    public static final String ANNOKEY_TableColumn = "TABLE_COLUMN";
-
-    // values for TIMELAG
-    public static final String TIMELAG_Past = "PAST";
-    public static final String TIMELAG_Future = "FUTURE";
-
-    // values for MANDATORY
-    public static final String MANDATORY = "true";
-    public static final String OPTIONAL = "false";
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/java/org/apache/bval/example/BusinessEnum.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/test/java/org/apache/bval/example/BusinessEnum.java b/bval-xstream/src/test/java/org/apache/bval/example/BusinessEnum.java
deleted file mode 100644
index 1d793f6..0000000
--- a/bval-xstream/src/test/java/org/apache/bval/example/BusinessEnum.java
+++ /dev/null
@@ -1,24 +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.example;
-
-/**
- * Description: <br/>
- */
-public enum BusinessEnum {
-                          VALUE1, VALUE2, VALUE3
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/java/org/apache/bval/example/BusinessObject.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/test/java/org/apache/bval/example/BusinessObject.java b/bval-xstream/src/test/java/org/apache/bval/example/BusinessObject.java
deleted file mode 100644
index 4b511d5..0000000
--- a/bval-xstream/src/test/java/org/apache/bval/example/BusinessObject.java
+++ /dev/null
@@ -1,125 +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.example;
-
-import java.sql.Timestamp;
-import java.util.Date;
-import java.util.List;
-
-/**
- * Description: <br/>
- */
-public class BusinessObject {
-    private long userId;
-    private int numericValue;
-    private String firstName, lastName, title;
-    private Date dateBirth;
-    private Timestamp validTo;
-    private String email;
-    private BusinessEnum choice;
-    private BusinessObjectAddress address;
-    private List<BusinessObjectAddress> addresses;
-
-    public BusinessEnum getChoice() {
-        return choice;
-    }
-
-    public void setChoice(BusinessEnum choice) {
-        this.choice = choice;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public Date getDateBirth() {
-        return dateBirth;
-    }
-
-    public void setDateBirth(Date dateBirth) {
-        this.dateBirth = dateBirth;
-    }
-
-    public Timestamp getValidTo() {
-        return validTo;
-    }
-
-    public void setValidTo(Timestamp validTo) {
-        this.validTo = validTo;
-    }
-
-    public String getEmail() {
-        return email;
-    }
-
-    public void setEmail(String email) {
-        this.email = email;
-    }
-
-    public BusinessObjectAddress getAddress() {
-        return address;
-    }
-
-    public void setAddress(BusinessObjectAddress address) {
-        this.address = address;
-    }
-
-    public void setNumericValue(int newNumericValue) {
-        numericValue = newNumericValue;
-    }
-
-    public int getNumericValue() {
-        return numericValue;
-    }
-
-    public String getFirstName() {
-        return firstName;
-    }
-
-    public void setFirstName(String firstName) {
-        this.firstName = firstName;
-    }
-
-    public String getLastName() {
-        return lastName;
-    }
-
-    public void setLastName(String lastName) {
-        this.lastName = lastName;
-    }
-
-    public long getUserId() {
-        return userId;
-    }
-
-    public void setUserId(long userId) {
-        this.userId = userId;
-    }
-
-    public List<BusinessObjectAddress> getAddresses() {
-        return addresses;
-    }
-
-    public void setAddresses(List<BusinessObjectAddress> addresses) {
-        this.addresses = addresses;
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectAddress.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectAddress.java b/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectAddress.java
deleted file mode 100644
index 9a6c18b..0000000
--- a/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectAddress.java
+++ /dev/null
@@ -1,49 +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.example;
-
-/**
- * Description: <br/>
- */
-public class BusinessObjectAddress {
-    private String city, country;
-    private BusinessObject owner;
-
-    public String getCity() {
-        return city;
-    }
-
-    public void setCity(String city) {
-        this.city = city;
-    }
-
-    public String getCountry() {
-        return country;
-    }
-
-    public void setCountry(String country) {
-        this.country = country;
-    }
-
-    public BusinessObject getOwner() {
-        return owner;
-    }
-
-    public void setOwner(BusinessObject owner) {
-        this.owner = owner;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectBeanInfo.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectBeanInfo.java b/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectBeanInfo.java
deleted file mode 100644
index 2d6fb78..0000000
--- a/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectBeanInfo.java
+++ /dev/null
@@ -1,64 +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.example;
-
-import org.apache.bval.model.Features;
-
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.PropertyDescriptor;
-import java.beans.SimpleBeanInfo;
-
-/**
- * Description: <br/>
- */
-public class BusinessObjectBeanInfo extends SimpleBeanInfo {
-    Class<?> targetClass = BusinessObject.class;
-
-    @Override
-    public BeanInfo[] getAdditionalBeanInfo() {
-        ExplicitBeanInfo bi = new ExplicitBeanInfo();
-        bi.setPropertyDescriptors(_getPropertyDescriptors());
-        return new BeanInfo[] { bi };
-    }
-
-    public PropertyDescriptor[] _getPropertyDescriptors() {
-        try {
-            PropertyDescriptor numericValue =
-                new PropertyDescriptor("numericValue", targetClass, "getNumericValue", "setNumericValue");
-            numericValue.setValue(Features.Property.MAX_VALUE, new Integer(100));
-            numericValue.setValue(Features.Property.MIN_VALUE, new Integer(-100));
-            return new PropertyDescriptor[] { numericValue };
-        } catch (IntrospectionException ex) {
-            ex.printStackTrace();
-            return null;
-        }
-    }
-}
-
-class ExplicitBeanInfo extends SimpleBeanInfo {
-    private PropertyDescriptor[] propertyDescriptors;
-
-    @Override
-    public PropertyDescriptor[] getPropertyDescriptors() {
-        return propertyDescriptors;
-    }
-
-    public void setPropertyDescriptors(PropertyDescriptor[] propertyDescriptors) {
-        this.propertyDescriptors = propertyDescriptors;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java b/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java
deleted file mode 100644
index 862d39b..0000000
--- a/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java
+++ /dev/null
@@ -1,224 +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.routines;
-
-import static org.junit.Assert.assertTrue;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.bval.BeanValidationContext;
-import org.apache.bval.model.Features;
-import org.apache.bval.model.Features.Property;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.model.ValidationContext;
-import org.apache.bval.model.ValidationListener;
-import org.apache.bval.xml.XMLMetaValue;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * StandardValidation Tester.
- */
-public class StandardValidationTest implements ValidationListener {
-    private StandardValidation validation;
-    private BeanValidationContext<StandardValidationTest> context;
-    private List<String> reasons = new ArrayList<String>();
-    private MetaProperty metaProperty;
-    private String stringValue;
-    private Date dateValue;
-    private int intValue;
-
-    @Before
-    public void setUp() throws Exception {
-        validation = new StandardValidation();
-        context = new BeanValidationContext<StandardValidationTest>(this);
-        metaProperty = new MetaProperty();
-        context.setBean(this, null);
-        context.setMetaProperty(metaProperty);
-    }
-
-    public String getStringValue() {
-        return stringValue;
-    }
-
-    @Test
-    public void testValidateMandatory() {
-        metaProperty.setName("stringValue");
-
-        // test not-null value that is mandatory
-        metaProperty.setMandatory(true);
-        stringValue = "some value";
-        validation.validateMandatory(context);
-        assertTrue(reasons.isEmpty());
-
-        // test null value that is mandatory
-        context.unknownValue();
-        stringValue = null;
-        validation.validateMandatory(context);
-        assertTrue(reasons.contains(Property.MANDATORY));
-
-        // test null value that is NOT mandatory
-        context.unknownValue();
-        metaProperty.setMandatory(false);
-        reasons.clear();
-        validation.validateMandatory(context);
-        assertTrue(reasons.isEmpty());
-    }
-
-    public void testValidateMaxLength() {
-        metaProperty.setName("stringValue");
-        metaProperty.putFeature(Features.Property.MAX_LENGTH, 5);
-        stringValue = "1234";
-        validation.validateMaxLength(context);
-        assertTrue(reasons.isEmpty());
-        context.unknownValue();
-        stringValue = "much too long";
-        validation.validateMaxLength(context);
-        assertTrue(reasons.contains(Property.MAX_LENGTH));
-    }
-
-    @Test
-    public void testValidateMinLength() {
-        metaProperty.setName("stringValue");
-        metaProperty.putFeature(Features.Property.MIN_LENGTH, 5);
-        stringValue = "123456";
-        validation.validateMinLength(context);
-        assertTrue(reasons.isEmpty());
-        context.unknownValue();
-        stringValue = "123";
-        validation.validateMinLength(context);
-        assertTrue(reasons.contains(Property.MIN_LENGTH));
-    }
-
-    @Test
-    public void testValidateMaxValue() {
-        metaProperty.setName("stringValue");
-        metaProperty.putFeature(Features.Property.MAX_VALUE, "9999");
-        stringValue = "1111";
-        validation.validateMaxValue(context);
-        assertTrue(reasons.isEmpty());
-        context.unknownValue();
-        stringValue = "99999";
-        validation.validateMaxValue(context);
-        assertTrue(reasons.contains(Property.MAX_VALUE));
-    }
-
-    @Test
-    public void testValidateMinValue() {
-        metaProperty.setName("stringValue");
-        metaProperty.putFeature(Features.Property.MIN_VALUE, "5555");
-        stringValue = "8888";
-        validation.validateMinValue(context);
-        assertTrue(reasons.isEmpty());
-        context.unknownValue();
-        stringValue = "3333";
-        validation.validateMinValue(context);
-        assertTrue(reasons.contains(Property.MIN_VALUE));
-    }
-
-    public int getIntValue() {
-        return intValue;
-    }
-
-    @Test
-    public void testValidateMinValue_MixedNumber() {
-        metaProperty.setName("intValue");
-        metaProperty.putFeature(Features.Property.MIN_VALUE, new Long(0));
-        intValue = 5;
-        validation.validateMinValue(context);
-        assertTrue(reasons.isEmpty());
-        context.unknownValue();
-        intValue = -1;
-        validation.validateMinValue(context);
-        assertTrue(reasons.contains(Property.MIN_VALUE));
-    }
-
-    @Test
-    public void testValidateMinValue_Date_Timestamp() {
-        metaProperty.setName("dateValue");
-        Date dt = new Date();
-        metaProperty.putFeature(Features.Property.MIN_VALUE, dt);
-        dateValue = new Timestamp(dt.getTime() + 1000);
-        validation.validateMinValue(context);
-        assertTrue(reasons.isEmpty());
-        context.unknownValue();
-        dateValue = new Timestamp(dt.getTime() - 1000);
-        validation.validateMinValue(context);
-        assertTrue(reasons.contains(Property.MIN_VALUE));
-    }
-
-    @Test
-    public void testValidateMaxValue_AlphabeticString() {
-        metaProperty.setName("stringValue");
-        metaProperty.putFeature(Features.Property.MAX_VALUE, "BBBB");
-        stringValue = "AAAA";
-        validation.validateMaxValue(context);
-        assertTrue(reasons.isEmpty());
-        context.unknownValue();
-        stringValue = "BBBC";
-        validation.validateMaxValue(context);
-        assertTrue(reasons.contains(Property.MAX_VALUE));
-    }
-
-    @Test
-    public void testValidateRegExp() {
-        // regexp for Zip
-        String regexp = "[a-zA-Z\\- \\d]*";
-        metaProperty.setName("stringValue");
-        metaProperty.putFeature(Features.Property.REG_EXP, regexp);
-        stringValue = "53773";
-        validation.validateRegExp(context);
-        assertTrue(reasons.isEmpty());
-        context.unknownValue();
-        stringValue = "5355/7"; // invalid zip value
-        validation.validateRegExp(context);
-        assertTrue(reasons.contains(Property.REG_EXP));
-    }
-
-    public Date getDateValue() {
-        return dateValue;
-    }
-
-    @Test
-    public void testValidateTimeLag() {
-        metaProperty.setName("dateValue");
-        metaProperty.putFeature(Features.Property.TIME_LAG, XMLMetaValue.TIMELAG_Past);
-
-        dateValue = new Date(System.currentTimeMillis() - 10000);
-        validation.validateTimeLag(context);
-        assertTrue(reasons.isEmpty());
-
-        metaProperty.putFeature(Features.Property.TIME_LAG, XMLMetaValue.TIMELAG_Future);
-        validation.validateTimeLag(context);
-        assertTrue(reasons.contains(Property.TIME_LAG));
-
-    }
-
-    @Override
-    public <T extends ValidationListener> void addError(String reason, ValidationContext<T> context) {
-        reasons.add(reason);
-    }
-
-    @Override
-    public <T extends ValidationListener> void addError(ValidationListener.Error error, ValidationContext<T> context) {
-        reasons.add(error.getReason());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java b/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java
deleted file mode 100644
index e7ea584..0000000
--- a/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java
+++ /dev/null
@@ -1,105 +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.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.apache.bval.BeanValidator;
-import org.apache.bval.MetaBeanFinder;
-import org.apache.bval.ValidationResults;
-import org.apache.bval.example.BusinessObject;
-import org.apache.bval.example.BusinessObjectAddress;
-import org.apache.bval.model.Features;
-import org.apache.bval.model.Features.Property;
-import org.apache.bval.model.MetaBean;
-import org.junit.Test;
-
-/**
- * BeanValidator Tester.
- */
-public class BeanValidatorTest {
-
-    @Test
-    public void testValidateMapAsBean() {
-        XMLMetaBeanManagerFactory.getRegistry()
-            .addLoader(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos.xml")));
-
-        MetaBean mb = XMLMetaBeanManagerFactory.getFinder().findForId("org.apache.bval.example.Address");
-
-        // 1. validate a bean
-        BusinessObjectAddress adr = new BusinessObjectAddress();
-        BeanValidator<ValidationResults> validator = new BeanValidator<ValidationResults>();
-        ValidationResults results = validator.validate(adr, mb);
-        assertEquals(2, results.getErrorsByReason().get(Features.Property.MANDATORY).size());
-
-        // 2. validate a map with the same metabean
-        validator.setTreatMapsLikeBeans(true);
-        results = validator.validate(new HashMap<String, Object>(), mb);
-        assertFalse(results.isEmpty());
-        assertEquals(2, results.getErrorsByReason().get(Features.Property.MANDATORY).size());
-
-        // 3. validate as empty map (jsr303 behavior)
-        validator.setTreatMapsLikeBeans(false);
-        results = validator.validate(new HashMap<Object, Object>(), mb);
-        assertTrue(results.isEmpty());
-    }
-
-    @Test
-    public void testValidate() {
-        MetaBeanFinder finder = XMLMetaBeanManagerFactory.getFinder();
-        XMLMetaBeanManagerFactory.getRegistry()
-            .addLoader(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos.xml")));
-        MetaBean info = finder.findForClass(BusinessObject.class);
-        BusinessObject object = new BusinessObject();
-        object.setAddress(new BusinessObjectAddress());
-        object.getAddress().setOwner(object);
-        BeanValidator<ValidationResults> validator = new BeanValidator<ValidationResults>();
-        ValidationResults results = validator.validate(object, info);
-        assertTrue(results.hasErrorForReason(Property.MANDATORY));
-        assertTrue(results.hasError(object, null));
-        assertTrue(results.hasError(object.getAddress(), null));
-
-        assertTrue(validator.validateProperty(object, info.getProperty("firstName")).hasError(object, "firstName"));
-
-        object.setUserId(1L);
-        object.setFirstName("Hans");
-        object.setLastName("Tester");
-        object.setAddress(new BusinessObjectAddress());
-        object.getAddress().setOwner(object);
-        assertFalse(validator.validate(object, info).isEmpty());
-
-        object.getAddress().setCountry("0123456789012345678");
-        assertFalse(validator.validate(object, info).isEmpty());
-
-        object.getAddress().setCountry("Germany");
-        object.setAddresses(new ArrayList<BusinessObjectAddress>());
-        object.getAddresses().add(object.getAddress());
-        object.getAddresses().add(object.getAddress());
-        object.getAddresses().add(object.getAddress());
-        assertTrue(validator.validate(object, info).isEmpty());
-
-        // 4th address is too much!
-        object.getAddresses().add(object.getAddress());
-        assertFalse(validator.validate(object, info).isEmpty()); // cardinality error found
-    }
-
-}


[3/8] bval git commit: remove obsolete modules, moving required core code to jsr

Posted by mb...@apache.org.
http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/src/main/java/org/apache/bval/util/reflection/TypeUtils.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/main/java/org/apache/bval/util/reflection/TypeUtils.java b/bval-jsr/src/main/java/org/apache/bval/util/reflection/TypeUtils.java
new file mode 100644
index 0000000..a75e1ad
--- /dev/null
+++ b/bval-jsr/src/main/java/org/apache/bval/util/reflection/TypeUtils.java
@@ -0,0 +1,1557 @@
+/*
+ * 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.util.reflection;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Stream;
+
+import org.apache.bval.util.ObjectUtils;
+import org.apache.bval.util.Validate;
+
+/**
+ * Taken from commons-lang3.
+ *
+ * <p> Utility methods focusing on type inspection, particularly with regard to
+ * generics. </p>
+ *
+ * @since 1.1.2
+ */
+public class TypeUtils {
+
+    /**
+     * {@link WildcardType} builder.
+     */
+    public static class WildcardTypeBuilder {
+        /**
+         * Constructor
+         */
+        private WildcardTypeBuilder() {
+        }
+        
+        private Type[] upperBounds;
+        private Type[] lowerBounds;
+
+        /**
+         * Specify upper bounds of the wildcard type to build.
+         * @param bounds to set
+         * @return {@code this}
+         */
+        public WildcardTypeBuilder withUpperBounds(final Type... bounds) {
+            this.upperBounds = bounds;
+            return this;
+        }
+
+        /**
+         * Specify lower bounds of the wildcard type to build.
+         * @param bounds to set
+         * @return {@code this}
+         */
+        public WildcardTypeBuilder withLowerBounds(final Type... bounds) {
+            this.lowerBounds = bounds;
+            return this;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public WildcardType build() {
+            return new WildcardTypeImpl(upperBounds, lowerBounds);
+        }
+    }
+
+    /**
+     * ParameterizedType implementation class.
+     */
+    private static final class ParameterizedTypeImpl implements ParameterizedType {
+        private final Class<?> raw;
+        private final Type useOwner;
+        private final Type[] typeArguments;
+
+        /**
+         * Constructor
+         * @param raw type
+         * @param useOwner owner type to use, if any
+         * @param typeArguments formal type arguments
+         */
+        private ParameterizedTypeImpl(final Class<?> raw, final Type useOwner, final Type[] typeArguments) {
+            this.raw = raw;
+            this.useOwner = useOwner;
+            this.typeArguments = typeArguments.clone();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Type getRawType() {
+            return raw;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Type getOwnerType() {
+            return useOwner;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Type[] getActualTypeArguments() {
+            return typeArguments.clone();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String toString() {
+            return TypeUtils.toString(this);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean equals(final Object obj) {
+            return obj == this || obj instanceof ParameterizedType && TypeUtils.equals(this, ((ParameterizedType) obj));
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public int hashCode() {
+            return Objects.hash(raw, useOwner, typeArguments);
+        }
+    }
+
+    /**
+     * WildcardType implementation class.
+     */
+    private static final class WildcardTypeImpl implements WildcardType {
+        private static final Type[] EMPTY_UPPER_BOUNDS = { Object.class };
+        private static final Type[] EMPTY_LOWER_BOUNDS = new Type[0];
+
+        private final Type[] upperBounds;
+        private final Type[] lowerBounds;
+
+        /**
+         * Constructor
+         * @param upperBounds of this type
+         * @param lowerBounds of this type
+         */
+        private WildcardTypeImpl(final Type[] upperBounds, final Type[] lowerBounds) {
+            this.upperBounds = ObjectUtils.isEmpty(upperBounds) ? EMPTY_UPPER_BOUNDS : upperBounds;
+            this.lowerBounds = lowerBounds == null ? EMPTY_LOWER_BOUNDS : lowerBounds;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Type[] getUpperBounds() {
+            return upperBounds.clone();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public Type[] getLowerBounds() {
+            return lowerBounds.clone();
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String toString() {
+            return TypeUtils.toString(this);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean equals(final Object obj) {
+            return obj == this || obj instanceof WildcardType && TypeUtils.equals(this, (WildcardType) obj);
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public int hashCode() {
+            return Objects.hash(upperBounds, lowerBounds);
+        }
+    }
+
+    /**
+     * <p>{@code TypeUtils} instances should NOT be constructed in standard
+     * programming. Instead, the class should be used as
+     * {@code TypeUtils.isAssignable(cls, toClass)}.</p> <p>This
+     * constructor is public to permit tools that require a JavaBean instance to
+     * operate.</p>
+     */
+    private TypeUtils() {
+    }
+
+    /**
+     * <p>Checks if the subject type may be implicitly cast to the target type
+     * following the Java generics rules. If both types are {@link Class}
+     * objects, the method returns the result of
+     * {@link Class#isAssignableFrom(Class)}.</p>
+     *
+     * @param type the subject type to be assigned to the target type
+     * @param toType the target type
+     * @return {@code true} if {@code type} is assignable to {@code toType}.
+     */
+    public static boolean isAssignable(final Type type, final Type toType) {
+        return isAssignable(type, toType, null);
+    }
+
+    /**
+     * <p>Checks if the subject type may be implicitly cast to the target type
+     * following the Java generics rules.</p>
+     *
+     * @param type the subject type to be assigned to the target type
+     * @param toType the target type
+     * @param typeVarAssigns optional map of type variable assignments
+     * @return {@code true} if {@code type} is assignable to {@code toType}.
+     */
+    private static boolean isAssignable(final Type type, final Type toType,
+            final Map<TypeVariable<?>, Type> typeVarAssigns) {
+        if (toType == null || toType instanceof Class<?>) {
+            return isAssignable(type, (Class<?>) toType);
+        }
+
+        if (toType instanceof ParameterizedType) {
+            return isAssignable(type, (ParameterizedType) toType, typeVarAssigns);
+        }
+
+        if (toType instanceof GenericArrayType) {
+            return isAssignable(type, (GenericArrayType) toType, typeVarAssigns);
+        }
+
+        if (toType instanceof WildcardType) {
+            return isAssignable(type, (WildcardType) toType, typeVarAssigns);
+        }
+
+        if (toType instanceof TypeVariable<?>) {
+            return isAssignable(type, (TypeVariable<?>) toType, typeVarAssigns);
+        }
+
+        throw new IllegalStateException("found an unhandled type: " + toType);
+    }
+
+    /**
+     * <p>Checks if the subject type may be implicitly cast to the target class
+     * following the Java generics rules.</p>
+     *
+     * @param type the subject type to be assigned to the target type
+     * @param toClass the target class
+     * @return {@code true} if {@code type} is assignable to {@code toClass}.
+     */
+    private static boolean isAssignable(final Type type, final Class<?> toClass) {
+        if (type == null) {
+            // consistency with ClassUtils.isAssignable() behavior
+            return toClass == null || !toClass.isPrimitive();
+        }
+
+        // only a null type can be assigned to null type which
+        // would have cause the previous to return true
+        if (toClass == null) {
+            return false;
+        }
+
+        // all types are assignable to themselves
+        if (toClass.equals(type)) {
+            return true;
+        }
+
+        if (type instanceof Class<?>) {
+            // just comparing two classes
+            // also take primitives into account!
+            return isAssignable((Class<?>) type, toClass);
+        }
+
+        if (type instanceof ParameterizedType) {
+            // only have to compare the raw type to the class
+            return isAssignable(getRawType((ParameterizedType) type), toClass);
+        }
+
+        // *
+        if (type instanceof TypeVariable<?>) {
+            // if any of the bounds are assignable to the class, then the
+            // type is assignable to the class.
+            return Stream.of(((TypeVariable<?>) type).getBounds()).anyMatch(bound -> isAssignable(bound, toClass));
+        }
+
+        // the only classes to which a generic array type can be assigned
+        // are class Object and array classes
+        if (type instanceof GenericArrayType) {
+            return Object.class.equals(toClass)
+                    || toClass.isArray()
+                    && isAssignable(((GenericArrayType) type).getGenericComponentType(), toClass
+                            .getComponentType());
+        }
+
+        // wildcard types are not assignable to a class (though one would think
+        // "? super Object" would be assignable to Object)
+        if (type instanceof WildcardType) {
+            return false;
+        }
+
+        throw new IllegalStateException("found an unhandled type: " + type);
+    }
+
+    private static boolean isAssignable(Class<?> cls, final Class<?> toClass) {
+        if (toClass == null) {
+            return false;
+        }
+        // have to check for null, as isAssignableFrom doesn't
+        if (cls == null) {
+            return !toClass.isPrimitive();
+        }
+
+        if (cls.isPrimitive() && !toClass.isPrimitive()) {
+            cls = Reflection.primitiveToWrapper(cls);
+            if (cls == null) {
+                return false;
+            }
+        }
+        if (toClass.isPrimitive() && !cls.isPrimitive()) {
+            cls = Reflection.wrapperToPrimitive(cls);
+            if (cls == null) {
+                return false;
+            }
+        }
+        if (cls.equals(toClass)) {
+            return true;
+        }
+        if (cls.isPrimitive()) {
+            if (toClass.isPrimitive() == false) {
+                return false;
+            }
+            if (Integer.TYPE.equals(cls)) {
+                return Long.TYPE.equals(toClass)
+                        || Float.TYPE.equals(toClass)
+                        || Double.TYPE.equals(toClass);
+            }
+            if (Long.TYPE.equals(cls)) {
+                return Float.TYPE.equals(toClass)
+                        || Double.TYPE.equals(toClass);
+            }
+            if (Boolean.TYPE.equals(cls)) {
+                return false;
+            }
+            if (Double.TYPE.equals(cls)) {
+                return false;
+            }
+            if (Float.TYPE.equals(cls)) {
+                return Double.TYPE.equals(toClass);
+            }
+            if (Character.TYPE.equals(cls)) {
+                return Integer.TYPE.equals(toClass)
+                        || Long.TYPE.equals(toClass)
+                        || Float.TYPE.equals(toClass)
+                        || Double.TYPE.equals(toClass);
+            }
+            if (Short.TYPE.equals(cls)) {
+                return Integer.TYPE.equals(toClass)
+                        || Long.TYPE.equals(toClass)
+                        || Float.TYPE.equals(toClass)
+                        || Double.TYPE.equals(toClass);
+            }
+            if (Byte.TYPE.equals(cls)) {
+                return Short.TYPE.equals(toClass)
+                        || Integer.TYPE.equals(toClass)
+                        || Long.TYPE.equals(toClass)
+                        || Float.TYPE.equals(toClass)
+                        || Double.TYPE.equals(toClass);
+            }
+            // should never get here
+            return false;
+        }
+        return toClass.isAssignableFrom(cls);
+
+    }
+
+    /**
+     * <p>Checks if the subject type may be implicitly cast to the target
+     * parameterized type following the Java generics rules.</p>
+     *
+     * @param type the subject type to be assigned to the target type
+     * @param toParameterizedType the target parameterized type
+     * @param typeVarAssigns a map with type variables
+     * @return {@code true} if {@code type} is assignable to {@code toType}.
+     */
+    private static boolean isAssignable(final Type type, final ParameterizedType toParameterizedType,
+            final Map<TypeVariable<?>, Type> typeVarAssigns) {
+        if (type == null) {
+            return true;
+        }
+
+        // only a null type can be assigned to null type which
+        // would have cause the previous to return true
+        if (toParameterizedType == null) {
+            return false;
+        }
+
+        // all types are assignable to themselves
+        if (toParameterizedType.equals(type)) {
+            return true;
+        }
+
+        // get the target type's raw type
+        final Class<?> toClass = getRawType(toParameterizedType);
+        // get the subject type's type arguments including owner type arguments
+        // and supertype arguments up to and including the target class.
+        final Map<TypeVariable<?>, Type> fromTypeVarAssigns = getTypeArguments(type, toClass, null);
+
+        // null means the two types are not compatible
+        if (fromTypeVarAssigns == null) {
+            return false;
+        }
+
+        // compatible types, but there's no type arguments. this is equivalent
+        // to comparing Map< ?, ? > to Map, and raw types are always assignable
+        // to parameterized types.
+        if (fromTypeVarAssigns.isEmpty()) {
+            return true;
+        }
+
+        // get the target type's type arguments including owner type arguments
+        final Map<TypeVariable<?>, Type> toTypeVarAssigns = getTypeArguments(toParameterizedType,
+                toClass, typeVarAssigns);
+
+        // now to check each type argument
+        for (final TypeVariable<?> var : toTypeVarAssigns.keySet()) {
+            final Type toTypeArg = unrollVariableAssignments(var, toTypeVarAssigns);
+            final Type fromTypeArg = unrollVariableAssignments(var, fromTypeVarAssigns);
+
+            if (toTypeArg == null && fromTypeArg instanceof Class) {
+                continue;
+            }
+
+            // parameters must either be absent from the subject type, within
+            // the bounds of the wildcard type, or be an exact match to the
+            // parameters of the target type.
+            if (fromTypeArg != null
+                    && !toTypeArg.equals(fromTypeArg)
+                    && !(toTypeArg instanceof WildcardType && isAssignable(fromTypeArg, toTypeArg,
+                            typeVarAssigns))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Look up {@code var} in {@code typeVarAssigns} <em>transitively</em>,
+     * i.e. keep looking until the value found is <em>not</em> a type variable.
+     * @param var the type variable to look up
+     * @param typeVarAssigns the map used for the look up
+     * @return Type or {@code null} if some variable was not in the map
+     */
+    private static Type unrollVariableAssignments(TypeVariable<?> var, final Map<TypeVariable<?>, Type> typeVarAssigns) {
+        Type result;
+        do {
+            result = typeVarAssigns.get(var);
+            if (result instanceof TypeVariable<?> && !result.equals(var)) {
+                var = (TypeVariable<?>) result;
+                continue;
+            }
+            break;
+        } while (true);
+        return result;
+    }
+
+    /**
+     * <p>Checks if the subject type may be implicitly cast to the target
+     * generic array type following the Java generics rules.</p>
+     *
+     * @param type the subject type to be assigned to the target type
+     * @param toGenericArrayType the target generic array type
+     * @param typeVarAssigns a map with type variables
+     * @return {@code true} if {@code type} is assignable to
+     * {@code toGenericArrayType}.
+     */
+    private static boolean isAssignable(final Type type, final GenericArrayType toGenericArrayType,
+            final Map<TypeVariable<?>, Type> typeVarAssigns) {
+        if (type == null) {
+            return true;
+        }
+
+        // only a null type can be assigned to null type which
+        // would have cause the previous to return true
+        if (toGenericArrayType == null) {
+            return false;
+        }
+
+        // all types are assignable to themselves
+        if (toGenericArrayType.equals(type)) {
+            return true;
+        }
+
+        final Type toComponentType = toGenericArrayType.getGenericComponentType();
+
+        if (type instanceof Class<?>) {
+            final Class<?> cls = (Class<?>) type;
+
+            // compare the component types
+            return cls.isArray()
+                    && isAssignable(cls.getComponentType(), toComponentType, typeVarAssigns);
+        }
+
+        if (type instanceof GenericArrayType) {
+            // compare the component types
+            return isAssignable(((GenericArrayType) type).getGenericComponentType(),
+                    toComponentType, typeVarAssigns);
+        }
+
+        if (type instanceof WildcardType) {
+            // so long as one of the upper bounds is assignable, it's good
+            return Stream.of(getImplicitUpperBounds((WildcardType) type))
+                .anyMatch(bound -> isAssignable(bound, toGenericArrayType));
+        }
+
+        if (type instanceof TypeVariable<?>) {
+            // probably should remove the following logic and just return false.
+            // type variables cannot specify arrays as bounds.
+            return Stream.of(getImplicitBounds((TypeVariable<?>) type))
+                .anyMatch(bound -> isAssignable(bound, toGenericArrayType));
+        }
+
+        if (type instanceof ParameterizedType) {
+            // the raw type of a parameterized type is never an array or
+            // generic array, otherwise the declaration would look like this:
+            // Collection[]< ? extends String > collection;
+            return false;
+        }
+
+        throw new IllegalStateException("found an unhandled type: " + type);
+    }
+
+    /**
+     * <p>Checks if the subject type may be implicitly cast to the target
+     * wildcard type following the Java generics rules.</p>
+     *
+     * @param type the subject type to be assigned to the target type
+     * @param toWildcardType the target wildcard type
+     * @param typeVarAssigns a map with type variables
+     * @return {@code true} if {@code type} is assignable to
+     * {@code toWildcardType}.
+     */
+    private static boolean isAssignable(final Type type, final WildcardType toWildcardType,
+            final Map<TypeVariable<?>, Type> typeVarAssigns) {
+        if (type == null) {
+            return true;
+        }
+
+        // only a null type can be assigned to null type which
+        // would have cause the previous to return true
+        if (toWildcardType == null) {
+            return false;
+        }
+
+        // all types are assignable to themselves
+        if (toWildcardType.equals(type)) {
+            return true;
+        }
+
+        final Type[] toUpperBounds = getImplicitUpperBounds(toWildcardType);
+        final Type[] toLowerBounds = getImplicitLowerBounds(toWildcardType);
+
+        if (type instanceof WildcardType) {
+            final WildcardType wildcardType = (WildcardType) type;
+            final Type[] upperBounds = getImplicitUpperBounds(wildcardType);
+            final Type[] lowerBounds = getImplicitLowerBounds(wildcardType);
+
+            for (Type toBound : toUpperBounds) {
+                // if there are assignments for unresolved type variables,
+                // now's the time to substitute them.
+                toBound = substituteTypeVariables(toBound, typeVarAssigns);
+
+                // each upper bound of the subject type has to be assignable to
+                // each
+                // upper bound of the target type
+                for (final Type bound : upperBounds) {
+                    if (!isAssignable(bound, toBound, typeVarAssigns)) {
+                        return false;
+                    }
+                }
+            }
+
+            for (Type toBound : toLowerBounds) {
+                // if there are assignments for unresolved type variables,
+                // now's the time to substitute them.
+                toBound = substituteTypeVariables(toBound, typeVarAssigns);
+
+                // each lower bound of the target type has to be assignable to
+                // each
+                // lower bound of the subject type
+                for (final Type bound : lowerBounds) {
+                    if (!isAssignable(toBound, bound, typeVarAssigns)) {
+                        return false;
+                    }
+                }
+            }
+            return true;
+        }
+
+        for (final Type toBound : toUpperBounds) {
+            // if there are assignments for unresolved type variables,
+            // now's the time to substitute them.
+            if (!isAssignable(type, substituteTypeVariables(toBound, typeVarAssigns),
+                    typeVarAssigns)) {
+                return false;
+            }
+        }
+
+        for (final Type toBound : toLowerBounds) {
+            // if there are assignments for unresolved type variables,
+            // now's the time to substitute them.
+            if (!isAssignable(substituteTypeVariables(toBound, typeVarAssigns), type,
+                    typeVarAssigns)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * <p>Checks if the subject type may be implicitly cast to the target type
+     * variable following the Java generics rules.</p>
+     *
+     * @param type the subject type to be assigned to the target type
+     * @param toTypeVariable the target type variable
+     * @param typeVarAssigns a map with type variables
+     * @return {@code true} if {@code type} is assignable to
+     * {@code toTypeVariable}.
+     */
+    private static boolean isAssignable(final Type type, final TypeVariable<?> toTypeVariable,
+            final Map<TypeVariable<?>, Type> typeVarAssigns) {
+        if (type == null) {
+            return true;
+        }
+
+        // only a null type can be assigned to null type which
+        // would have cause the previous to return true
+        if (toTypeVariable == null) {
+            return false;
+        }
+
+        // all types are assignable to themselves
+        if (toTypeVariable.equals(type)) {
+            return true;
+        }
+
+        if (type instanceof TypeVariable<?>) {
+            // a type variable is assignable to another type variable, if
+            // and only if the former is the latter, extends the latter, or
+            // is otherwise a descendant of the latter.
+            final Type[] bounds = getImplicitBounds((TypeVariable<?>) type);
+
+            for (final Type bound : bounds) {
+                if (isAssignable(bound, toTypeVariable, typeVarAssigns)) {
+                    return true;
+                }
+            }
+        }
+
+        if (type instanceof Class<?> || type instanceof ParameterizedType
+                || type instanceof GenericArrayType || type instanceof WildcardType) {
+            return false;
+        }
+
+        throw new IllegalStateException("found an unhandled type: " + type);
+    }
+
+    /**
+     * <p>Find the mapping for {@code type} in {@code typeVarAssigns}.</p>
+     *
+     * @param type the type to be replaced
+     * @param typeVarAssigns the map with type variables
+     * @return the replaced type
+     * @throws IllegalArgumentException if the type cannot be substituted
+     */
+    private static Type substituteTypeVariables(final Type type, final Map<TypeVariable<?>, Type> typeVarAssigns) {
+        if (type instanceof TypeVariable<?> && typeVarAssigns != null) {
+            final Type replacementType = typeVarAssigns.get(type);
+
+            if (replacementType == null) {
+                throw new IllegalArgumentException("missing assignment type for type variable "
+                        + type);
+            }
+            return replacementType;
+        }
+        return type;
+    }
+
+    /**
+     * <p>Retrieves all the type arguments for this parameterized type
+     * including owner hierarchy arguments such as
+     * {@code Outer<K,V>.Inner<T>.DeepInner<E>} .
+     * The arguments are returned in a
+     * {@link Map} specifying the argument type for each {@link TypeVariable}.
+     * </p>
+     *
+     * @param type specifies the subject parameterized type from which to
+     *             harvest the parameters.
+     * @return a {@code Map} of the type arguments to their respective type
+     * variables.
+     */
+    public static Map<TypeVariable<?>, Type> getTypeArguments(final ParameterizedType type) {
+        return getTypeArguments(type, getRawType(type), null);
+    }
+
+    /**
+     * <p>Gets the type arguments of a class/interface based on a subtype. For
+     * instance, this method will determine that both of the parameters for the
+     * interface {@link Map} are {@link Object} for the subtype
+     * {@link java.util.Properties Properties} even though the subtype does not
+     * directly implement the {@code Map} interface.</p>
+     * <p>This method returns {@code null} if {@code type} is not assignable to
+     * {@code toClass}. It returns an empty map if none of the classes or
+     * interfaces in its inheritance hierarchy specify any type arguments.</p>
+     * <p>A side effect of this method is that it also retrieves the type
+     * arguments for the classes and interfaces that are part of the hierarchy
+     * between {@code type} and {@code toClass}. So with the above
+     * example, this method will also determine that the type arguments for
+     * {@link java.util.Hashtable Hashtable} are also both {@code Object}.
+     * In cases where the interface specified by {@code toClass} is
+     * (indirectly) implemented more than once (e.g. where {@code toClass}
+     * specifies the interface {@link Iterable Iterable} and
+     * {@code type} specifies a parameterized type that implements both
+     * {@link Set Set} and {@link java.util.Collection Collection}),
+     * this method will look at the inheritance hierarchy of only one of the
+     * implementations/subclasses; the first interface encountered that isn't a
+     * subinterface to one of the others in the {@code type} to
+     * {@code toClass} hierarchy.</p>
+     *
+     * @param type the type from which to determine the type parameters of
+     * {@code toClass}
+     * @param toClass the class whose type parameters are to be determined based
+     * on the subtype {@code type}
+     * @return a {@code Map} of the type assignments for the type variables in
+     * each type in the inheritance hierarchy from {@code type} to
+     * {@code toClass} inclusive.
+     */
+    public static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass) {
+        return getTypeArguments(type, toClass, null);
+    }
+
+    /**
+     * <p>Return a map of the type arguments of @{code type} in the context of {@code toClass}.</p>
+     *
+     * @param type the type in question
+     * @param toClass the class
+     * @param subtypeVarAssigns a map with type variables
+     * @return the {@code Map} with type arguments
+     */
+    private static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass,
+            final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
+        if (type instanceof Class<?>) {
+            return getTypeArguments((Class<?>) type, toClass, subtypeVarAssigns);
+        }
+
+        if (type instanceof ParameterizedType) {
+            return getTypeArguments((ParameterizedType) type, toClass, subtypeVarAssigns);
+        }
+
+        if (type instanceof GenericArrayType) {
+            return getTypeArguments(((GenericArrayType) type).getGenericComponentType(), toClass
+                    .isArray() ? toClass.getComponentType() : toClass, subtypeVarAssigns);
+        }
+
+        // since wildcard types are not assignable to classes, should this just
+        // return null?
+        if (type instanceof WildcardType) {
+            for (final Type bound : getImplicitUpperBounds((WildcardType) type)) {
+                // find the first bound that is assignable to the target class
+                if (isAssignable(bound, toClass)) {
+                    return getTypeArguments(bound, toClass, subtypeVarAssigns);
+                }
+            }
+
+            return null;
+        }
+
+        if (type instanceof TypeVariable<?>) {
+            for (final Type bound : getImplicitBounds((TypeVariable<?>) type)) {
+                // find the first bound that is assignable to the target class
+                if (isAssignable(bound, toClass)) {
+                    return getTypeArguments(bound, toClass, subtypeVarAssigns);
+                }
+            }
+
+            return null;
+        }
+        throw new IllegalStateException("found an unhandled type: " + type);
+    }
+
+    /**
+     * <p>Return a map of the type arguments of a parameterized type in the context of {@code toClass}.</p>
+     *
+     * @param parameterizedType the parameterized type
+     * @param toClass the class
+     * @param subtypeVarAssigns a map with type variables
+     * @return the {@code Map} with type arguments
+     */
+    private static Map<TypeVariable<?>, Type> getTypeArguments(
+            final ParameterizedType parameterizedType, final Class<?> toClass,
+            final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
+        final Class<?> cls = getRawType(parameterizedType);
+
+        // make sure they're assignable
+        if (!isAssignable(cls, toClass)) {
+            return null;
+        }
+
+        final Type ownerType = parameterizedType.getOwnerType();
+        Map<TypeVariable<?>, Type> typeVarAssigns;
+
+        if (ownerType instanceof ParameterizedType) {
+            // get the owner type arguments first
+            final ParameterizedType parameterizedOwnerType = (ParameterizedType) ownerType;
+            typeVarAssigns = getTypeArguments(parameterizedOwnerType,
+                    getRawType(parameterizedOwnerType), subtypeVarAssigns);
+        } else {
+            // no owner, prep the type variable assignments map
+            typeVarAssigns = subtypeVarAssigns == null ? new HashMap<>() : new HashMap<>(subtypeVarAssigns);
+        }
+
+        // get the subject parameterized type's arguments
+        final Type[] typeArgs = parameterizedType.getActualTypeArguments();
+        // and get the corresponding type variables from the raw class
+        final TypeVariable<?>[] typeParams = cls.getTypeParameters();
+
+        // map the arguments to their respective type variables
+        for (int i = 0; i < typeParams.length; i++) {
+            final Type typeArg = typeArgs[i];
+            typeVarAssigns.put(typeParams[i], typeVarAssigns.containsKey(typeArg) ? typeVarAssigns
+                    .get(typeArg) : typeArg);
+        }
+
+        if (toClass.equals(cls)) {
+            // target class has been reached. Done.
+            return typeVarAssigns;
+        }
+
+        // walk the inheritance hierarchy until the target class is reached
+        return getTypeArguments(getClosestParentType(cls, toClass), toClass, typeVarAssigns);
+    }
+
+    /**
+     * <p>Return a map of the type arguments of a class in the context of @{code toClass}.</p>
+     *
+     * @param cls the class in question
+     * @param toClass the context class
+     * @param subtypeVarAssigns a map with type variables
+     * @return the {@code Map} with type arguments
+     */
+    private static Map<TypeVariable<?>, Type> getTypeArguments(Class<?> cls, final Class<?> toClass,
+            final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
+        // make sure they're assignable
+        if (!isAssignable(cls, toClass)) {
+            return null;
+        }
+
+        // can't work with primitives
+        if (cls.isPrimitive()) {
+            // both classes are primitives?
+            if (toClass.isPrimitive()) {
+                // dealing with widening here. No type arguments to be
+                // harvested with these two types.
+                return new HashMap<>();
+            }
+
+            // work with wrapper the wrapper class instead of the primitive
+            cls = Reflection.primitiveToWrapper(cls);
+        }
+
+        // create a copy of the incoming map, or an empty one if it's null
+        final Map<TypeVariable<?>, Type> typeVarAssigns =
+            subtypeVarAssigns == null ? new HashMap<>() : new HashMap<>(subtypeVarAssigns);
+
+        // has target class been reached?
+        if (toClass.equals(cls)) {
+            return typeVarAssigns;
+        }
+
+        // walk the inheritance hierarchy until the target class is reached
+        return getTypeArguments(getClosestParentType(cls, toClass), toClass, typeVarAssigns);
+    }
+
+    /**
+     * <p>Get the closest parent type to the
+     * super class specified by {@code superClass}.</p>
+     *
+     * @param cls the class in question
+     * @param superClass the super class
+     * @return the closes parent type
+     */
+    private static Type getClosestParentType(final Class<?> cls, final Class<?> superClass) {
+        // only look at the interfaces if the super class is also an interface
+        if (superClass.isInterface()) {
+            // get the generic interfaces of the subject class
+            final Type[] interfaceTypes = cls.getGenericInterfaces();
+            // will hold the best generic interface match found
+            Type genericInterface = null;
+
+            // find the interface closest to the super class
+            for (final Type midType : interfaceTypes) {
+                Class<?> midClass = null;
+
+                if (midType instanceof ParameterizedType) {
+                    midClass = getRawType((ParameterizedType) midType);
+                } else if (midType instanceof Class<?>) {
+                    midClass = (Class<?>) midType;
+                } else {
+                    throw new IllegalStateException("Unexpected generic"
+                            + " interface type found: " + midType);
+                }
+
+                // check if this interface is further up the inheritance chain
+                // than the previously found match
+                if (isAssignable(midClass, superClass)
+                        && isAssignable(genericInterface, (Type) midClass)) {
+                    genericInterface = midType;
+                }
+            }
+
+            // found a match?
+            if (genericInterface != null) {
+                return genericInterface;
+            }
+        }
+
+        // none of the interfaces were descendants of the target class, so the
+        // super class has to be one, instead
+        return cls.getGenericSuperclass();
+    }
+
+    /**
+     * <p>Checks if the given value can be assigned to the target type
+     * following the Java generics rules.</p>
+     *
+     * @param value the value to be checked
+     * @param type the target type
+     * @return {@code true} if {@code value} is an instance of {@code type}.
+     */
+    public static boolean isInstance(final Object value, final Type type) {
+        if (type == null) {
+            return false;
+        }
+
+        return value == null ? !(type instanceof Class<?>) || type == void.class || !((Class<?>) type).isPrimitive()
+                : isAssignable(value.getClass(), type, null);
+    }
+
+    /**
+     * <p>This method strips out the redundant upper bound types in type
+     * variable types and wildcard types (or it would with wildcard types if
+     * multiple upper bounds were allowed).</p> <p>Example, with the variable
+     * type declaration:
+     *
+     * <pre>&lt;K extends java.util.Collection&lt;String&gt; &amp;
+     * java.util.List&lt;String&gt;&gt;</pre>
+     *
+     * <p>
+     * since {@code List} is a subinterface of {@code Collection},
+     * this method will return the bounds as if the declaration had been:
+     * </p>
+     *
+     * <pre>&lt;K extends java.util.List&lt;String&gt;&gt;</pre>
+     *
+     * @param bounds an array of types representing the upper bounds of either
+     * {@link WildcardType} or {@link TypeVariable}, not {@code null}.
+     * @return an array containing the values from {@code bounds} minus the
+     * redundant types.
+     */
+    public static Type[] normalizeUpperBounds(final Type[] bounds) {
+        Validate.notNull(bounds, "null value specified for bounds array");
+        // don't bother if there's only one (or none) type
+        if (bounds.length < 2) {
+            return bounds;
+        }
+
+        final Set<Type> types = new HashSet<>(bounds.length);
+
+        for (final Type type1 : bounds) {
+            boolean subtypeFound = false;
+
+            for (final Type type2 : bounds) {
+                if (type1 != type2 && isAssignable(type2, type1, null)) {
+                    subtypeFound = true;
+                    break;
+                }
+            }
+
+            if (!subtypeFound) {
+                types.add(type1);
+            }
+        }
+
+        return types.toArray(new Type[types.size()]);
+    }
+
+    /**
+     * <p>Returns an array containing the sole type of {@link Object} if
+     * {@link TypeVariable#getBounds()} returns an empty array. Otherwise, it
+     * returns the result of {@link TypeVariable#getBounds()} passed into
+     * {@link #normalizeUpperBounds}.</p>
+     *
+     * @param typeVariable the subject type variable, not {@code null}
+     * @return a non-empty array containing the bounds of the type variable.
+     */
+    public static Type[] getImplicitBounds(final TypeVariable<?> typeVariable) {
+        Validate.notNull(typeVariable, "typeVariable is null");
+        final Type[] bounds = typeVariable.getBounds();
+
+        return bounds.length == 0 ? new Type[] { Object.class } : normalizeUpperBounds(bounds);
+    }
+
+    /**
+     * <p>Returns an array containing the sole value of {@link Object} if
+     * {@link WildcardType#getUpperBounds()} returns an empty array. Otherwise,
+     * it returns the result of {@link WildcardType#getUpperBounds()}
+     * passed into {@link #normalizeUpperBounds}.</p>
+     *
+     * @param wildcardType the subject wildcard type, not {@code null}
+     * @return a non-empty array containing the upper bounds of the wildcard
+     * type.
+     */
+    public static Type[] getImplicitUpperBounds(final WildcardType wildcardType) {
+        Validate.notNull(wildcardType, "wildcardType is null");
+        final Type[] bounds = wildcardType.getUpperBounds();
+
+        return bounds.length == 0 ? new Type[] { Object.class } : normalizeUpperBounds(bounds);
+    }
+
+    /**
+     * <p>Returns an array containing a single value of {@code null} if
+     * {@link WildcardType#getLowerBounds()} returns an empty array. Otherwise,
+     * it returns the result of {@link WildcardType#getLowerBounds()}.</p>
+     *
+     * @param wildcardType the subject wildcard type, not {@code null}
+     * @return a non-empty array containing the lower bounds of the wildcard
+     * type.
+     */
+    public static Type[] getImplicitLowerBounds(final WildcardType wildcardType) {
+        Validate.notNull(wildcardType, "wildcardType is null");
+        final Type[] bounds = wildcardType.getLowerBounds();
+
+        return bounds.length == 0 ? new Type[] { null } : bounds;
+    }
+
+    /**
+     * <p>Transforms the passed in type to a {@link Class} object. Type-checking method of convenience.</p>
+     *
+     * @param parameterizedType the type to be converted
+     * @return the corresponding {@code Class} object
+     * @throws IllegalStateException if the conversion fails
+     */
+    private static Class<?> getRawType(final ParameterizedType parameterizedType) {
+        final Type rawType = parameterizedType.getRawType();
+
+        // check if raw type is a Class object
+        // not currently necessary, but since the return type is Type instead of
+        // Class, there's enough reason to believe that future versions of Java
+        // may return other Type implementations. And type-safety checking is
+        // rarely a bad idea.
+        if (!(rawType instanceof Class<?>)) {
+            throw new IllegalStateException("Wait... What!? Type of rawType: " + rawType);
+        }
+
+        return (Class<?>) rawType;
+    }
+
+    /**
+     * <p>Get the raw type of a Java type, given its context. Primarily for use
+     * with {@link TypeVariable}s and {@link GenericArrayType}s, or when you do
+     * not know the runtime type of {@code type}: if you know you have a
+     * {@link Class} instance, it is already raw; if you know you have a
+     * {@link ParameterizedType}, its raw type is only a method call away.</p>
+     *
+     * @param type to resolve
+     * @param assigningType type to be resolved against
+     * @return the resolved {@link Class} object or {@code null} if
+     * the type could not be resolved
+     */
+    public static Class<?> getRawType(final Type type, final Type assigningType) {
+        if (type instanceof Class<?>) {
+            // it is raw, no problem
+            return (Class<?>) type;
+        }
+
+        if (type instanceof ParameterizedType) {
+            // simple enough to get the raw type of a ParameterizedType
+            return getRawType((ParameterizedType) type);
+        }
+
+        if (type instanceof TypeVariable<?>) {
+            if (assigningType == null) {
+                return null;
+            }
+
+            // get the entity declaring this type variable
+            final Object genericDeclaration = ((TypeVariable<?>) type).getGenericDeclaration();
+
+            // can't get the raw type of a method- or constructor-declared type
+            // variable
+            if (!(genericDeclaration instanceof Class<?>)) {
+                return null;
+            }
+
+            // get the type arguments for the declaring class/interface based
+            // on the enclosing type
+            final Map<TypeVariable<?>, Type> typeVarAssigns = getTypeArguments(assigningType,
+                    (Class<?>) genericDeclaration);
+
+            // enclosingType has to be a subclass (or subinterface) of the
+            // declaring type
+            if (typeVarAssigns == null) {
+                return null;
+            }
+
+            // get the argument assigned to this type variable
+            final Type typeArgument = typeVarAssigns.get(type);
+
+            if (typeArgument == null) {
+                return null;
+            }
+
+            // get the argument for this type variable
+            return getRawType(typeArgument, assigningType);
+        }
+
+        if (type instanceof GenericArrayType) {
+            // get raw component type
+            final Class<?> rawComponentType = getRawType(((GenericArrayType) type)
+                    .getGenericComponentType(), assigningType);
+
+            // create array type from raw component type and return its class
+            return Array.newInstance(rawComponentType, 0).getClass();
+        }
+
+        // (hand-waving) this is not the method you're looking for
+        if (type instanceof WildcardType) {
+            return null;
+        }
+
+        throw new IllegalArgumentException("unknown type: " + type);
+    }
+
+    /**
+     * Learn whether the specified type denotes an array type.
+     * @param type the type to be checked
+     * @return {@code true} if {@code type} is an array class or a {@link GenericArrayType}.
+     */
+    public static boolean isArrayType(final Type type) {
+        return type instanceof GenericArrayType || type instanceof Class<?> && ((Class<?>) type).isArray();
+    }
+
+    /**
+     * Get the array component type of {@code type}.
+     * @param type the type to be checked
+     * @return component type or null if type is not an array type
+     */
+    public static Type getArrayComponentType(final Type type) {
+        if (type instanceof Class<?>) {
+            final Class<?> clazz = (Class<?>) type;
+            return clazz.isArray() ? clazz.getComponentType() : null;
+        }
+        if (type instanceof GenericArrayType) {
+            return ((GenericArrayType) type).getGenericComponentType();
+        }
+        return null;
+    }
+
+    /**
+     * Get a type representing {@code type} with variable assignments "unrolled."
+     *
+     * @param typeArguments as from {@link TypeUtils#getTypeArguments(Type, Class)}
+     * @param type the type to unroll variable assignments for
+     * @return Type
+     */
+    public static Type unrollVariables(Map<TypeVariable<?>, Type> typeArguments, final Type type) {
+        if (typeArguments == null) {
+            typeArguments = Collections.<TypeVariable<?>, Type> emptyMap();
+        }
+        if (containsTypeVariables(type)) {
+            if (type instanceof TypeVariable<?>) {
+                return unrollVariables(typeArguments, typeArguments.get(type));
+            }
+            if (type instanceof ParameterizedType) {
+                final ParameterizedType p = (ParameterizedType) type;
+                final Map<TypeVariable<?>, Type> parameterizedTypeArguments;
+                if (p.getOwnerType() == null) {
+                    parameterizedTypeArguments = typeArguments;
+                } else {
+                    parameterizedTypeArguments = new HashMap<>(typeArguments);
+                    parameterizedTypeArguments.putAll(TypeUtils.getTypeArguments(p));
+                }
+                final Type[] args = p.getActualTypeArguments();
+                for (int i = 0; i < args.length; i++) {
+                    final Type unrolled = unrollVariables(parameterizedTypeArguments, args[i]);
+                    if (unrolled != null) {
+                        args[i] = unrolled;
+                    }
+                }
+                return parameterizeWithOwner(p.getOwnerType(), (Class<?>) p.getRawType(), args);
+            }
+            if (type instanceof WildcardType) {
+                final WildcardType wild = (WildcardType) type;
+                return wildcardType().withUpperBounds(unrollBounds(typeArguments, wild.getUpperBounds()))
+                    .withLowerBounds(unrollBounds(typeArguments, wild.getLowerBounds())).build();
+            }
+        }
+        return type;
+    }
+
+    /**
+     * Local helper method to unroll variables in a type bounds array.
+     * 
+     * @param typeArguments assignments {@link Map}
+     * @param bounds in which to expand variables
+     * @return {@code bounds} with any variables reassigned
+     */
+    private static Type[] unrollBounds(final Map<TypeVariable<?>, Type> typeArguments, final Type[] bounds) {
+        Type[] result = bounds;
+        int i = 0;
+        for (; i < result.length; i++) {
+            final Type unrolled = unrollVariables(typeArguments, result[i]);
+            if (unrolled == null) {
+                List<Type> types = Arrays.asList(result);
+                types.remove(i--);
+                result = types.toArray(new Type[types.size()]);
+            } else {
+                result[i] = unrolled;
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Learn, recursively, whether any of the type parameters associated with {@code type} are bound to variables.
+     *
+     * @param type the type to check for type variables
+     * @return boolean
+     */
+    public static boolean containsTypeVariables(final Type type) {
+        if (type instanceof TypeVariable<?>) {
+            return true;
+        }
+        if (type instanceof Class<?>) {
+            return ((Class<?>) type).getTypeParameters().length > 0;
+        }
+        if (type instanceof ParameterizedType) {
+            for (final Type arg : ((ParameterizedType) type).getActualTypeArguments()) {
+                if (containsTypeVariables(arg)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+        if (type instanceof WildcardType) {
+            final WildcardType wild = (WildcardType) type;
+            return containsTypeVariables(TypeUtils.getImplicitLowerBounds(wild)[0])
+                || containsTypeVariables(TypeUtils.getImplicitUpperBounds(wild)[0]);
+        }
+        return false;
+    }
+
+
+    /**
+     * Create a parameterized type instance.
+     *
+     * @param owner the owning type
+     * @param raw the raw class to create a parameterized type instance for
+     * @param typeArguments the types used for parameterization
+     *
+     * @return {@link ParameterizedType}
+     */
+    public static final ParameterizedType parameterizeWithOwner(final Type owner, final Class<?> raw,
+        final Type... typeArguments) {
+        Validate.notNull(raw, "raw class is null");
+        final Type useOwner;
+        if (raw.getEnclosingClass() == null) {
+            Validate.isTrue(owner == null, "no owner allowed for top-level %s", raw);
+            useOwner = null;
+        } else if (owner == null) {
+            useOwner = raw.getEnclosingClass();
+        } else {
+            Validate.isTrue(TypeUtils.isAssignable(owner, raw.getEnclosingClass()),
+                "%s is invalid owner type for parameterized %s", owner, raw);
+            useOwner = owner;
+        }
+        Validate.isTrue(raw.getTypeParameters().length == typeArguments.length,
+            "invalid number of type parameters specified: expected %d, got %d", raw.getTypeParameters().length,
+            typeArguments.length);
+
+        return new ParameterizedTypeImpl(raw, useOwner, typeArguments);
+    }
+
+    /**
+     * Get a {@link WildcardTypeBuilder}.
+     * @return {@link WildcardTypeBuilder}
+     */
+    public static WildcardTypeBuilder wildcardType() {
+        return new WildcardTypeBuilder();
+    }
+
+    /**
+     * Check equality of types.
+     *
+     * @param t1 the first type
+     * @param t2 the second type
+     * @return boolean
+     */
+    public static boolean equals(final Type t1, final Type t2) {
+        if (t1 == t2) {
+            return true;
+        }
+        if (t1 == null || t2 == null) {
+            return false;
+        }
+
+        if (t1.equals(t2)) {
+            return true;
+        }
+        if (t1 instanceof ParameterizedType) {
+            return equals((ParameterizedType) t1, t2);
+        }
+        if (t1 instanceof GenericArrayType) {
+            return equals((GenericArrayType) t1, t2);
+        }
+        if (t1 instanceof WildcardType) {
+            return equals((WildcardType) t1, t2);
+        }
+        return false;
+    }
+
+    /**
+     * Learn whether {@code t} equals {@code p}.
+     * @param p LHS
+     * @param t RHS
+     * @return boolean
+     */
+    private static boolean equals(final ParameterizedType p, final Type t) {
+        if (t instanceof ParameterizedType) {
+            final ParameterizedType other = (ParameterizedType) t;
+            if (equals(p.getRawType(), other.getRawType()) && equals(p.getOwnerType(), other.getOwnerType())) {
+                return equals(p.getActualTypeArguments(), other.getActualTypeArguments());
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Learn whether {@code t} equals {@code a}.
+     * @param a LHS
+     * @param t RHS
+     * @return boolean
+     */
+    private static boolean equals(final GenericArrayType a, final Type t) {
+        return t instanceof GenericArrayType
+            && equals(a.getGenericComponentType(), ((GenericArrayType) t).getGenericComponentType());
+    }
+
+    /**
+     * Learn whether {@code t} equals {@code w}.
+     * @param w LHS
+     * @param t RHS
+     * @return boolean
+     */
+    private static boolean equals(final WildcardType w, final Type t) {
+        if (t instanceof WildcardType) {
+            final WildcardType other = (WildcardType) t;
+            return equals(getImplicitLowerBounds(w), getImplicitLowerBounds(other))
+                && equals(getImplicitUpperBounds(w), getImplicitUpperBounds(other));
+        }
+        return false;
+    }
+
+    /**
+     * Learn whether {@code t1} equals {@code t2}.
+     * @param t1 LHS
+     * @param t2 RHS
+     * @return boolean
+     */
+    private static boolean equals(final Type[] t1, final Type[] t2) {
+        if (t1.length == t2.length) {
+            for (int i = 0; i < t1.length; i++) {
+                if (!equals(t1[i], t2[i])) {
+                    return false;
+                }
+            }
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * Present a given type as a Java-esque String.
+     *
+     * @param type the type to create a String representation for, not {@code null}
+     * @return String
+     */
+    public static String toString(final Type type) {
+        Validate.notNull(type);
+        if (type instanceof Class<?>) {
+            return classToString((Class<?>) type);
+        }
+        if (type instanceof ParameterizedType) {
+            return parameterizedTypeToString((ParameterizedType) type);
+        }
+        if (type instanceof WildcardType) {
+            return wildcardTypeToString((WildcardType) type);
+        }
+        if (type instanceof TypeVariable<?>) {
+            return typeVariableToString((TypeVariable<?>) type);
+        }
+        if (type instanceof GenericArrayType) {
+            return genericArrayTypeToString((GenericArrayType) type);
+        }
+        throw new IllegalArgumentException(type.toString());
+    }
+
+
+    /**
+     * Format a {@link Class} as a {@link String}.
+     * @param c {@code Class} to format
+     * @return String
+     */
+    private static String classToString(final Class<?> c) {
+        final StringBuilder buf = new StringBuilder();
+
+        if (c.getEnclosingClass() != null) {
+            buf.append(classToString(c.getEnclosingClass())).append('.').append(c.getSimpleName());
+        } else {
+            buf.append(c.getName());
+        }
+        if (c.getTypeParameters().length > 0) {
+            buf.append('<');
+            appendAllTo(buf, ", ", c.getTypeParameters());
+            buf.append('>');
+        }
+        return buf.toString();
+    }
+
+    /**
+     * Format a {@link TypeVariable} as a {@link String}.
+     * @param v {@code TypeVariable} to format
+     * @return String
+     */
+    private static String typeVariableToString(final TypeVariable<?> v) {
+        final StringBuilder buf = new StringBuilder(v.getName());
+        final Type[] bounds = v.getBounds();
+        if (bounds.length > 0 && !(bounds.length == 1 && Object.class.equals(bounds[0]))) {
+            buf.append(" extends ");
+            appendAllTo(buf, " & ", v.getBounds());
+        }
+        return buf.toString();
+    }
+
+    /**
+     * Format a {@link ParameterizedType} as a {@link String}.
+     * @param p {@code ParameterizedType} to format
+     * @return String
+     */
+    private static String parameterizedTypeToString(final ParameterizedType p) {
+        final StringBuilder buf = new StringBuilder();
+
+        final Type useOwner = p.getOwnerType();
+        final Class<?> raw = (Class<?>) p.getRawType();
+        final Type[] typeArguments = p.getActualTypeArguments();
+        if (useOwner == null) {
+            buf.append(raw.getName());
+        } else {
+            if (useOwner instanceof Class<?>) {
+                buf.append(((Class<?>) useOwner).getName());
+            } else {
+                buf.append(useOwner.toString());
+            }
+            buf.append('.').append(raw.getSimpleName());
+        }
+
+        appendAllTo(buf.append('<'), ", ", typeArguments).append('>');
+        return buf.toString();
+    }
+
+    /**
+     * Format a {@link WildcardType} as a {@link String}.
+     * @param w {@code WildcardType} to format
+     * @return String
+     */
+    private static String wildcardTypeToString(final WildcardType w) {
+        final StringBuilder buf = new StringBuilder().append('?');
+        final Type[] lowerBounds = w.getLowerBounds();
+        final Type[] upperBounds = w.getUpperBounds();
+        if (lowerBounds.length > 1 || lowerBounds.length == 1 && lowerBounds[0] != null) {
+            appendAllTo(buf.append(" super "), " & ", lowerBounds);
+        } else if (upperBounds.length > 1 || upperBounds.length == 1 && !Object.class.equals(upperBounds[0])) {
+            appendAllTo(buf.append(" extends "), " & ", upperBounds);
+        }
+        return buf.toString();
+    }
+
+    /**
+     * Format a {@link GenericArrayType} as a {@link String}.
+     * @param g {@code GenericArrayType} to format
+     * @return String
+     */
+    private static String genericArrayTypeToString(final GenericArrayType g) {
+        return String.format("%s[]", toString(g.getGenericComponentType()));
+    }
+
+    /**
+     * Append {@code types} to @{code buf} with separator {@code sep}.
+     * @param buf destination
+     * @param sep separator
+     * @param types to append
+     * @return {@code buf}
+     */
+    private static StringBuilder appendAllTo(final StringBuilder buf, final String sep, final Type... types) {
+        if (types.length > 0) {
+            buf.append(toString(types[0]));
+            for (int i = 1; i < types.length; i++) {
+                buf.append(sep).append(toString(types[i]));
+            }
+        }
+        return buf;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-jsr/src/test/java/org/apache/bval/jsr/TckReproducerTest.java
----------------------------------------------------------------------
diff --git a/bval-jsr/src/test/java/org/apache/bval/jsr/TckReproducerTest.java b/bval-jsr/src/test/java/org/apache/bval/jsr/TckReproducerTest.java
index ab65286..0fed395 100644
--- a/bval-jsr/src/test/java/org/apache/bval/jsr/TckReproducerTest.java
+++ b/bval-jsr/src/test/java/org/apache/bval/jsr/TckReproducerTest.java
@@ -26,7 +26,6 @@ import java.util.Set;
 import javax.validation.ConstraintViolation;
 import javax.validation.constraints.Pattern;
 
-import org.apache.bval.util.PropertyAccess;
 import org.junit.Test;
 
 /**
@@ -44,18 +43,18 @@ public class TckReproducerTest extends ValidationTestBase {
             expectedViolations, violations.size());
     }
 
-    @Test
-    public void testPropertyAccessOnNonPublicClass() throws Exception {
-        Car car = new Car("USd-298");
-        assertEquals(car.getLicensePlateNumber(), PropertyAccess.getProperty(car, "licensePlateNumber"));
-
-        assertCorrectNumberOfViolations(validator.validateProperty(car, "licensePlateNumber", First.class,
-            org.apache.bval.jsr.example.Second.class), 1);
-
-        car.setLicensePlateNumber("USD-298");
-        assertCorrectNumberOfViolations(validator.validateProperty(car, "licensePlateNumber", First.class,
-            org.apache.bval.jsr.example.Second.class), 0);
-    }
+//    @Test
+//    public void testPropertyAccessOnNonPublicClass() throws Exception {
+//        Car car = new Car("USd-298");
+//        assertEquals(car.getLicensePlateNumber(), PropertyAccess.getProperty(car, "licensePlateNumber"));
+//
+//        assertCorrectNumberOfViolations(validator.validateProperty(car, "licensePlateNumber", First.class,
+//            org.apache.bval.jsr.example.Second.class), 1);
+//
+//        car.setLicensePlateNumber("USD-298");
+//        assertCorrectNumberOfViolations(validator.validateProperty(car, "licensePlateNumber", First.class,
+//            org.apache.bval.jsr.example.Second.class), 0);
+//    }
 
     static class Car {
         @Pattern(regexp = "[A-Z][A-Z][A-Z]-[0-9][0-9][0-9]", groups = { First.class, Second.class })

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/findbugs-exclude-filter.xml
----------------------------------------------------------------------
diff --git a/bval-xstream/findbugs-exclude-filter.xml b/bval-xstream/findbugs-exclude-filter.xml
deleted file mode 100644
index eaf41b1..0000000
--- a/bval-xstream/findbugs-exclude-filter.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.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.
--->
-
-<!--
-  This file contains some false positive bugs detected by findbugs. Their
-  false positive nature has been analyzed individually and they have been
-  put here to instruct findbugs it must ignore them.
--->
-<FindBugsFilter>
-  <!-- not a problem -->
-  <Match>
-    <Class name="org.apache.bval.xml.XMLMetaBeanManager" />
-    <Method name="computeRelatedMetaBean" params="org.apache.bval.model.MetaProperty,java.lang.String" returns="void" />
-    <Bug pattern="NP_LOAD_OF_KNOWN_NULL_VALUE" />
-  </Match>
-</FindBugsFilter>

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/pom.xml
----------------------------------------------------------------------
diff --git a/bval-xstream/pom.xml b/bval-xstream/pom.xml
deleted file mode 100644
index bf90180..0000000
--- a/bval-xstream/pom.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<!--
-	Maven release plugin requires the project tag to be on a single line.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.bval</groupId>
-        <artifactId>bval-parent</artifactId>
-        <version>2.0.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>bval-xstream</artifactId>
-    <name>Apache BVal :: bval-xstream (optional)</name>
-    <packaging>jar</packaging>
-
-    <description>BVal XML Metadata with XStream</description>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.bval</groupId>
-            <artifactId>bval-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.thoughtworks.xstream</groupId>
-            <artifactId>xstream</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-weaver-privilizer-api</artifactId>
-        </dependency>
-        <!-- Test dependencies -->
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <!-- create mainClass attribute -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>default-jar</id>
-                        <goals>
-                            <goal>jar</goal>
-                        </goals>
-                        <configuration>
-                            <archive>
-                                <manifest>
-                                    <mainClass>org.apache.bval.util.BValVersion</mainClass>
-                                </manifest>
-                            </archive>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>attach-tests</id>
-                        <goals>
-                            <goal>test-jar</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>findbugs-maven-plugin</artifactId>
-                <configuration>
-                    <excludeFilterFile>findbugs-exclude-filter.xml</excludeFilterFile>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.commons</groupId>
-                <artifactId>commons-weaver-maven-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/routines/EMailValidation.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/routines/EMailValidation.java b/bval-xstream/src/main/java/org/apache/bval/routines/EMailValidation.java
deleted file mode 100644
index 925b9c2..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/routines/EMailValidation.java
+++ /dev/null
@@ -1,49 +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.routines;
-
-import org.apache.bval.model.Validation;
-import org.apache.bval.model.ValidationContext;
-import org.apache.bval.model.ValidationListener;
-
-import java.util.regex.Pattern;
-
-/**
- * Description: example validation for email addresses using a regular expression<br/>
- */
-public class EMailValidation implements Validation {
-
-    private java.util.regex.Pattern pattern = EMailValidationUtils.DEFAULT_EMAIL_PATTERN;
-
-    @Override
-    public <T extends ValidationListener> void validate(ValidationContext<T> context) {
-        if (context.getPropertyValue() == null)
-            return;
-        if (!EMailValidationUtils.isValid(context.getPropertyValue(), getPattern())) {
-            context.getListener().addError(Reasons.EMAIL_ADDRESS, context);
-        }
-    }
-
-    public Pattern getPattern() {
-        return pattern;
-    }
-
-    public void setPattern(Pattern pattern) {
-        this.pattern = pattern;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/routines/NOPValidation.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/routines/NOPValidation.java b/bval-xstream/src/main/java/org/apache/bval/routines/NOPValidation.java
deleted file mode 100644
index f6b4cce..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/routines/NOPValidation.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.routines;
-
-import org.apache.bval.model.Validation;
-import org.apache.bval.model.ValidationContext;
-import org.apache.bval.model.ValidationListener;
-
-/**
- * Description: DO NOTHING VALIDATION (can be used to turn off standard validation)<br/>
- */
-public class NOPValidation implements Validation {
-
-    @Override
-    public <T extends ValidationListener> void validate(ValidationContext<T> context) {
-        // do nothing
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/routines/Reasons.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/routines/Reasons.java b/bval-xstream/src/main/java/org/apache/bval/routines/Reasons.java
deleted file mode 100644
index 397081f..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/routines/Reasons.java
+++ /dev/null
@@ -1,31 +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.routines;
-
-import org.apache.bval.model.Features;
-
-/**
- * Description: StandardReasons for validation errors found in
- * {@link org.apache.bval.ValidationResults}<br/>
- */
-public interface Reasons extends Features.Property {
-    // The reasons inherited from Features are VALIDATION features only.
-    // INFO features are not meant to be validated.
-
-    // Add more reasons here.
-    String EMAIL_ADDRESS = "emailAddress";
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/routines/StandardValidation.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/routines/StandardValidation.java b/bval-xstream/src/main/java/org/apache/bval/routines/StandardValidation.java
deleted file mode 100644
index 5d8b84a..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/routines/StandardValidation.java
+++ /dev/null
@@ -1,192 +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.routines;
-
-import org.apache.bval.model.Features;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.model.Validation;
-import org.apache.bval.model.ValidationContext;
-import org.apache.bval.model.ValidationListener;
-import org.apache.bval.xml.XMLMetaValue;
-
-import java.util.Collection;
-import java.util.Date;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-import static org.apache.bval.model.Features.Property.MANDATORY;
-import static org.apache.bval.model.Features.Property.MAX_LENGTH;
-import static org.apache.bval.model.Features.Property.MAX_VALUE;
-import static org.apache.bval.model.Features.Property.MIN_LENGTH;
-import static org.apache.bval.model.Features.Property.MIN_VALUE;
-import static org.apache.bval.model.Features.Property.REG_EXP;
-import static org.apache.bval.model.Features.Property.TIME_LAG;
-
-/**
- * Description: This class implements the standard validations for properties!
- * You can subclass this class and replace the implementation
- * in the beanInfo-xml by providing it a validation "standard"<br/>
- */
-public class StandardValidation implements Validation {
-
-    /** key for this validation in the validation list of the beanInfos */
-    public String getValidationId() {
-        return "standard";
-    }
-
-    @Override
-    public <T extends ValidationListener> void validate(ValidationContext<T> context) {
-        validateMandatory(context);
-        validateMaxLength(context);
-        validateMinLength(context);
-        validateMaxValue(context);
-        validateMinValue(context);
-        validateRegExp(context);
-        validateTimeLag(context);
-    }
-
-    protected <T extends ValidationListener> void validateTimeLag(ValidationContext<T> context) {
-        String lag = (String) context.getMetaProperty().getFeature(TIME_LAG);
-        if (lag == null)
-            return;
-        if (context.getPropertyValue() == null)
-            return;
-        long date = ((Date) context.getPropertyValue()).getTime();
-        long now = System.currentTimeMillis();
-        if (XMLMetaValue.TIMELAG_Future.equals(lag)) {
-            if (date < now) {
-                context.getListener().addError(TIME_LAG, context);
-            }
-        } else if (XMLMetaValue.TIMELAG_Past.equals(lag)) {
-            if (date > now) {
-                context.getListener().addError(TIME_LAG, context);
-            }
-        } else {
-            throw new IllegalArgumentException("unknown timelag " + lag + " at " + context);
-        }
-    }
-
-    private static final String REG_EXP_PATTERN = "cachedRegExpPattern";
-
-    protected <T extends ValidationListener> void validateRegExp(ValidationContext<T> context) {
-        final MetaProperty meta = context.getMetaProperty();
-        final String regExp = (String) meta.getFeature(REG_EXP);
-        if (regExp == null)
-            return;
-        if (context.getPropertyValue() == null)
-            return;
-
-        final String value = String.valueOf(context.getPropertyValue());
-        try {
-            Pattern pattern = (Pattern) meta.getFeature(REG_EXP_PATTERN);
-            if (pattern == null) {
-                pattern = Pattern.compile(regExp);
-                meta.putFeature(REG_EXP_PATTERN, pattern);
-            }
-            if (!pattern.matcher(value).matches()) {
-                context.getListener().addError(REG_EXP, context);
-            }
-        } catch (PatternSyntaxException e) {
-            throw new IllegalArgumentException("regular expression malformed. regexp " + regExp + " at " + context, e);
-        }
-    }
-
-    protected <T extends ValidationListener> void validateMinValue(ValidationContext<T> context) {
-        @SuppressWarnings("unchecked")
-        Comparable<Object> minValue = (Comparable<Object>) context.getMetaProperty().getFeature(MIN_VALUE);
-        if (minValue == null || context.getPropertyValue() == null)
-            return;
-        if (compare(context, minValue, context.getPropertyValue()) > 0) {
-            context.getListener().addError(MIN_VALUE, context);
-        }
-    }
-
-    protected <T extends ValidationListener> void validateMaxValue(ValidationContext<T> context) {
-        @SuppressWarnings("unchecked")
-        Comparable<Object> maxValue = (Comparable<Object>) context.getMetaProperty().getFeature(MAX_VALUE);
-        if (maxValue == null || context.getPropertyValue() == null)
-            return;
-        if (compare(context, maxValue, context.getPropertyValue()) < 0) {
-            context.getListener().addError(MAX_VALUE, context);
-        }
-    }
-
-    private <T extends ValidationListener> int compare(ValidationContext<T> context, Comparable<Object> constraintValue,
-        Object currentValue) {
-        int r;
-        if (constraintValue.getClass().isAssignableFrom(currentValue.getClass())) {
-            r = constraintValue.compareTo(context.getPropertyValue());
-        } else if (currentValue instanceof Number) {
-            double dv = ((Number) currentValue).doubleValue();
-            double mdv = ((Number) constraintValue).doubleValue();
-            r = mdv > dv ? 1 : -1;
-        } else {
-            r = String.valueOf(constraintValue).compareTo(String.valueOf(currentValue));
-        }
-        return r;
-    }
-
-    protected <T extends ValidationListener> void validateMaxLength(ValidationContext<T> context) {
-        Integer maxLength = (Integer) context.getMetaProperty().getFeature(Features.Property.MAX_LENGTH);
-        if (maxLength == null)
-            return;
-        if (context.getPropertyValue() == null)
-            return;
-
-        final Object value = context.getPropertyValue();
-        int length = 0;
-        if (value instanceof String) {
-            length = ((String) value).length();
-        } else if (value instanceof Collection<?>) {
-            length = ((Collection<?>) value).size();
-        }
-        if (length > maxLength) {
-            context.getListener().addError(MAX_LENGTH, context);
-        }
-    }
-
-    protected <T extends ValidationListener> void validateMinLength(ValidationContext<T> context) {
-        Integer maxLength = (Integer) context.getMetaProperty().getFeature(Features.Property.MIN_LENGTH);
-        if (maxLength == null)
-            return;
-        if (context.getPropertyValue() == null)
-            return;
-
-        final Object value = context.getPropertyValue();
-        int length = 0;
-        if (value instanceof String) {
-            length = ((String) value).length();
-        } else if (value instanceof Collection<?>) {
-            length = ((Collection<?>) value).size();
-        }
-        if (length < maxLength) {
-            context.getListener().addError(MIN_LENGTH, context);
-        }
-    }
-
-    protected <T extends ValidationListener> void validateMandatory(ValidationContext<T> context) {
-        if (context.getMetaProperty().isMandatory()) {
-            if (context.getPropertyValue() == null) {
-                context.getListener().addError(MANDATORY, context);
-            }
-        }
-    }
-
-    public static StandardValidation getInstance() {
-        return new StandardValidation();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/MetaBeanEnricher.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/MetaBeanEnricher.java b/bval-xstream/src/main/java/org/apache/bval/xml/MetaBeanEnricher.java
deleted file mode 100644
index 5246b42..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/MetaBeanEnricher.java
+++ /dev/null
@@ -1,37 +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.xml;
-
-import org.apache.bval.model.MetaBean;
-
-import java.util.Map;
-
-/**
- * Description: Interface to merge meta beans<br/>
- */
-public interface MetaBeanEnricher {
-
-    /**
-     * @param infos - the patches to apply
-     * @return all MetaBeans for classes that have a xml descriptor and
-     *         additional the MetaBeans loaded by the given loaders.
-     *         The given loaders may also return patches for MetaBeans that have
-     *         also been returned by other loaders. The beans with patches for
-     *         references to patched beans will be copied.
-     */
-    Map<String, MetaBean> enrichCopies(XMLMetaBeanInfos... infos);
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/main/java/org/apache/bval/xml/XMLFeaturesCapable.java
----------------------------------------------------------------------
diff --git a/bval-xstream/src/main/java/org/apache/bval/xml/XMLFeaturesCapable.java b/bval-xstream/src/main/java/org/apache/bval/xml/XMLFeaturesCapable.java
deleted file mode 100644
index d06f6d5..0000000
--- a/bval-xstream/src/main/java/org/apache/bval/xml/XMLFeaturesCapable.java
+++ /dev/null
@@ -1,100 +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.xml;
-
-import com.thoughtworks.xstream.annotations.XStreamImplicit;
-import org.apache.bval.model.FeaturesCapable;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Description: <br/>
- */
-public class XMLFeaturesCapable implements Serializable {
-    /** Serialization version */
-    private static final long serialVersionUID = 1L;
-
-    @XStreamImplicit
-    private List<XMLMetaFeature> features;
-    @XStreamImplicit(itemFieldName = "validator")
-    private List<XMLMetaValidatorReference> validators;
-
-    public List<XMLMetaFeature> getFeatures() {
-        return features;
-    }
-
-    public void setFeatures(List<XMLMetaFeature> features) {
-        this.features = features;
-    }
-
-    public void putFeature(String key, Object value) {
-        XMLMetaFeature anno = findFeature(key);
-        if (features == null)
-            features = new ArrayList<XMLMetaFeature>();
-        if (anno == null) {
-            features.add(new XMLMetaFeature(key, value));
-        } else {
-            anno.setValue(value);
-        }
-    }
-
-    public void removeFeature(String key) {
-        XMLMetaFeature anno = findFeature(key);
-        if (anno != null) {
-            getFeatures().remove(anno);
-        }
-    }
-
-    public Object getFeature(String key) {
-        XMLMetaFeature anno = findFeature(key);
-        return anno == null ? null : anno.getValue();
-    }
-
-    private XMLMetaFeature findFeature(String key) {
-        if (features == null)
-            return null;
-        for (XMLMetaFeature anno : features) {
-            if (key.equals(anno.getKey()))
-                return anno;
-        }
-        return null;
-    }
-
-    public List<XMLMetaValidatorReference> getValidators() {
-        return validators;
-    }
-
-    public void setValidators(List<XMLMetaValidatorReference> validators) {
-        this.validators = validators;
-    }
-
-    public void addValidator(String validatorId) {
-        if (validators == null)
-            validators = new ArrayList<XMLMetaValidatorReference>();
-        validators.add(new XMLMetaValidatorReference(validatorId));
-    }
-
-    public void mergeFeaturesInto(FeaturesCapable fc) {
-        if (getFeatures() != null) {
-            for (XMLMetaFeature each : getFeatures()) {
-                fc.putFeature(each.getKey(), each.getValue());
-            }
-        }
-    }
-}


[8/8] bval git commit: remove obsolete modules, moving required core code to jsr

Posted by mb...@apache.org.
remove obsolete modules, moving required core code to jsr


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

Branch: refs/heads/bv2
Commit: ed299e4f15527f8eb1b90ac279b4b82d6e40cf8c
Parents: 92c64b3
Author: Matt Benson <mb...@apache.org>
Authored: Sun Feb 25 14:10:25 2018 -0600
Committer: Matt Benson <mb...@apache.org>
Committed: Sun Feb 25 14:10:25 2018 -0600

----------------------------------------------------------------------
 bval-core/pom.xml                               |  165 --
 .../main/appended-resources/META-INF/NOTICE.vm  |   25 -
 .../org/apache/bval/BeanValidationContext.java  |  355 ----
 .../java/org/apache/bval/BeanValidator.java     |  282 ----
 .../java/org/apache/bval/ConstructorAccess.java |   81 -
 .../java/org/apache/bval/DynamicMetaBean.java   |   48 -
 .../bval/IntrospectorMetaBeanFactory.java       |  112 --
 .../java/org/apache/bval/MetaBeanBuilder.java   |  134 --
 .../java/org/apache/bval/MetaBeanCache.java     |  113 --
 .../java/org/apache/bval/MetaBeanFactory.java   |   32 -
 .../java/org/apache/bval/MetaBeanFinder.java    |   40 -
 .../java/org/apache/bval/MetaBeanManager.java   |  154 --
 .../org/apache/bval/MetaBeanManagerFactory.java |   45 -
 .../src/main/java/org/apache/bval/Validate.java |   44 -
 .../java/org/apache/bval/ValidationResults.java |  236 ---
 .../java/org/apache/bval/model/DynaType.java    |   31 -
 .../org/apache/bval/model/DynaTypeEnum.java     |  121 --
 .../java/org/apache/bval/model/Features.java    |  117 --
 .../org/apache/bval/model/FeaturesCapable.java  |  186 ---
 .../main/java/org/apache/bval/model/Meta.java   |   29 -
 .../org/apache/bval/model/MetaAnnotated.java    |   44 -
 .../java/org/apache/bval/model/MetaBean.java    |  378 -----
 .../org/apache/bval/model/MetaConstructor.java  |   34 -
 .../org/apache/bval/model/MetaInvocable.java    |   40 -
 .../java/org/apache/bval/model/MetaMethod.java  |   34 -
 .../org/apache/bval/model/MetaParameter.java    |   42 -
 .../org/apache/bval/model/MetaProperty.java     |  164 --
 .../java/org/apache/bval/model/Validation.java  |   30 -
 .../apache/bval/model/ValidationContext.java    |  137 --
 .../apache/bval/model/ValidationListener.java   |   99 --
 .../bval/routines/EMailValidationUtils.java     |   75 -
 .../org/apache/bval/util/AccessStrategy.java    |   59 -
 .../java/org/apache/bval/util/BValVersion.java  |  195 ---
 .../bval/util/BeanUtilsPropertyAccess.java      |   44 -
 .../java/org/apache/bval/util/Exceptions.java   |  125 --
 .../java/org/apache/bval/util/FieldAccess.java  |  116 --
 .../org/apache/bval/util/IndexedAccess.java     |  121 --
 .../java/org/apache/bval/util/KeyedAccess.java  |  121 --
 .../main/java/org/apache/bval/util/Lazy.java    |   62 -
 .../main/java/org/apache/bval/util/LazyInt.java |   49 -
 .../java/org/apache/bval/util/MethodAccess.java |  151 --
 .../java/org/apache/bval/util/ObjectUtils.java  |   98 --
 .../org/apache/bval/util/ObjectWrapper.java     |   50 -
 .../org/apache/bval/util/PropertyAccess.java    |  336 ----
 .../java/org/apache/bval/util/StringUtils.java  |  149 --
 .../java/org/apache/bval/util/Validate.java     |   59 -
 .../org/apache/bval/util/ValidationHelper.java  |  239 ---
 .../apache/bval/util/reflection/Reflection.java |  457 -----
 .../apache/bval/util/reflection/TypeUtils.java  | 1557 ------------------
 .../org/apache/bval/ValidationResultsTest.java  |   52 -
 .../java/org/apache/bval/model/ExampleEnum.java |   27 -
 .../org/apache/bval/model/MetaPropertyTest.java |   43 -
 .../org/apache/bval/util/StringUtilsTest.java   |   32 -
 bval-core/src/test/resources/log4j.xml          |   41 -
 bval-json/pom.xml                               |   76 -
 .../main/appended-resources/META-INF/NOTICE.vm  |   25 -
 .../org/apache/bval/json/JSONGenerator.java     |   76 -
 .../org/apache/bval/json/bean-infos-json.ftl    |   85 -
 .../org/apache/bval/json/JSONGeneratorTest.java |  104 --
 bval-jsr/pom.xml                                |   69 +-
 .../bval/routines/EMailValidationUtils.java     |   75 +
 .../java/org/apache/bval/util/BValVersion.java  |  195 +++
 .../java/org/apache/bval/util/Exceptions.java   |  125 ++
 .../main/java/org/apache/bval/util/Lazy.java    |   62 +
 .../main/java/org/apache/bval/util/LazyInt.java |   49 +
 .../java/org/apache/bval/util/ObjectUtils.java  |   98 ++
 .../org/apache/bval/util/ObjectWrapper.java     |   50 +
 .../java/org/apache/bval/util/StringUtils.java  |  149 ++
 .../java/org/apache/bval/util/Validate.java     |   59 +
 .../apache/bval/util/reflection/Reflection.java |  457 +++++
 .../apache/bval/util/reflection/TypeUtils.java  | 1557 ++++++++++++++++++
 .../org/apache/bval/jsr/TckReproducerTest.java  |   25 +-
 bval-xstream/findbugs-exclude-filter.xml        |   31 -
 bval-xstream/pom.xml                            |  102 --
 .../apache/bval/routines/EMailValidation.java   |   49 -
 .../org/apache/bval/routines/NOPValidation.java |   32 -
 .../java/org/apache/bval/routines/Reasons.java  |   31 -
 .../bval/routines/StandardValidation.java       |  192 ---
 .../org/apache/bval/xml/MetaBeanEnricher.java   |   37 -
 .../org/apache/bval/xml/XMLFeaturesCapable.java |  100 --
 .../java/org/apache/bval/xml/XMLMapper.java     |   44 -
 .../java/org/apache/bval/xml/XMLMetaBean.java   |  161 --
 .../org/apache/bval/xml/XMLMetaBeanBuilder.java |  185 ---
 .../org/apache/bval/xml/XMLMetaBeanFactory.java |  234 ---
 .../org/apache/bval/xml/XMLMetaBeanInfos.java   |  139 --
 .../org/apache/bval/xml/XMLMetaBeanLoader.java  |   26 -
 .../org/apache/bval/xml/XMLMetaBeanManager.java |  138 --
 .../bval/xml/XMLMetaBeanManagerFactory.java     |   62 -
 .../apache/bval/xml/XMLMetaBeanReference.java   |   58 -
 .../apache/bval/xml/XMLMetaBeanRegistry.java    |   35 -
 .../apache/bval/xml/XMLMetaBeanURLLoader.java   |   46 -
 .../org/apache/bval/xml/XMLMetaElement.java     |  148 --
 .../org/apache/bval/xml/XMLMetaFeature.java     |   60 -
 .../org/apache/bval/xml/XMLMetaProperty.java    |  104 --
 .../org/apache/bval/xml/XMLMetaValidator.java   |   77 -
 .../bval/xml/XMLMetaValidatorReference.java     |   49 -
 .../java/org/apache/bval/xml/XMLMetaValue.java  |   34 -
 .../org/apache/bval/example/BusinessEnum.java   |   24 -
 .../org/apache/bval/example/BusinessObject.java |  125 --
 .../bval/example/BusinessObjectAddress.java     |   49 -
 .../bval/example/BusinessObjectBeanInfo.java    |   64 -
 .../bval/routines/StandardValidationTest.java   |  224 ---
 .../org/apache/bval/xml/BeanValidatorTest.java  |  105 --
 .../apache/bval/xml/XMLMetaBeanInfosTest.java   |  143 --
 .../apache/bval/xml/XMLMetaBeanManagerTest.java |   93 --
 .../bval/example/test-beanInfos-custom.xml      |   31 -
 .../org/apache/bval/example/test-beanInfos.xml  |   77 -
 pom.xml                                         |   12 +-
 108 files changed, 2953 insertions(+), 11114 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/pom.xml
----------------------------------------------------------------------
diff --git a/bval-core/pom.xml b/bval-core/pom.xml
deleted file mode 100644
index b7a7f8b..0000000
--- a/bval-core/pom.xml
+++ /dev/null
@@ -1,165 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<!--
-	Maven release plugin requires the project tag to be on a single line.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.bval</groupId>
-        <artifactId>bval-parent</artifactId>
-        <version>2.0.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>bval-core</artifactId>
-    <name>Apache BVal :: bval-core</name>
-    <packaging>jar</packaging>
-
-    <description>BVal Metadata Engine</description>
-
-    <dependencies>
-        <!-- we only support validation in DynaBeans, but do not use c-beanutils in BVal itself -->
-        <dependency>
-            <groupId>commons-beanutils</groupId>
-            <artifactId>commons-beanutils-core</artifactId>
-            <optional>true</optional>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-weaver-privilizer-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <!--
-                get the svn revision number and project version
-                and set it in a properties file for later retrieval
-            -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>set subversion revision</id>
-                        <phase>compile</phase>
-                        <configuration>
-                            <target>
-                                <echo>Version: ${project.version}</echo>
-                                <echo>Revision: ${buildNumber}</echo>
-                                <echo>Date: ${timestamp}</echo>
-                                <mkdir dir="${project.build.outputDirectory}/META-INF" />
-                                <echo file="${project.build.outputDirectory}/META-INF/org.apache.bval.revision.properties">
-# Licensed under Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0
-project.name=Apache BVal
-project.version=${project.version}
-svn.revision=${buildNumber}
-svn.branch=${scmBranch}
-build.timestamp=${timestamp}
-                                </echo>
-                            </target>
-                        </configuration>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <!-- create mainClass attribute -->
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>default-jar</id>
-                        <goals>
-                            <goal>jar</goal>
-                        </goals>
-                        <configuration>
-                            <archive>
-                                <manifest>
-                                   <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
-                                   <mainClass>org.apache.bval.util.BValVersion</mainClass>
-                                </manifest>
-                                <manifestEntries>
-                                    <Implementation-Build>${buildNumber}</Implementation-Build>
-                                </manifestEntries>
-                            </archive>
-                        </configuration>
-                    </execution>
-                    <execution>
-                        <id>attach-tests</id>
-                        <goals>
-                            <goal>test-jar</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.commons</groupId>
-                <artifactId>commons-weaver-maven-plugin</artifactId>
-            </plugin>
-        </plugins>
-        <pluginManagement>
-            <plugins>
-                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
-                <plugin>
-                    <groupId>org.eclipse.m2e</groupId>
-                    <artifactId>lifecycle-mapping</artifactId>
-                    <version>1.0.0</version>
-                    <configuration>
-                        <lifecycleMappingMetadata>
-                            <pluginExecutions>
-                                <pluginExecution>
-                                    <pluginExecutionFilter>
-                                        <groupId>
-                                            org.apache.maven.plugins
-                                        </groupId>
-                                        <artifactId>
-                                            maven-antrun-plugin
-                                        </artifactId>
-                                        <versionRange>
-                                            [1.3,)
-                                        </versionRange>
-                                        <goals>
-                                            <goal>run</goal>
-                                        </goals>
-                                    </pluginExecutionFilter>
-                                    <action>
-                                        <ignore />
-                                    </action>
-                                </pluginExecution>
-                            </pluginExecutions>
-                        </lifecycleMappingMetadata>
-                    </configuration>
-                </plugin>
-            </plugins>
-        </pluginManagement>
-    </build>
-</project>
-

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/appended-resources/META-INF/NOTICE.vm
----------------------------------------------------------------------
diff --git a/bval-core/src/main/appended-resources/META-INF/NOTICE.vm b/bval-core/src/main/appended-resources/META-INF/NOTICE.vm
deleted file mode 100644
index 9a0c1ee..0000000
--- a/bval-core/src/main/appended-resources/META-INF/NOTICE.vm
+++ /dev/null
@@ -1,25 +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.
-##
-
-The following copyright notice(s) were affixed to portions of this code
-with which this file is now or was at one time distributed.
-
-This product includes software developed by agimatec GmbH.
-Copyright 2007-2010 Agimatec GmbH. All rights reserved.
-

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java b/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
deleted file mode 100644
index b0e386b..0000000
--- a/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
+++ /dev/null
@@ -1,355 +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;
-
-import org.apache.bval.model.FeaturesCapable;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.model.ValidationContext;
-import org.apache.bval.model.ValidationListener;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.PropertyAccess;
-
-import java.util.IdentityHashMap;
-import java.util.Map;
-
-/**
- * Description: Context during validation to help the {@link org.apache.bval.model.Validation}
- * and the {@link BeanValidator} do their jobs.
- * Used to bundle {@link BeanValidationContext} and {@link ValidationListener}
- * together <br/>
- * <b>This class is NOT thread-safe: a new instance will be created for each
- * validation
- * processing per thread.<br/></b>
- */
-public class BeanValidationContext<T extends ValidationListener> implements ValidationContext<T> {
-    /** represent an unknown propertyValue. */
-    private static final Object UNKNOWN = new Object() {
-        @Override
-        public String toString() {
-            return "unknown property value";
-        }
-    };
-
-    /** metainfo of current object. */
-    private MetaBean metaBean;
-    /** current object. */
-    private Object bean;
-    /** metainfo of current property. */
-    private MetaProperty metaProperty;
-    /**
-     * cached value of current property.
-     * Cached because of potential redundant access for different Validations
-     */
-    private Object propertyValue = UNKNOWN;
-
-    /** access strategy used for previous access */
-    private AccessStrategy access;
-
-    /** set of objects already validated to avoid endless loops. */
-    @SuppressWarnings({ "rawtypes" })
-    protected Map validatedObjects;
-
-    /**
-     * true when value is fixed, so that it will NOT be dynamically
-     * determined from the annotated element or the metaProperty.
-     * <b><br>Note: When value is UNKNOWN, it will be determined THE FIRST TIME
-     * IT IS ACCESSED.</b>
-     */
-    private boolean fixed;
-
-    /** listener notified of validation constraint violations. */
-    private T listener;
-
-    /**
-     * Create a new BeanValidationContext instance.
-     * @param listener
-     */
-    @SuppressWarnings({ "rawtypes" })
-    public BeanValidationContext(T listener) {
-        this(listener, new IdentityHashMap());
-    }
-
-    /**
-     * Create a new BeanValidationContext instance.
-     * @param listener
-     * @param validatedMap
-     */
-    @SuppressWarnings({ "rawtypes" })
-    protected BeanValidationContext(T listener, Map validatedMap) {
-        this.listener = listener;
-        this.validatedObjects = validatedMap;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public T getListener() {
-        return listener;
-    }
-
-    /**
-     * Set the listener.
-     * @param listener T
-     */
-    public void setListener(T listener) {
-        this.listener = listener;
-    }
-
-    /**
-     * {@inheritDoc}
-     * Here, state equates to a given bean reference.
-     */
-    @Override
-    @SuppressWarnings("unchecked")
-    public boolean collectValidated() {
-        return validatedObjects.put(getBean(), Boolean.TRUE) == null;
-    }
-
-    /**
-     * Learn whether a particular object has been validated.
-     * @param object
-     * @return true when the object has already been validated in this context
-     */
-    public boolean isValidated(Object object) {
-        return validatedObjects.containsKey(object);
-    }
-
-    /**
-     * Clear map of validated objects (invoke when you want to 'reuse' the
-     * context for different validations)
-     */
-    public void resetValidated() {
-        validatedObjects.clear();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setBean(Object aBean, MetaBean aMetaBean) {
-        bean = aBean;
-        metaBean = aMetaBean;
-        metaProperty = null;
-        unknownValue();
-    }
-
-    /**
-     * Get the cached value or access it somehow (via field or method)<br>
-     * <b>you should prefer getPropertyValue(AccessStrategy) instead of this method</b>
-     *
-     * @return the current value of the property accessed by reflection
-     * @throws IllegalArgumentException - error accessing attribute (config error, reflection problem)
-     * @throws IllegalStateException    - when no property is currently set in the context (application logic bug)
-     */
-    @Override
-    public Object getPropertyValue() {
-        if (access == null) { // undefined access strategy
-            return getPropertyValue(PropertyAccess.getInstance(bean.getClass(), metaProperty.getName()));
-        }
-        return getPropertyValue(access);
-    }
-
-    /**
-     * {@inheritDoc}
-     * Caches retrieved value.
-     */
-    @Override
-    public Object getPropertyValue(AccessStrategy access) throws IllegalArgumentException, IllegalStateException {
-        if (propertyValue == UNKNOWN || (this.access != access && !fixed)) {
-            propertyValue = access.get(bean);
-            this.access = access;
-        }
-        return propertyValue;
-    }
-
-    /**
-     * Convenience method to access metaProperty.name
-     *
-     * @return null or the name of the current property
-     */
-    @Override
-    public String getPropertyName() {
-        return metaProperty == null ? null : metaProperty.getName();
-    }
-
-    /**
-     * Set the current property value.
-     * @param propertyValue
-     */
-    public void setPropertyValue(Object propertyValue) {
-        this.propertyValue = propertyValue;
-    }
-
-    /**
-     * Set the property value, fixed.
-     * @param value
-     */
-    public void setFixedValue(Object value) {
-        setPropertyValue(value);
-        setFixed(true);
-    }
-
-    /**
-     * Learn whether the current property value is "fixed."
-     * @return boolean
-     */
-    public boolean isFixed() {
-        return fixed;
-    }
-
-    /**
-     * Potentially declare the current property value as being "fixed."
-     * If <code>true</code>, the context will reuse any not-<code>UNKNOWN</code>
-     * propertyValue regardless of the {@link AccessStrategy} by which it is requested.
-     * @param fixed
-     */
-    public void setFixed(boolean fixed) {
-        this.fixed = fixed;
-    }
-
-    /**
-     * Depending on whether we have a metaProperty or not,
-     * this returns the metaProperty or otherwise the metaBean.
-     * This is used to have a simple way to request features
-     * in the Validation for both bean- and property-level validations.
-     *
-     * @return something that is capable to deliver features
-     */
-    public FeaturesCapable getMeta() {
-        return (metaProperty == null) ? metaBean : metaProperty;
-    }
-
-    /**
-     * Drop cached value, marking the internal cachedValue as <code>UNKNOWN</code>.
-     * This forces the BeanValidationContext to recompute the value
-     * the next time it is accessed.
-     * Use this method inside tests or when the propertyValue has been
-     * changed during validation.
-     */
-    public void unknownValue() {
-        propertyValue = UNKNOWN;
-        access = null;
-        fixed = false;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public MetaBean getMetaBean() {
-        return metaBean;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Object getBean() {
-        return bean;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public MetaProperty getMetaProperty() {
-        return metaProperty;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setMetaBean(MetaBean metaBean) {
-        this.metaBean = metaBean;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setBean(Object bean) {
-        this.bean = bean;
-        unknownValue();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setMetaProperty(MetaProperty metaProperty) {
-        this.metaProperty = metaProperty;
-        unknownValue();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return "BeanValidationContext{ bean=" + bean + ", metaProperty=" + metaProperty + ", propertyValue="
-            + propertyValue + '}';
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void moveDown(MetaProperty prop, AccessStrategy access) {
-        setBean(getPropertyValue(access), prop.getMetaBean());
-    }
-
-    @Override
-    public void moveDown(String prop) {
-        // no-op: not supported
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void moveUp(Object bean, MetaBean aMetaBean) {
-        setBean(bean, aMetaBean); // reset context state
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setCurrentIndex(Integer index) {
-        // do nothing
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setCurrentKey(Object key) {
-        // do nothing
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public AccessStrategy getAccess() {
-        return this.access;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/BeanValidator.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/BeanValidator.java b/bval-core/src/main/java/org/apache/bval/BeanValidator.java
deleted file mode 100644
index d4b44b6..0000000
--- a/bval-core/src/main/java/org/apache/bval/BeanValidator.java
+++ /dev/null
@@ -1,282 +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;
-
-import org.apache.bval.model.Features;
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaProperty;
-import org.apache.bval.model.ValidationContext;
-import org.apache.bval.model.ValidationListener;
-import org.apache.bval.util.AccessStrategy;
-import org.apache.bval.util.PropertyAccess;
-import org.apache.bval.util.ValidationHelper;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.Collection;
-
-// TODO: centralize treatMapsLikeBeans
-
-/**
- * Description: Top-Level API-class to validate objects or object-trees. You can
- * invoke, extend or utilize this class if you need other ways to integrate
- * validation in your application.
- * <p/>
- * This class supports cyclic object graphs by keeping track of validated
- * instances in the validation context.<br/>
- */
-public class BeanValidator<T extends ValidationListener> {
-    private final MetaBeanFinder metaBeanFinder;
-
-    /**
-     * Create a new BeanValidator instance. Convenience constructor. Use the
-     * global instance of MetaBeanManagerFactory.getFinder().
-     */
-    public BeanValidator() {
-        this(MetaBeanManagerFactory.getFinder());
-    }
-
-    /**
-     * Create a new BeanValidator instance.
-     * 
-     * @param metaBeanFinder
-     */
-    public BeanValidator(MetaBeanFinder metaBeanFinder) {
-        this.metaBeanFinder = metaBeanFinder;
-    }
-
-    /**
-     * Convenience API. validate a root object with all related objects with its
-     * default metaBean definition.
-     * 
-     * @param bean
-     * @return results - validation results found
-     */
-    public T validate(Object bean) {
-        MetaBean metaBean = getMetaBeanFinder().findForClass(bean.getClass());
-        return validate(bean, metaBean);
-    }
-
-    /**
-     * Convenience API. validate a root object with all related objects
-     * according to the metaBean.
-     * 
-     * @param bean
-     *            - a single bean or a collection of beans (that share the same
-     *            metaBean!)
-     * @param metaBean
-     * @return results - validation results found
-     */
-    public T validate(Object bean, MetaBean metaBean) {
-        ValidationContext<T> context = createContext();
-        context.setBean(bean, metaBean);
-        ValidationHelper.validateContext(context, new BeanValidatorCallback(context), treatMapsLikeBeans);
-        return context.getListener();
-    }
-
-    /**
-     * Validate the method parameters based on @Validate annotations.
-     * Requirements: Parameter, that are to be validated must be annotated with @Validate
-     * 
-     * @param method
-     *            - a method
-     * @param parameters
-     *            - the parameters suitable to the method
-     * @return a validation result or null when there was nothing to validate
-     * @see Validate
-     */
-    public T validateCall(Method method, Object[] parameters) {
-        if (parameters.length > 0) {
-            // shortcut (for performance!)
-            Annotation[][] annotations = method.getParameterAnnotations();
-            ValidationContext<T> context = null;
-            for (int i = 0; i < parameters.length; i++) {
-                for (Annotation anno : annotations[i]) {
-                    if (anno instanceof Validate) {
-                        if (context == null) {
-                            context = createContext();
-                        }
-                        if (determineMetaBean((Validate) anno, parameters[i], context)) {
-                            ValidationHelper.validateContext(context, new BeanValidatorCallback(context),
-                                treatMapsLikeBeans);
-                            break; // next parameter
-                        }
-                    }
-                }
-            }
-            return context == null ? null : context.getListener();
-        }
-        return null;
-    }
-
-    /**
-     * Determine the metabean for the given object.
-     * 
-     * @param <VL>
-     * @param validate
-     * @param parameter
-     * @param context
-     * @return true when validation should happen, false to skip it
-     */
-    protected <VL extends ValidationListener> boolean determineMetaBean(Validate validate, Object parameter,
-        ValidationContext<VL> context) {
-        if (validate.value().isEmpty()) {
-            if (parameter == null) {
-                return false;
-            }
-            Class<?> beanClass;
-            if (parameter instanceof Collection<?>) { // do not validate empty collection
-                Collection<?> coll = ((Collection<?>) parameter);
-                if (coll.isEmpty()) {
-                    return false;
-                }
-                beanClass = coll.iterator().next().getClass(); // get first object
-            } else if (parameter.getClass().isArray()) {
-                beanClass = parameter.getClass().getComponentType();
-            } else {
-                beanClass = parameter.getClass();
-            }
-            context.setBean(parameter, getMetaBeanFinder().findForClass(beanClass));
-        } else {
-            context.setBean(parameter, getMetaBeanFinder().findForId(validate.value()));
-        }
-        return true;
-    }
-
-    /**
-     * factory method - overwrite in subclasses
-     * 
-     * @return ValidationListener of the proper type
-     */
-    @SuppressWarnings("unchecked")
-    protected T createResults() {
-        return (T) new ValidationResults();
-    }
-
-    /**
-     * factory method - overwrite in subclasses
-     * 
-     * @return ValidationContext parameterized with our listener type
-     */
-    protected ValidationContext<T> createContext() {
-        return new BeanValidationContext<T>(createResults());
-    }
-
-    /**
-     * Convenience API. validate a single property.
-     * 
-     * @param bean
-     *            - the root object
-     * @param metaProperty
-     *            - metadata for the property
-     * @return validation results
-     */
-    public T validateProperty(Object bean, MetaProperty metaProperty) {
-        ValidationContext<T> context = createContext();
-        context.setBean(bean);
-        context.setMetaProperty(metaProperty);
-        ValidationHelper.validateProperty(context);
-        return context.getListener();
-    }
-
-    /**
-     * {@inheritDoc} internal validate a bean (=not a collection of beans) and
-     * its related beans
-     */
-    protected <VL extends ValidationListener> void validateBeanNet(ValidationContext<VL> context) {
-        if (context.collectValidated()) {
-            ValidationHelper.validateBean(context);
-            for (MetaProperty prop : context.getMetaBean().getProperties()) {
-                validateRelatedBean(context, prop);
-            }
-        }
-    }
-
-    /**
-     * Validate a property of a graph.
-     * 
-     * @param <VL>
-     * @param context
-     * @param prop
-     */
-    protected <VL extends ValidationListener> void validateRelatedBean(ValidationContext<VL> context,
-        MetaProperty prop) {
-        AccessStrategy[] access = prop.getFeature(Features.Property.REF_CASCADE);
-        if (access == null && prop.getMetaBean() != null) { // single property access strategy
-            // save old values from context
-            final Object bean = context.getBean();
-            final MetaBean mbean = context.getMetaBean();
-            // modify context state for relationship-target bean
-            context.moveDown(prop, PropertyAccess.getInstance(bean.getClass(), prop.getName()));
-            ValidationHelper.validateContext(context, new BeanValidatorCallback(context), treatMapsLikeBeans);
-            // restore old values in context
-            context.moveUp(bean, mbean);
-        } else if (access != null) { // different accesses to relation
-            // save old values from context
-            final Object bean = context.getBean();
-            final MetaBean mbean = context.getMetaBean();
-            for (AccessStrategy each : access) {
-                // modify context state for relationship-target bean
-                context.moveDown(prop, each);
-                ValidationHelper.validateContext(context, new BeanValidatorCallback(context), treatMapsLikeBeans);
-                // restore old values in context
-                context.moveUp(bean, mbean);
-            }
-        }
-    }
-
-    private boolean treatMapsLikeBeans = false;
-
-    public boolean isTreatMapsLikeBeans() {
-        return treatMapsLikeBeans;
-    }
-
-    public void setTreatMapsLikeBeans(boolean treatMapsLikeBeans) {
-        this.treatMapsLikeBeans = treatMapsLikeBeans;
-    }
-
-    /**
-     * Get the metabean finder associated with this validator.
-     * 
-     * @return a MetaBeanFinder
-     * @see org.apache.bval.MetaBeanManagerFactory#getFinder()
-     */
-    public MetaBeanFinder getMetaBeanFinder() {
-        return metaBeanFinder;
-    }
-
-    /**
-     * Dispatches a call from {@link #validate()} to
-     * {@link BeanValidator#validateBeanNet(ValidationContext)} with the current
-     * context set.
-     */
-    private class BeanValidatorCallback implements ValidationHelper.ValidateCallback {
-
-        private final ValidationContext<?> context;
-
-        public BeanValidatorCallback(ValidationContext<?> context) {
-            this.context = context;
-        }
-
-        @Override
-        public void validate() {
-            validateBeanNet(context);
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java b/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java
deleted file mode 100644
index 5509cde..0000000
--- a/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java
+++ /dev/null
@@ -1,81 +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;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Type;
-
-import org.apache.bval.util.AccessStrategy;
-
-public class ConstructorAccess extends AccessStrategy {
-
-    private final Constructor<?> constructor;
-
-    public ConstructorAccess(final Constructor<?> constructor) {
-        this.constructor = constructor;
-    }
-
-    @Override
-    public Object get(final Object instance) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public ElementType getElementType() {
-        return ElementType.CONSTRUCTOR;
-    }
-
-    @Override
-    public Type getJavaType() {
-        return constructor.getDeclaringClass();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getPropertyName() {
-        return constructor.getDeclaringClass().getSimpleName();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return constructor.toString();
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-
-        final ConstructorAccess that = (ConstructorAccess) o;
-        return constructor.equals(that.constructor);
-    }
-
-    @Override
-    public int hashCode() {
-        return constructor.hashCode();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/DynamicMetaBean.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/DynamicMetaBean.java b/bval-core/src/main/java/org/apache/bval/DynamicMetaBean.java
deleted file mode 100644
index d1ddba8..0000000
--- a/bval-core/src/main/java/org/apache/bval/DynamicMetaBean.java
+++ /dev/null
@@ -1,48 +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;
-
-import org.apache.bval.model.MetaBean;
-
-// TODO: Reduce visibility
-
-/**
- * Description: Dynamic {@link MetaBean} subclass.<br/>
- */
-public final class DynamicMetaBean extends MetaBean {
-    private static final long serialVersionUID = 1L;
-
-    private final MetaBeanFinder finder;
-
-    /**
-     * Create a new DynamicMetaBean instance.
-     * @param finder
-     */
-    public DynamicMetaBean(MetaBeanFinder finder) {
-        this.finder = finder;
-    }
-
-    /**
-     * {@inheritDoc}
-     * different strategies with hints to find MetaBean of associated object can
-     * be implemented here.
-     */
-    @Override
-    public MetaBean resolveMetaBean(Object bean) {
-        return bean instanceof Class<?> ? finder.findForClass((Class<?>) bean) : finder.findForClass(bean.getClass());
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java b/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java
deleted file mode 100644
index f85afa4..0000000
--- a/bval-core/src/main/java/org/apache/bval/IntrospectorMetaBeanFactory.java
+++ /dev/null
@@ -1,112 +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;
-
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaProperty;
-
-import java.beans.BeanInfo;
-import java.beans.IndexedPropertyDescriptor;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Enumeration;
-
-import static org.apache.bval.model.Features.Property.HIDDEN;
-import static org.apache.bval.model.Features.Property.PREFERRED;
-import static org.apache.bval.model.Features.Property.READONLY;
-
-/**
- * Description: use information from java.beans.Introspector in MetaBeans. The PropertyDescriptor can contain info about
- * HIDDEN, PREFERRED, READONLY and other features<br/>
- * NOTE: THIS IS AN OPTIONAL CLASS, TO ENABLE IT, SET Factory Property apache.bval.enable-introspector="true"
- */
-public class IntrospectorMetaBeanFactory implements MetaBeanFactory {
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void buildMetaBean(MetaBean meta) throws Exception {
-        if (meta.getBeanClass() == null) {
-            return; // handle only, when local class exists
-        }
-        BeanInfo info = Introspector.getBeanInfo(meta.getBeanClass());
-        if (meta.getName() == null && info.getBeanDescriptor() != null) {
-            meta.setName(info.getBeanDescriptor().getName()); // (display?)name = simple class name!
-        }
-        for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
-            if (!(pd instanceof IndexedPropertyDescriptor || pd.getName().equals("class"))) {
-                MetaProperty metaProp = buildMetaProperty(pd, meta.getProperty(pd.getName()));
-                meta.putProperty(pd.getName(), metaProp);
-            }
-        }
-    }
-
-    /**
-     * Create a {@link MetaProperty} from the specified {@link PropertyDescriptor}.
-     * 
-     * @param pd
-     * @return MetaProperty
-     */
-    @Deprecated
-    protected MetaProperty buildMetaProperty(PropertyDescriptor pd) {
-        return buildMetaProperty(pd, null);
-    }
-
-    /**
-     * Create a {@link MetaProperty} from the specified {@link PropertyDescriptor}.
-     * 
-     * @param pd
-     * @param existing
-     * @return MetaProperty
-     */
-    protected MetaProperty buildMetaProperty(PropertyDescriptor pd, MetaProperty existing) {
-        MetaProperty meta = new MetaProperty();
-        meta.setName(pd.getName());
-        meta.setType(determineGenericPropertyType(pd));
-        if (pd.isHidden()) {
-            meta.putFeature(HIDDEN, Boolean.TRUE);
-        }
-        if (pd.isPreferred()) {
-            meta.putFeature(PREFERRED, Boolean.TRUE);
-        }
-        if (pd.isConstrained()) {
-            meta.putFeature(READONLY, Boolean.TRUE);
-        }
-        Enumeration<String> enumeration = pd.attributeNames();
-        while (enumeration.hasMoreElements()) {
-            String key = enumeration.nextElement();
-            Object value = pd.getValue(key);
-            meta.putFeature(key, value);
-        }
-        return meta;
-    }
-
-    private Type determineGenericPropertyType(PropertyDescriptor pd) {
-        Method m = pd.getReadMethod();
-        if (m != null) {
-            return m.getGenericReturnType();
-        }
-        m = pd.getWriteMethod();
-        if (m != null && m.getParameterTypes().length == 1) {
-            return m.getGenericParameterTypes()[0];
-        }
-        return pd.getPropertyType();
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java b/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java
deleted file mode 100644
index 2c9de93..0000000
--- a/bval-core/src/main/java/org/apache/bval/MetaBeanBuilder.java
+++ /dev/null
@@ -1,134 +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;
-
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.util.reflection.Reflection;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Description: internal implementation class to construct metabeans with
- * factories<br/>
- */
-public class MetaBeanBuilder {
-
-    private static final Logger log = Logger.getLogger(MetaBeanBuilder.class.getName());
-
-    /**
-     * here you can install different kinds of factories to create MetaBeans
-     * from
-     */
-    private MetaBeanFactory[] factories;
-
-    /**
-     * Create a new MetaBeanBuilder instance.
-     */
-    public MetaBeanBuilder() {
-        this(new MetaBeanFactory[] { new IntrospectorMetaBeanFactory() });
-    }
-
-    /**
-     * Create a new MetaBeanBuilder instance.
-     * 
-     * @param factories
-     */
-    public MetaBeanBuilder(MetaBeanFactory[] factories) {
-        setFactories(factories);
-    }
-
-    /**
-     * Get the configured set of {@link MetaBeanFactory} objects.
-     * 
-     * @return {@link MetaBeanFactory} array
-     */
-    public MetaBeanFactory[] getFactories() {
-        return factories != null ? factories.clone() : null;
-    }
-
-    /**
-     * Set the array of {@link MetaBeanFactory} instances with which to enrich
-     * {@link MetaBean}s.
-     * 
-     * @param factories
-     */
-    public void setFactories(MetaBeanFactory[] factories) {
-        this.factories = factories != null ? factories.clone() : null;
-    }
-
-    /**
-     * Build a {@link MetaBean} for a given id.
-     * 
-     * @param beanInfoId
-     * @return MetaBean
-     * @throws Exception
-     *             if unable to build
-     */
-    public MetaBean buildForId(String beanInfoId) throws Exception {
-        throw new IllegalArgumentException("MetaBean " + beanInfoId + " not found");
-    }
-
-    /**
-     * Build beans for all known ids. Default implementation returns an empty
-     * map.
-     * 
-     * @return Map of String : MetaBean
-     */
-    public Map<String, MetaBean> buildAll() throws Exception {
-        return new HashMap<String, MetaBean>();
-    }
-
-    /**
-     * Find the named class.
-     * 
-     * @param className
-     * @return Class found or null
-     */
-    protected Class<?> findLocalClass(String className) {
-        if (className != null) {
-            try {
-                return Reflection.toClass(className);
-            } catch (ClassNotFoundException e) {
-                log.log(Level.FINE, String.format("Class not found: %s", className), e);
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Build a MetaBean for the specified class.
-     * 
-     * @param clazz
-     * @return MetaBean
-     * @throws Exception
-     */
-    public MetaBean buildForClass(Class<?> clazz) throws Exception {
-        MetaBean meta = new MetaBean();
-        if (clazz != null) { // local class here?
-            meta.setBeanClass(clazz);
-            meta.setId(clazz.getName()); // default id = full class name!
-        }
-        for (MetaBeanFactory factory : factories) {
-            factory.buildMetaBean(meta);
-        }
-        return meta;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java b/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java
deleted file mode 100644
index 5c1b281..0000000
--- a/bval-core/src/main/java/org/apache/bval/MetaBeanCache.java
+++ /dev/null
@@ -1,113 +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;
-
-import org.apache.bval.model.MetaBean;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * Description: a cache to hold metabeans by id and by class.<br/>
- */
-public class MetaBeanCache implements MetaBeanFinder, Serializable {
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * Cache keyed by id.
-     */
-    protected final ConcurrentMap<String, MetaBean> cacheById = new ConcurrentHashMap<String, MetaBean>();
-    /**
-     * Cache keyed by class.
-     */
-    protected final ConcurrentMap<Class<?>, MetaBean> cacheByClass = new ConcurrentHashMap<Class<?>, MetaBean>();
-
-    /**
-     * Create a new MetaBeanCache instance.
-     */
-    public MetaBeanCache() {
-        super();
-    }
-
-    /**
-     * Create a new MetaBeanCache instance.
-     * @param beans
-     */
-    public MetaBeanCache(Map<String, MetaBean> beans) {
-        this();
-        for (MetaBean bean : beans.values()) {
-            cache(bean);
-        }
-    }
-
-    /**
-     * Clear the cache.
-     */
-    public void clear() {
-        cacheById.clear();
-        cacheByClass.clear();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public MetaBean findForId(String beanInfoId) {
-        return cacheById.get(beanInfoId);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public MetaBean findForClass(Class<?> clazz) {
-        return cacheByClass.get(clazz);
-    }
-
-    /**
-     * Return all cached MetaBeans by id.
-     * @return live map
-     */
-    public Map<String, MetaBean> findAll() {
-        return cacheById;
-    }
-
-    /**
-     * Cache the specified MetaBean.
-     * @param beanInfo
-     */
-    public void cache(MetaBean beanInfo) {
-        cacheById.put(beanInfo.getId(), beanInfo);
-        if (beanInfo.getBeanClass() != null && beanInfo.getId().equals(beanInfo.getBeanClass().getName())) {
-            cacheByClass.putIfAbsent(beanInfo.getBeanClass(), beanInfo);
-        }
-    }
-
-    /**
-     * Remove a single MetaBean from the cache.
-     * @param beanInfo
-     */
-    public void removeFromCache(MetaBean beanInfo) {
-        cacheById.remove(beanInfo.getId());
-        if (beanInfo.getBeanClass() != null && beanInfo.getId().equals(beanInfo.getBeanClass().getName())) {
-            cacheByClass.remove(beanInfo.getBeanClass());
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/MetaBeanFactory.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/MetaBeanFactory.java b/bval-core/src/main/java/org/apache/bval/MetaBeanFactory.java
deleted file mode 100644
index e5a06d7..0000000
--- a/bval-core/src/main/java/org/apache/bval/MetaBeanFactory.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;
-
-import org.apache.bval.model.MetaBean;
-
-/**
- * Description: interface for abstraction how to initialize a MetaBean
- * with information from somewhere<br/>
- */
-public interface MetaBeanFactory {
-    /**
-     * Initialize the specified {@link MetaBean}.
-     * @param metaBean
-     * @throws Exception
-     */
-    void buildMetaBean(MetaBean metaBean) throws Exception;
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java b/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java
deleted file mode 100644
index 3d0846b..0000000
--- a/bval-core/src/main/java/org/apache/bval/MetaBeanFinder.java
+++ /dev/null
@@ -1,40 +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;
-
-import org.apache.bval.model.MetaBean;
-
-/**
- * Description: Interface to find BeanInfos <br/>
- */
-public interface MetaBeanFinder {
-    /**
-     * Find a MetaBean with a certain id.
-     * @param beanInfoId - symbolic unique name of Meta Info
-     * @return BeanInfo
-     * @throws IllegalArgumentException - when MetaBean not found
-     */
-    MetaBean findForId(String beanInfoId);
-
-    /**
-     * Find the MetaBean for the specified class.
-     * @param clazz - bean class
-     * @return BeanInfo (never null)
-     */
-    MetaBean findForClass(Class<?> clazz);
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java b/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
deleted file mode 100644
index 37eed6d..0000000
--- a/bval-core/src/main/java/org/apache/bval/MetaBeanManager.java
+++ /dev/null
@@ -1,154 +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;
-
-import org.apache.bval.model.MetaBean;
-import org.apache.bval.model.MetaProperty;
-
-import static org.apache.bval.model.Features.Property.REF_BEAN_ID;
-import static org.apache.bval.model.Features.Property.REF_BEAN_TYPE;
-import static org.apache.bval.model.Features.Property.REF_CASCADE;
-
-/**
- * Description: Default implementation for the interface to find, register and
- * create MetaBeans. In most situations a single instance of this class is
- * sufficient and you can get this instance from the
- * {@link MetaBeanManagerFactory}. <br/>
- */
-public class MetaBeanManager implements MetaBeanFinder {
-
-    /** MetaBean cache */
-    protected final MetaBeanCache cache = new MetaBeanCache();
-    /** MetaBean builder */
-    protected final MetaBeanBuilder builder;
-    /** Complete flag */
-    protected boolean complete = false;
-
-    /**
-     * Create a new MetaBeanManager instance.
-     */
-    public MetaBeanManager() {
-        builder = new MetaBeanBuilder();
-    }
-
-    /**
-     * Create a new MetaBeanManager instance.
-     * 
-     * @param builder meta bean builder
-     */
-    public MetaBeanManager(MetaBeanBuilder builder) {
-        this.builder = builder;
-    }
-
-    /**
-     * Get the builder used.
-     * 
-     * @return {@link MetaBeanBuilder}
-     */
-    public MetaBeanBuilder getBuilder() {
-        return builder;
-    }
-
-    /**
-     * Get the cache used.
-     * 
-     * @return {@link MetaBeanCache}
-     */
-    public MetaBeanCache getCache() {
-        return cache;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public MetaBean findForId(final String beanInfoId) {
-        MetaBean beanInfo = cache.findForId(beanInfoId);
-        if (beanInfo != null) {
-            return beanInfo;
-        }
-
-        try {
-            beanInfo = builder.buildForId(beanInfoId);
-            cache.cache(beanInfo);
-            computeRelationships(beanInfo);
-            return beanInfo;
-        } catch (final RuntimeException e) {
-            throw e; // do not wrap runtime exceptions
-        } catch (final Exception e) {
-            throw new IllegalArgumentException("error creating beanInfo with id: " + beanInfoId, e);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public MetaBean findForClass(final Class<?> clazz) {
-        if (clazz == null) {
-            return null;
-        }
-
-        MetaBean beanInfo = cache.findForClass(clazz);
-        if (beanInfo != null) {
-            return beanInfo;
-        }
-
-        try {
-            beanInfo = builder.buildForClass(clazz);
-            cache.cache(beanInfo);
-            computeRelationships(beanInfo);
-            return beanInfo;
-        } catch (final RuntimeException e) {
-            throw e; // do not wrap runtime exceptions
-        } catch (final Exception e) {
-            throw new IllegalArgumentException("error creating beanInfo for " + clazz, e);
-        }
-    }
-
-    /**
-     * Compute all known relationships for <code>beanInfo</code>. must be called
-     * AFTER cache.cache() to avoid endless loop
-     * 
-     * @param beanInfo
-     *            - the bean for which to compute relationships
-     */
-    protected void computeRelationships(MetaBean beanInfo) {
-        for (final MetaProperty prop : beanInfo.getProperties()) {
-            final String beanRef = prop.getFeature(REF_BEAN_ID);
-            computeRelatedMetaBean(prop, beanRef);
-        }
-    }
-
-    /**
-     * Compute a single related {@link MetaBean}.
-     * 
-     * @param prop meta property
-     * @param beanRef bean reference
-     */
-    protected void computeRelatedMetaBean(MetaProperty prop, String beanRef) {
-        Class<?> beanType = prop.getFeature(REF_BEAN_TYPE);
-        if (beanType == null) {
-            if (prop.getFeature(REF_CASCADE) != null) { // dynamic type resolution:
-                prop.setMetaBean(new DynamicMetaBean(this));
-            }
-        } else {
-            prop.setMetaBean(findForClass(beanType));
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/MetaBeanManagerFactory.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/MetaBeanManagerFactory.java b/bval-core/src/main/java/org/apache/bval/MetaBeanManagerFactory.java
deleted file mode 100644
index 85d49b8..0000000
--- a/bval-core/src/main/java/org/apache/bval/MetaBeanManagerFactory.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;
-
-/**
- * Description: API class to hold a singleton of a {@link MetaBeanManager}
- * that implements the finder and registry interfaces for MetaBeans<br/>
- *
- * @see org.apache.bval.model.MetaBean
- * @see MetaBeanManager
- */
-public class MetaBeanManagerFactory {
-    private static MetaBeanManager manager = new MetaBeanManager();
-
-    /**
-     * global meta bean finder.
-     * @return the singleton
-     */
-    public static MetaBeanFinder getFinder() {
-        return manager;
-    }
-
-    /**
-     * set global meta bean manager, that is responsible
-     * for finding, caching, xml registry and enrichment algorithm.
-     * @param finder
-     */
-    public static void setManager(MetaBeanManager finder) {
-        manager = finder;
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/Validate.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/Validate.java b/bval-core/src/main/java/org/apache/bval/Validate.java
deleted file mode 100644
index ad895a4..0000000
--- a/bval-core/src/main/java/org/apache/bval/Validate.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;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-/**
- * Description: Annotate an element (parameter) to be validated.
- * <br>
- */
-@Target({ METHOD, FIELD, CONSTRUCTOR, PARAMETER })
-@Retention(RUNTIME)
-public @interface Validate {
-    /**
-     * (optional) the MetaBean.id to use
-     */
-    String value() default "";
-
-    /**
-     * to Support groups on @Valid(ate) in method/return validation
-     */
-    Class<?>[] groups() default {};
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/ValidationResults.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/ValidationResults.java b/bval-core/src/main/java/org/apache/bval/ValidationResults.java
deleted file mode 100644
index 2ad46f6..0000000
--- a/bval-core/src/main/java/org/apache/bval/ValidationResults.java
+++ /dev/null
@@ -1,236 +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;
-
-import org.apache.bval.model.ValidationContext;
-import org.apache.bval.model.ValidationListener;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Description: Implements a contains to hold and transport validation results<br/>
- */
-public class ValidationResults implements ValidationListener, Serializable {
-    private static final long serialVersionUID = 1L;
-
-    private Map<String, List<Error>> errorsByReason;
-    private Map<Object, Map<String, List<Error>>> errorsByOwner;
-
-    /**
-     * API to add an error to the validation results.
-     *
-     * @param reason       - Features from {@link org.apache.bval.model.Features.Property}
-     *                       or custom reason of validation error
-     * @param context        - context information (bean, propertyName, value, ...)
-     */
-    @Override
-    public <T extends ValidationListener> void addError(String reason, ValidationContext<T> context) {
-        Error error = createError(reason, context.getBean(), context.getPropertyName());
-        addError(error, context);
-    }
-
-    /**
-     * API to add an error to the validation results.
-     *
-     * @param error       - holding the description of reason and object to describe
-     *                     the validation error
-     * @param context     - null or the context to provide additional information
-     */
-    @Override
-    public <T extends ValidationListener> void addError(Error error, ValidationContext<T> context) {
-        if (errorsByReason == null) {
-            initialize();
-        }
-        addToReasonBucket(error);
-        addToOwnerBucket(error);
-    }
-
-    /**
-     * Old API to add an error to the validation results when no context is available.
-     *
-     * @param reason       - Features from {@link org.apache.bval.model.Features.Property} or custom validation reason
-     * @param bean         - (optional) owner bean or null
-     * @param propertyName - (optional) propertyName where valiation error occurred or null
-     */
-    public void addError(String reason, Object bean, String propertyName) {
-        addError(createError(reason, bean, propertyName), null);
-    }
-
-    /**
-     * Create an Error object.
-     * @param reason
-     * @param owner
-     * @param propertyName
-     * @return new {@link Error}
-     */
-    protected Error createError(String reason, Object owner, String propertyName) {
-        return new Error(reason, owner, propertyName);
-    }
-
-    /**
-     * initialize the error-buckets now when needed and
-     * not on instance creation to save memory garbage.
-     */
-    protected void initialize() {
-        errorsByReason = new LinkedHashMap<String, List<Error>>();
-        errorsByOwner = new LinkedHashMap<Object, Map<String, List<Error>>>();
-    }
-
-    /**
-     * Add an Error to the set of Errors shared by a particular "reason."
-     * @param error
-     * @see {@link Error#getReason()}
-     */
-    protected void addToReasonBucket(Error error) {
-        if (error.getReason() == null) {
-            return;
-        }
-
-        List<Error> errors = errorsByReason.get(error.getReason());
-        if (errors == null) {
-            errors = new ArrayList<Error>();
-            errorsByReason.put(error.getReason(), errors);
-        }
-        errors.add(error);
-    }
-
-    /**
-     * Add an Error to the property-keyed map of Errors maintained for this Error's owner.
-     * @param error
-     * @see {@link Error#getOwner()}
-     */
-    protected void addToOwnerBucket(Error error) {
-        if (error.getOwner() == null) {
-            return;
-        }
-
-        Map<String, List<Error>> errors = errorsByOwner.get(error.getOwner());
-        if (errors == null) {
-            errors = new HashMap<String, List<Error>>();
-            errorsByOwner.put(error.getOwner(), errors);
-        }
-        List<Error> list = errors.get(error.getPropertyName());
-        if (list == null) {
-            list = new ArrayList<Error>();
-            errors.put(error.getPropertyName(), list);
-        }
-        list.add(error);
-    }
-
-    /**
-     * Get the map of Errors by reason; 
-     * key = reason, value = list of errors for this reason
-     * @return map
-     */
-    public Map<String, List<Error>> getErrorsByReason() {
-        if (errorsByReason == null) {
-            return Collections.emptyMap();
-        }
-        return errorsByReason;
-    }
-
-    /**
-     * Get the map of Errors by owner;
-     * key = owner, value = map with:<br>
-     * &nbsp;&nbsp; key = propertyName, value = list of errors for this owner.propertyName
-     * @return map
-     */
-    public Map<Object, Map<String, List<Error>>> getErrorsByOwner() {
-        if (errorsByOwner == null) {
-            return Collections.emptyMap();
-        }
-        return errorsByOwner;
-    }
-
-    /**
-     * Learn whether these results are empty/error-free.
-     * @return true when there are NO errors in this validation result
-     */
-    public boolean isEmpty() {
-        if (errorsByReason == null || (errorsByReason.isEmpty() && errorsByOwner.isEmpty())) {
-            return true;
-        }
-        for (List<Error> list : errorsByReason.values()) {
-            if (!list.isEmpty()) {
-                return false;
-            }
-        }
-        for (Map<String, List<Error>> map : errorsByOwner.values()) {
-            for (List<Error> list : map.values()) {
-                if (!list.isEmpty()) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Learn whether there is an Error keyed to a specified reason description.
-     * @param reason
-     * @return boolean
-     * @see {@link Error#getReason()}
-     */
-    public boolean hasErrorForReason(String reason) {
-        if (errorsByReason == null) {
-            return false;
-        }
-        List<Error> errors = errorsByReason.get(reason);
-        return errors != null && !errors.isEmpty();
-    }
-
-    /**
-     * Learn whether <code>bean</code> has any errors keyed to property <code>propertyName</code>.
-     * @param bean
-     * @param propertyName - may be null: any property is checked
-     *                     OR the name of the property to check
-     * @return boolean
-     */
-    public boolean hasError(Object bean, String propertyName) {
-        if (errorsByOwner == null) {
-            return false;
-        }
-        Map<String, List<Error>> errors = errorsByOwner.get(bean);
-        if (errors == null) {
-            return false;
-        }
-        if (propertyName == null) {
-            for (List<Error> list : errors.values()) {
-                if (!list.isEmpty()) {
-                    return true;
-                }
-            }
-            return false;
-        }
-        List<Error> list = errors.get(propertyName);
-        return list != null && !list.isEmpty();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return "ValidationResults{" + errorsByOwner + "}";
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/DynaType.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/DynaType.java b/bval-core/src/main/java/org/apache/bval/model/DynaType.java
deleted file mode 100644
index 7a89862..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/DynaType.java
+++ /dev/null
@@ -1,31 +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.model;
-
-import java.lang.reflect.Type;
-
-/**
- * Description: implementation of a dynamic type. can be used inside a
- * MetaProperty for instance-based types <br/>
- */
-public interface DynaType extends Type {
-    /**
-     * Resolve the type indirection.
-     * @return Type
-     */
-    Type getRawType();
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java b/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java
deleted file mode 100644
index 247678d..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/DynaTypeEnum.java
+++ /dev/null
@@ -1,121 +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.model;
-
-/**
- * Description: ("artificial" enum with custom values).<br/>
- */
-public class DynaTypeEnum implements DynaType {
-    private final Class<?> enumClass;
-    private Value[] enumConstants;
-
-    /**
-     * Create a new DynaTypeEnum instance.
-     * @param enumClass
-     */
-    public DynaTypeEnum(Class<?> enumClass) {
-        this.enumClass = enumClass;
-    }
-
-    /**
-     * Create a new DynaTypeEnum instance.
-     * @param enumClass
-     * @param names
-     */
-    public DynaTypeEnum(Class<?> enumClass, String... names) {
-        this(enumClass);
-        setEnumNames(names);
-    }
-
-    /**
-     * Set the enumeration value names.
-     * @param names
-     */
-    public void setEnumNames(String[] names) {
-        enumConstants = new Value[names.length];
-        int i = 0;
-        for (String each : names) {
-            enumConstants[i++] = new Value(each);
-        }
-    }
-
-    /**
-     * Get the name of the enum class.
-     * @return String
-     */
-    public String getName() {
-        return enumClass.getName();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Class<?> getRawType() {
-        return enumClass;
-    }
-
-    /**
-     * Learn whether the referred class is, in fact, an enum class.
-     * used by freemarker-template "bean-infos-json.ftl"
-     */
-    public boolean isEnum() {
-        return enumClass.isEnum();
-    }
-
-    /**
-     * Get the emulated constants.
-     * used by freemarker-template "bean-infos-json.ftl"
-     * @return Value[]
-     */
-    public Value[] getEnumConstants() {
-        return enumConstants != null ? enumConstants.clone() : null;
-    }
-
-    /**
-     * Learn whether the wrapped class is assignable from <code>cls</code>.
-     * @param cls
-     * @return boolean
-     */
-    public boolean isAssignableFrom(Class<?> cls) {
-        return enumClass.isAssignableFrom(cls);
-    }
-
-    /**
-     * Represents a single "enum" instance (= the value).
-     */
-    public static final class Value {
-        final String name;
-
-        /**
-         * Create a new Value instance.
-         * @param name
-         */
-        Value(String name) {
-            this.name = name;
-        }
-
-        /**
-         * used by freemarker-template "bean-infos-json.ftl"
-         * @return the name of this constant
-         */
-        public String name() {
-            return name;
-        }
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-core/src/main/java/org/apache/bval/model/Features.java
----------------------------------------------------------------------
diff --git a/bval-core/src/main/java/org/apache/bval/model/Features.java b/bval-core/src/main/java/org/apache/bval/model/Features.java
deleted file mode 100644
index 5c97c8e..0000000
--- a/bval-core/src/main/java/org/apache/bval/model/Features.java
+++ /dev/null
@@ -1,117 +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.model;
-
-/**
- * Description: Contains key of common feature keys used by standard validators etc.
- * This DOES NOT MEAN that the list of property- or bean-features is closed. You can
- * put anything into the metabean as a feature and use it in your custom validators
- * and other classes that access your metabeans.<br/>
- *
- * @see FeaturesCapable
- */
-public interface Features {
-    /** Features of {@link MetaBean} */
-    public interface Bean {
-        /** INFO: String, name of the Property, that is the Primary Key */
-        String MAIN_KEY = "mainKey";
-        /** INFO: category/domain to which the metaBean belongs to */
-        String DOMAIN = "domain";
-
-        //        String DISPLAY_NAME = "displayName";
-        String UNIQUE_KEY = "uniqueKey";
-
-        String EXECUTABLES = "executables";
-        String PROPERTIES = "properties";
-    }
-
-    /** Features of {@link MetaProperty} */
-    public interface Property {
-        /** INFO: possible Enum values */
-        String ENUM = "enum";
-        /** INFO: Boolean, TRUE if Property is a Unique Key */
-        String UNIQUE_KEY = "uniqueKey";
-        /** VALIDATION: Boolean, mandatory field? */
-        String MANDATORY = "mandatory";
-        /** VALIDATION: Integer, max. number of chars/digits / max. cardinality of a to-many relationship */
-        String MAX_LENGTH = "maxLen";
-        /** VALIDATION: Comparable (e.g. a subclass of Number), max value */
-        String MAX_VALUE = "maxValue";
-        /** VALIDATION: Integer, min. number of chars/digits / min. cardinality of a to-many relationship */
-        String MIN_LENGTH = "minLen";
-        /** VALIDATION: Comparable (e.g. a subclass of Number), min value */
-        String MIN_VALUE = "minValue";
-        /** INFO: String-representation of a default value */
-        String DEFAULT_VALUE = "defValue";
-        /** SECURITY, INFO: Boolean, is value or relationship unmodifiable */
-        String READONLY = "readonly";
-        /**
-         * SECURITY, INFO: Boolean, Field accessible?
-         * If false, the field must not be displayed, queried, changed.
-         */
-        String DENIED = "denied";
-        /** VALIDATION: String, regular expression to validate the format of input data */
-        String REG_EXP = "regExp";
-        /**
-         * VALIDATION: String, Constraint for time-information of a Date-field:
-         * {@link org.apache.bval.xml.XMLMetaValue#TIMELAG_Past}
-         * or
-         * {@link org.apache.bval.xml.XMLMetaValue#TIMELAG_Future}
-         */
-        String TIME_LAG = "timeLag";
-
-        /**
-         * INFO: Boolean, Field visible?
-         *
-         * @see java.beans.PropertyDescriptor#isHidden()
-         */
-        String HIDDEN = "hidden";
-        /**
-         * INFO: Boolean
-         *
-         * @see java.beans.PropertyDescriptor#isPreferred()
-         */
-        String PREFERRED = "preferred";
-
-        /** INFO: relationship's target metaBean.id * */
-        String REF_BEAN_ID = "refBeanId";
-
-        /**
-         * INFO: Class<br>
-         * Relationship's target metaBean.beanClass.
-         * In case of to-many relationships, this feature
-         * hold the Bean-type not the Collection-type.
-         */
-        String REF_BEAN_TYPE = "refBeanType";
-
-        /**
-         * INFO: AccessStrategy[]<br>
-         * an array of accessStrategies
-         * how validation should cascade into relationship target beans<br>
-         * null when validation should NOT cascade into relationship target
-         * beans<br>
-         * <p/>
-         * Default: {PropertyAccess(metaProperty.name)},
-         * when MetaProperty.metaBean is != null
-         */
-        String REF_CASCADE = "refCascade";
-
-        /** INFO: an array with the string names of custom java script validation functions */
-        @Deprecated // TODO RSt - I suggest to remove this and all related code
-        String JAVASCRIPT_VALIDATION_FUNCTIONS = "jsFunctions";
-    }
-}