bval-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: svn commit: r1498347 [1/7] - in /bval/branches/bval-11: ./ bval-core/src/main/java/org/apache/bval/ bval-core/src/main/java/org/apache/bval/model/ bval-core/src/main/java/org/apache/bval/util/ bval-extras/ bval-guice/ bval-guice/src/main/java/org/apach...
Date Tue, 16 Jul 2013 06:02:00 GMT
Ok, i removed MarkableInputStream which is useless because of IOs now. IOs
is used in ConfigurationImpl and ValidationParser so i think we can keep
this utility class.

About ValidationParser static methods are either utility methods or
"factory" methods. All other methods are instance methods since the
ValidationParser has ATM a state which means it can't be static right now
(could probably be enhanced).

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/7/15 Matt Benson <gudnabrsam@gmail.com>

> This was of course a huge commit.  Now, I might have preferred these
> changes be broken up so that everyone would have an easier time seeing what
> all you've done, but there is overwhelmingly more to like here than to
> dislike.  I do have some notes:
>
> - I prefer ValidationParser's methods to be instance methods.  The
> ValidationParser *itself* can be managed in a static fashion, but I don't
> see any reason to introduce statics where they're not particularly useful.
> - The Ios class currently contains one method which might just as well be
> relocated to the MarkableInputStream class itself IMO.
>
> Matt
>
>
> On Mon, Jul 1, 2013 at 5:06 AM, <rmannibucau@apache.org> wrote:
>
> > Author: rmannibucau
> > Date: Mon Jul  1 10:06:18 2013
> > New Revision: 1498347
> >
> > URL: http://svn.apache.org/r1498347
> > Log:
> > commiting some hacks on bean validation 1.1
> >
> > Added:
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/Meta.java
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaConstructor.java
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaMethod.java
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaParameter.java
> >     bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/AnyLiteral.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValAnnotatedType.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValBinding.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValExtension.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValInterceptor.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValInterceptorBean.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/DefaultLiteral.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/ValidatorBean.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/ValidatorFactoryBean.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForCharSequence.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/AppendValidationToList.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/BootstrapConfigurationImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstructorDescriptorImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/CrossParameterDescriptorImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/InvocableElementDescriptor.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/MethodDescriptor.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/MethodDescriptorImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/NodeBuilderCustomizableContextImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/NodeContextBuilderImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ParameterAccess.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ParameterDescriptorImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ParametersAccess.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ProcedureDescriptor.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ReturnAccess.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ReturnValueDescriptorImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/groups/GroupConversionDescriptorImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/parameter/
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/parameter/DefaultParameterNameProvider.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/IOs.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/LeafNodeBuilderCustomizableContextImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/LeafNodeBuilderDefinedContextImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/MarkableInputStream.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/Proxies.java
> >
> bval/branches/bval-11/bval-jsr303/src/main/resources/META-INF/beans.xml
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/xsd/validation-configuration-1.1.xsd
> >
> > bval/branches/bval-11/bval-jsr303/src/main/xsd/validation-mapping-1.1.xsd
> >     bval/branches/bval-11/bval-tck/work-tests-suite.xml
> >     bval/branches/bval-11/bval-tck11/
> >     bval/branches/bval-11/bval-tck11/pom.xml
> >     bval/branches/bval-11/bval-tck11/src/
> >     bval/branches/bval-11/bval-tck11/src/main/
> >     bval/branches/bval-11/bval-tck11/src/main/java/
> >     bval/branches/bval-11/bval-tck11/src/main/java/org/
> >     bval/branches/bval-11/bval-tck11/src/main/java/org/apache/
> >     bval/branches/bval-11/bval-tck11/src/main/java/org/apache/bval/
> >
> >
> bval/branches/bval-11/bval-tck11/src/main/java/org/apache/bval/arquillian/
> >
> >
> bval/branches/bval-11/bval-tck11/src/main/java/org/apache/bval/arquillian/BValArquillianExtension.java
> >
> >
> bval/branches/bval-11/bval-tck11/src/main/java/org/apache/bval/arquillian/EJBEnricher.java
> >
> >
> bval/branches/bval-11/bval-tck11/src/main/java/org/apache/bval/arquillian/jndi/
> >
> >
> bval/branches/bval-11/bval-tck11/src/main/java/org/apache/bval/arquillian/jndi/BValJndiFactory.java
> >     bval/branches/bval-11/bval-tck11/src/main/resources/
> >     bval/branches/bval-11/bval-tck11/src/main/resources/META-INF/
> >
> bval/branches/bval-11/bval-tck11/src/main/resources/META-INF/services/
> >
> >
> bval/branches/bval-11/bval-tck11/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
> >     bval/branches/bval-11/bval-tck11/src/main/resources/jndi.properties
> >     bval/branches/bval-11/bval-tck11/src/test/
> >     bval/branches/bval-11/bval-tck11/src/test/java/
> >     bval/branches/bval-11/bval-tck11/src/test/java/org/
> >     bval/branches/bval-11/bval-tck11/src/test/java/org/apache/
> >     bval/branches/bval-11/bval-tck11/src/test/java/org/apache/webbeans/
> >
> >
> bval/branches/bval-11/bval-tck11/src/test/java/org/apache/webbeans/intercept/
> >
> >
> bval/branches/bval-11/bval-tck11/src/test/java/org/apache/webbeans/intercept/InterceptorsManager.java
> >     bval/branches/bval-11/bval-tck11/src/test/resources/
> >     bval/branches/bval-11/bval-tck11/src/test/resources/arquillian.xml
> >     bval/branches/bval-11/bval-tck11/work-tests-suite.xml
> > Removed:
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForString.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/
> > Modified:
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/ValidationResults.java
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java
> >
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java
> >     bval/branches/bval-11/bval-extras/pom.xml
> >     bval/branches/bval-11/bval-guice/pom.xml
> >
> >
> bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/ConfigurationStateProvider.java
> >
> >
> bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/GuiceAwareConstraintValidatorFactory.java
> >
> >
> bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java
> >     bval/branches/bval-11/bval-jsr303/pom.xml
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/AnnotationConstraintBuilder.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/AnnotationProcessor.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheFactoryContext.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorConfiguration.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ApacheValidatorFactory.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/BeanDescriptorImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ClassValidator.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConfigurationImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintAnnotationAttributes.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintDescriptorImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintFinderImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidation.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidationListener.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintValidatorContextImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ConstraintViolationImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultConstraintValidatorFactory.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/DefaultMessageInterpolator.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/ElementDescriptorImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/GroupValidationContext.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/GroupValidationContextImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303Features.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/Jsr303MetaBeanFactory.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/PropertyDescriptorImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/groups/Group.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/groups/GroupsComputer.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ClassHelper.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ConstraintDefinitionValidator.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NodeBuilderCustomizableContextImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NodeBuilderDefinedContextImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NodeContextBuilderImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/NodeImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/PathImpl.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/SecureActions.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationIgnores.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxy.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/MetaConstraint.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationMappingParser.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/ValidationParser.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/main/resources/org/apache/bval/jsr303/DefaultConstraints.properties
> >
> > bval/branches/bval-11/bval-jsr303/src/main/xjb/binding-customization.xjb
> >
> >
> bval/branches/bval-11/bval-jsr303/src/test/java/org/apache/bval/jsr303/BootstrapTest.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/test/java/org/apache/bval/jsr303/ConstraintValidatorContextTest.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/test/java/org/apache/bval/jsr303/ContextConstraintValidatorFactoryTest.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/test/java/org/apache/bval/jsr303/CustomConstraintValidatorFactoryTest.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/test/java/org/apache/bval/jsr303/CustomValidatorFactoryTest.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/test/java/org/apache/bval/jsr303/DefaultMessageInterpolatorTest.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/test/java/org/apache/bval/jsr303/Jsr303Test.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/test/java/org/apache/bval/jsr303/ValidationTest.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/MethodValidatorImplTest.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/test/java/org/apache/bval/jsr303/util/PathImplTest.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/test/java/org/apache/bval/jsr303/xml/ValidationParserTest.java
> >
> >
> bval/branches/bval-11/bval-jsr303/src/test/resources/sample-constraints.xml
> >     bval/branches/bval-11/bval-tck/pom.xml
> >     bval/branches/bval-11/pom.xml
> >
> > Modified:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
> > (original)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/BeanValidationContext.java
> > Mon Jul  1 10:06:18 2013
> > @@ -300,6 +300,10 @@ public class BeanValidationContext<T ext
> >          setBean(getPropertyValue(access), prop.getMetaBean());
> >      }
> >
> > +    public void moveDown(String prop) {
> > +        // no-op: not supported
> > +    }
> > +
> >      /**
> >       * {@inheritDoc}
> >       */
> >
> > Added:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/ConstructorAccess.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,90 @@
> > +/*
> > + *  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.util.AccessStrategy;
> > +
> > +import java.lang.annotation.ElementType;
> > +import java.lang.reflect.Constructor;
> > +import java.lang.reflect.Field;
> > +import java.lang.reflect.Type;
> > +import java.security.AccessController;
> > +import java.security.PrivilegedAction;
> > +
> > +public class ConstructorAccess extends AccessStrategy {
> > +
> > +    private final Constructor<?> constructor;
> > +
> > +    public ConstructorAccess(final Constructor<?> constructor) {
> > +        this.constructor = constructor;
> > +        if (!constructor.isAccessible()) {
> > +            run(new PrivilegedAction<Void>() {
> > +                public Void run() {
> > +                    constructor.setAccessible(true);
> > +                    return null;
> > +                }
> > +            });
> > +        }
> > +    }
> > +
> > +    @Override
> > +    public Object get(final Object instance) {
> > +        throw new UnsupportedOperationException();
> > +    }
> > +
> > +    public ElementType getElementType() {
> > +        return ElementType.CONSTRUCTOR;
> > +    }
> > +
> > +    public Type getJavaType() {
> > +        return constructor.getDeclaringClass();
> > +    }
> > +
> > +    /**
> > +     * {@inheritDoc}
> > +     */
> > +    public String getPropertyName() {
> > +        return constructor.getDeclaringClass().getSimpleName();
> > +    }
> > +
> > +    /**
> > +     * {@inheritDoc}
> > +     */
> > +    public String toString() {
> > +        return constructor.toString();
> > +    }
> > +
> > +    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);
> > +    }
> > +
> > +    public int hashCode() {
> > +        return constructor.hashCode();
> > +    }
> > +
> > +    private static <T> T run(PrivilegedAction<T> action) {
> > +        if (System.getSecurityManager() != null) {
> > +            return AccessController.doPrivileged(action);
> > +        } else {
> > +            return action.run();
> > +        }
> > +    }
> > +}
> >
> > Modified:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/ValidationResults.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/ValidationResults.java?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/ValidationResults.java
> > (original)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/ValidationResults.java
> > Mon Jul  1 10:06:18 2013
> > @@ -21,7 +21,12 @@ import org.apache.bval.model.ValidationC
> >  import org.apache.bval.model.ValidationListener;
> >
> >  import java.io.Serializable;
> > -import java.util.*;
> > +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/>
> >
> > Added:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/Meta.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/Meta.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/Meta.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/Meta.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,27 @@
> > +/*
> > + * 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 Meta extends FeaturesCapable {
> > +    protected MetaBean parentMetaBean;
> > +
> > +    public MetaBean getParentMetaBean() {
> > +        return parentMetaBean;
> > +    }
> > +}
> >
> > Modified:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaBean.java?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
> > (original)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaBean.java
> > Mon Jul  1 10:06:18 2013
> > @@ -16,6 +16,11 @@
> >   */
> >  package org.apache.bval.model;
> >
> > +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.Map;
> >  import java.util.TreeMap;
> >
> > @@ -31,7 +36,56 @@ public class MetaBean extends FeaturesCa
> >      private String id;
> >      private String name;
> >      private Class<?> beanClass;
> > -    private Map<String, MetaProperty> properties = new TreeMap<String,
> > MetaProperty>();
> > +
> > +    // TODO: optimize sortings
> > +
> > +    private Map<String, MetaProperty> properties = new TreeMap<String,
> > MetaProperty>(new Comparator<String>() { // order of fields to ensure
> > correct failling order
> > +        public int compare(final String o1, final String o2) {
> > +            return fieldIndex(o1) - fieldIndex(o2);
> > +        }
> > +
> > +        private int fieldIndex(final String o2) {
> > +            final Class<?> clazz = getBeanClass();
> > +
> > +            int i = 0;
> > +            Class<?> beanClass1 = clazz;
> > +            while (beanClass1 != null && beanClass1 != Object.class) {
> > +                for (final Field f : beanClass1.getDeclaredFields()) {
> > +                    i++;
> > +                    if (f.getName().equals(o2)) {
> > +                        return i;
> > +                    }
> > +                }
> > +                beanClass1 = beanClass1.getSuperclass();
> > +            }
> > +
> > +            if (clazz != null) {
> > +                final String getter = "get" +
> > Character.toUpperCase(o2.charAt(0)) + o2.substring(1);
> > +                for (final Method m : clazz.getMethods()) {
> > +                    i++;
> > +                    if (m.getName().equals(getter) &&
> > m.getParameterTypes().length == 0) {
> > +                        return i;
> > +                    }
> > +                }
> > +            }
> > +
> > +            return Integer.MIN_VALUE; // to avoid collision and false
> > positive in get() due to equals
> > +        }
> > +    });
> > +    private Map<Method, MetaMethod> methods = new TreeMap<Method,
> > MetaMethod>(new Comparator<Method>() {
> > +        public int compare(final Method o1, final Method o2) {
> > +            final int i = o1.getName().compareTo(o2.getName());
> > +            if (i != 0) {
> > +                return i;
> > +            }
> > +            return Arrays.hashCode(o1.getParameterTypes()) -
> > Arrays.hashCode(o2.getParameterTypes());
> > +        }
> > +    });
> > +    private Map<Constructor<?>, MetaConstructor> constructors = new
> > TreeMap<Constructor<?>, MetaConstructor>(new
> Comparator<Constructor<?>>() {
> > +        public int compare(final Constructor<?> o1, final Constructor<?>
> > o2) {
> > +            return Arrays.hashCode(o1.getParameterTypes()) -
> > Arrays.hashCode(o2.getParameterTypes());
> > +        }
> > +    });
> >
> >      /**
> >       * Get the id.
> > @@ -99,6 +153,22 @@ public class MetaBean extends FeaturesCa
> >          return properties.values().toArray(new
> > MetaProperty[this.properties.size()]);
> >      }
> >
> > +    public MetaMethod[] getMethods() {
> > +        return methods.values().toArray(new
> > MetaMethod[this.methods.size()]);
> > +    }
> > +
> > +    public void addMethod(final Method method, final MetaMethod meta) {
> > +        methods.put(method, meta);
> > +    }
> > +
> > +    public MetaConstructor[] getConstructors() {
> > +        return constructors.values().toArray(new
> > MetaConstructor[this.constructors.size()]);
> > +    }
> > +
> > +    public void addConstructor(final Constructor<?> constructor, final
> > MetaConstructor meta) {
> > +        constructors.put(constructor, meta);
> > +    }
> > +
> >      /**
> >       * Set the properties.
> >       *
> > @@ -204,4 +274,11 @@ public class MetaBean extends FeaturesCa
> >          return bean == null || bean == beanClass ||
> > beanClass.isInstance(bean) ? this : null;
> >      }
> >
> > +    public MetaMethod getMethod(final Method method) {
> > +        return methods.get(method);
> > +    }
> > +
> > +    public MetaConstructor getConstructor(final Constructor<?>
> > constructor) {
> > +        return constructors.get(constructor);
> > +    }
> >  }
> >
> > Added:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaConstructor.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaConstructor.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaConstructor.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaConstructor.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,32 @@
> > +/*
> > + *  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 final Constructor<?> constructor;
> > +
> > +    public MetaConstructor(final MetaBean metabean, final Constructor<?>
> > constructor) {
> > +        this.parentMetaBean = metabean;
> > +        this.constructor = constructor;
> > +    }
> > +
> > +    public Constructor<?> getConstructor() {
> > +        return constructor;
> > +    }
> > +}
> >
> > Added:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaInvocable.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,51 @@
> > +/*
> > + *  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.ArrayList;
> > +import java.util.Collection;
> > +import java.util.HashMap;
> > +import java.util.Map;
> > +
> > +public abstract class MetaInvocable extends Meta {
> > +    private Map<Integer, MetaParameter> parameters = new
> HashMap<Integer,
> > MetaParameter>();
> > +    private Annotation[] annotations = new Annotation[0];
> > +
> > +    public Collection<MetaParameter> getParameters() {
> > +        return new ArrayList<MetaParameter>(parameters.values());
> > +    }
> > +
> > +    public void addParameter(final int idx, final MetaParameter param) {
> > +        parameters.put(idx, param);
> > +    }
> > +
> > +    public Annotation[] getAnnotations() {
> > +        return annotations;
> > +    }
> > +
> > +    public void addAnnotation(final Annotation annotation) {
> > +        final Annotation[] a = new Annotation[annotations.length + 1];
> > +        System.arraycopy(annotations, 0, a, 0, annotations.length);
> > +        a[a.length - 1] = annotation;
> > +        this.annotations = a;
> > +    }
> > +
> > +    public MetaParameter getParameter(final Integer index) {
> > +        return parameters.get(index);
> > +    }
> > +}
> >
> > Added:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaMethod.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaMethod.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaMethod.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaMethod.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,32 @@
> > +/*
> > + *  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 final Method method;
> > +
> > +    public MetaMethod(final MetaBean parent, final Method method) {
> > +        this.parentMetaBean = parent;
> > +        this.method = method;
> > +    }
> > +
> > +    public Method getMethod() {
> > +        return method;
> > +    }
> > +}
> >
> > Added:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaParameter.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaParameter.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaParameter.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaParameter.java
> > Mon Jul  1 10:06:18 2013
> > @@ -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.model;
> > +
> > +import java.lang.annotation.Annotation;
> > +
> > +public class MetaParameter extends Meta {
> > +    private final MetaInvocable invocable;
> > +    private final Integer index;
> > +    private Annotation[] annotations = new Annotation[0];
> > +
> > +    public MetaParameter(final MetaInvocable metaMethod, final Integer
> > index) {
> > +        this.invocable = metaMethod;
> > +        this.index = index;
> > +    }
> > +
> > +    public MetaInvocable getMethod() {
> > +        return invocable;
> > +    }
> > +
> > +    public Integer getIndex() {
> > +        return index;
> > +    }
> > +
> > +    public Annotation[] getAnnotations() {
> > +        return annotations;
> > +    }
> > +
> > +    public void addAnnotation(final Annotation annotation) {
> > +        final Annotation[] a = new Annotation[annotations.length + 1];
> > +        System.arraycopy(annotations, 0, a, 0, annotations.length);
> > +        a[a.length - 1] = annotation;
> > +        this.annotations = a;
> > +    }
> > +}
> >
> > Modified:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
> > (original)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/MetaProperty.java
> > Mon Jul  1 10:06:18 2013
> > @@ -16,10 +16,10 @@
> >   */
> >  package org.apache.bval.model;
> >
> > -import java.lang.reflect.Type;
> > -
> >  import org.apache.commons.lang3.reflect.TypeUtils;
> >
> > +import java.lang.reflect.Type;
> > +
> >  /**
> >   * Description: the meta description of a property of a bean. It
> supports
> > a map
> >   * of features and multiple validations.<br/>
> > @@ -27,7 +27,7 @@ import org.apache.commons.lang3.reflect.
> >   * @see Validation
> >   * @see MetaBean
> >   */
> > -public class MetaProperty extends FeaturesCapable
> > +public class MetaProperty extends Meta
> >        implements Cloneable, Features.Property {
> >      private static final long serialVersionUID = 1L;
> >
> > @@ -35,7 +35,6 @@ public class MetaProperty extends Featur
> >
> >      private Type type;
> >      private MetaBean metaBean;
> > -    private MetaBean parentMetaBean;
> >
> >      /**
> >       * Create a new MetaProperty instance.
> > @@ -60,14 +59,6 @@ public class MetaProperty extends Featur
> >      }
> >
> >      /**
> > -     * Get the metabean that owns this property (set by
> > MetaBean.putProperty())
> > -     * @return
> > -     */
> > -    public MetaBean getParentMetaBean() {
> > -        return parentMetaBean;
> > -    }
> > -
> > -    /**
> >       * Set the metabean that owns this property (usually called by
> > MetaBean.putProperty())
> >       * @param parentMetaBean
> >       */
> > @@ -171,5 +162,4 @@ public class MetaProperty extends Featur
> >      public String toString() {
> >          return "MetaProperty{" + "name='" + name + '\'' + ", type=" +
> > type + '}';
> >      }
> > -
> >  }
> >
> > Modified:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java
> > (original)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/ValidationContext.java
> > Mon Jul  1 10:06:18 2013
> > @@ -106,6 +106,8 @@ public interface ValidationContext<T ext
> >       */
> >      void moveDown(MetaProperty prop, AccessStrategy access);
> >
> > +    void moveDown(String prop);
> > +
> >      /**
> >       * Step out from a validation of associated objects.
> >       * @param bean
> >
> > Modified:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java
> > (original)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/model/ValidationListener.java
> > Mon Jul  1 10:06:18 2013
> > @@ -17,6 +17,8 @@
> >  package org.apache.bval.model;
> >
> >
> > +import org.apache.bval.model.ValidationContext;
> > +
> >  import java.io.Serializable;
> >
> >
> > @@ -26,8 +28,8 @@ import java.io.Serializable;
> >  public interface ValidationListener {
> >      /**
> >       * Simple API to add an error reason during validation.
> > -     * Error notification added from a {@link Validation} with context
> > information
> > -     * taken from the given {@link ValidationContext}.
> > +     * 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'
> >
> > Modified:
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java
> > (original)
> > +++
> >
> bval/branches/bval-11/bval-core/src/main/java/org/apache/bval/util/ValidationHelper.java
> > Mon Jul  1 10:06:18 2013
> > @@ -102,6 +102,7 @@ public class ValidationHelper {
> >          Object[] array = (Object[]) context.getBean();
> >          MetaBean metaBean = context.getMetaBean();
> >          context.setCurrentIndex(null);
> > +
> >          try {
> >              for (Object each : array) {
> >                  context.setCurrentIndex(index++);
> >
> > Modified: bval/branches/bval-11/bval-extras/pom.xml
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-extras/pom.xml?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > --- bval/branches/bval-11/bval-extras/pom.xml (original)
> > +++ bval/branches/bval-11/bval-extras/pom.xml Mon Jul  1 10:06:18 2013
> > @@ -63,11 +63,18 @@
> >              </activation>
> >              <dependencies>
> >                  <dependency>
> > +                    <groupId>javax.validation</groupId>
> > +                    <artifactId>validation-api</artifactId>
> > +                    <version>1.1.0.Final</version>
> > +                    <scope>provided</scope>
> > +                </dependency>
> > +                <!-- TODO
> > +                <dependency>
> >                      <groupId>org.apache.geronimo.specs</groupId>
> >
>  <artifactId>geronimo-validation_1.0_spec</artifactId>
> > -                    <!-- allow users to choose an API provider -->
> >                      <scope>provided</scope>
> >                  </dependency>
> > +                -->
> >              </dependencies>
> >          </profile>
> >          <!--
> >
> > Modified: bval/branches/bval-11/bval-guice/pom.xml
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-guice/pom.xml?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > --- bval/branches/bval-11/bval-guice/pom.xml (original)
> > +++ bval/branches/bval-11/bval-guice/pom.xml Mon Jul  1 10:06:18 2013
> > @@ -78,11 +78,18 @@
> >              </activation>
> >              <dependencies>
> >                  <dependency>
> > +                    <groupId>javax.validation</groupId>
> > +                    <artifactId>validation-api</artifactId>
> > +                    <version>1.1.0.Final</version>
> > +                    <scope>provided</scope>
> > +                </dependency>
> > +                <!-- TODO
> > +                <dependency>
> >                      <groupId>org.apache.geronimo.specs</groupId>
> >
>  <artifactId>geronimo-validation_1.0_spec</artifactId>
> > -                    <!-- allow users to choose an API provider -->
> >                      <scope>provided</scope>
> >                  </dependency>
> > +                -->
> >              </dependencies>
> >          </profile>
> >          <!--
> >
> > Modified:
> >
> bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/ConfigurationStateProvider.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/ConfigurationStateProvider.java?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/ConfigurationStateProvider.java
> > (original)
> > +++
> >
> bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/ConfigurationStateProvider.java
> > Mon Jul  1 10:06:18 2013
> > @@ -21,12 +21,15 @@ import javax.inject.Provider;
> >  import javax.validation.ConstraintValidatorFactory;
> >  import javax.validation.MessageInterpolator;
> >  import javax.validation.TraversableResolver;
> > +import javax.validation.executable.ExecutableType;
> >  import javax.validation.spi.BootstrapState;
> >  import javax.validation.spi.ConfigurationState;
> >  import javax.validation.spi.ValidationProvider;
> >
> >  import org.apache.bval.jsr303.ConfigurationImpl;
> >
> > +import java.util.Collections;
> > +
> >  /**
> >   * The {@code javax.validation.spi.ConfigurationState} provider
> > implementation.
> >   *
> > @@ -77,6 +80,7 @@ public final class ConfigurationStatePro
> >          configuration.traversableResolver(this.traversableResolver);
> >          configuration.messageInterpolator(this.messageInterpolator);
> >
> >
>  configuration.constraintValidatorFactory(this.constraintValidatorFactory);
> > +
> >
>  configuration.setExecutableValidation(Collections.<ExecutableType>singleton(ExecutableType.ALL));
> >          return configuration;
> >      }
> >
> >
> > Modified:
> >
> bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/GuiceAwareConstraintValidatorFactory.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/GuiceAwareConstraintValidatorFactory.java?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/GuiceAwareConstraintValidatorFactory.java
> > (original)
> > +++
> >
> bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/GuiceAwareConstraintValidatorFactory.java
> > Mon Jul  1 10:06:18 2013
> > @@ -46,4 +46,8 @@ final class GuiceAwareConstraintValidato
> >          return this.injector.getInstance(key);
> >      }
> >
> > +    public void releaseInstance(ConstraintValidator<?, ?> instance) {
> > +        // no-op
> > +    }
> > +
> >  }
> >
> > Modified:
> >
> bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java
> > (original)
> > +++
> >
> bval/branches/bval-11/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java
> > Mon Jul  1 10:06:18 2013
> > @@ -27,10 +27,10 @@ import javax.validation.ConstraintViolat
> >  import javax.validation.ConstraintViolationException;
> >  import javax.validation.Validator;
> >  import javax.validation.ValidatorFactory;
> > +import javax.validation.executable.ExecutableValidator;
> >
> >  import org.aopalliance.intercept.MethodInterceptor;
> >  import org.aopalliance.intercept.MethodInvocation;
> > -import org.apache.bval.jsr303.extensions.MethodValidator;
> >
> >  /**
> >   * Method interceptor for {@link Validate} annotation.
> > @@ -65,7 +65,7 @@ public final class ValidateMethodInterce
> >          Validate validate =
> > invocation.getMethod().getAnnotation(Validate.class);
> >
> >          Validator validator = this.validatorFactory.getValidator();
> > -        MethodValidator methodValidator =
> > validator.unwrap(MethodValidator.class);
> > +        ExecutableValidator methodValidator =
> validator.forExecutables();
> >
> >          Set<ConstraintViolation<?>> constraintViolations = new
> > HashSet<ConstraintViolation<?>>();
> >          Class<?> clazz = invocation.getMethod().getDeclaringClass();
> > @@ -73,7 +73,7 @@ public final class ValidateMethodInterce
> >          Object[] arguments = invocation.getArguments();
> >          Class<?>[] groups = validate.groups();
> >
> > -
> >  constraintViolations.addAll(methodValidator.validateParameters(clazz,
> > +
> >
>  constraintViolations.addAll(methodValidator.validateParameters(invocation.getThis(),
> >                  method,
> >                  arguments,
> >                  groups));
> > @@ -92,7 +92,7 @@ public final class ValidateMethodInterce
> >          Object returnedValue = invocation.proceed();
> >
> >          if (validate.validateReturnedValue()) {
> > -
> >  constraintViolations.addAll(methodValidator.validateReturnedValue(clazz,
> > method, returnedValue, groups));
> > +
> >
>  constraintViolations.addAll(methodValidator.validateReturnValue(invocation.getThis(),
> > method, returnedValue, groups));
> >
> >              if (!constraintViolations.isEmpty()) {
> >                  throw getException(new ConstraintViolationException(
> >
> > Modified: bval/branches/bval-11/bval-jsr303/pom.xml
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/pom.xml?rev=1498347&r1=1498346&r2=1498347&view=diff
> >
> >
> ==============================================================================
> > --- bval/branches/bval-11/bval-jsr303/pom.xml (original)
> > +++ bval/branches/bval-11/bval-jsr303/pom.xml Mon Jul  1 10:06:18 2013
> > @@ -34,24 +34,6 @@
> >      <description>Implementation specific classes for JSR 303 Bean
> > Validation 1.0</description>
> >
> >      <profiles>
> > -        <profile>
> > -            <id>jaxb</id>
> > -            <activation>
> > -                <jdk>1.5</jdk>
> > -            </activation>
> > -            <dependencies>
> > -                <dependency>
> > -                    <groupId>javax.xml.bind</groupId>
> > -                    <artifactId>jaxb-api</artifactId>
> > -                    <version>2.1</version>
> > -                </dependency>
> > -                <dependency>
> > -                    <groupId>com.sun.xml.bind</groupId>
> > -                    <artifactId>jaxb-impl</artifactId>
> > -                    <version>2.1.3</version>
> > -                </dependency>
> > -            </dependencies>
> > -        </profile>
> >          <!--
> >              default profile using geronimo-validation_1.0_spec.jar
> active
> > when
> >              property "ri" is not present.
> > @@ -65,11 +47,18 @@
> >              </activation>
> >              <dependencies>
> >                  <dependency>
> > +                    <groupId>javax.validation</groupId>
> > +                    <artifactId>validation-api</artifactId>
> > +                    <version>1.1.0.Final</version>
> > +                    <scope>provided</scope>
> > +                </dependency>
> > +                <!-- TODO
> > +                <dependency>
> >                      <groupId>org.apache.geronimo.specs</groupId>
> >
>  <artifactId>geronimo-validation_1.0_spec</artifactId>
> > -                    <!-- allow users to choose an API provider -->
> >                      <scope>provided</scope>
> >                  </dependency>
> > +                -->
> >              </dependencies>
> >          </profile>
> >          <!--
> > @@ -138,18 +127,52 @@
> >              <scope>provided</scope>
> >              <optional>true</optional>
> >          </dependency>
> > +        <dependency>
> > +            <groupId>org.apache.geronimo.specs</groupId>
> > +            <artifactId>geronimo-jcdi_1.0_spec</artifactId>
> > +            <version>1.0</version>
> > +            <scope>provided</scope>
> > +            <optional>true</optional>
> > +        </dependency>
> > +        <dependency>
> > +            <groupId>org.apache.geronimo.specs</groupId>
> > +            <artifactId>geronimo-el_2.2_spec</artifactId>
> > +            <version>1.0.2</version>
> > +            <optional>true</optional>
> > +        </dependency>
> > +        <dependency>
> > +            <groupId>org.apache.geronimo.specs</groupId>
> > +            <artifactId>geronimo-interceptor_1.1_spec</artifactId>
> > +            <version>1.0</version>
> > +            <scope>provided</scope>
> > +        </dependency>
> > +        <dependency>
> > +            <groupId>org.apache.geronimo.specs</groupId>
> > +            <artifactId>geronimo-atinject_1.0_spec</artifactId>
> > +            <version>1.0</version>
> > +            <scope>provided</scope>
> > +        </dependency>
> > +
> >          <!-- Testing dependencies -->
> >          <dependency>
> >              <groupId>junit</groupId>
> >              <artifactId>junit</artifactId>
> > -            <version>3.8.2</version>
> > -            <scope>test</scope>
> >          </dependency>
> >          <dependency>
> >              <groupId>org.mockito</groupId>
> >              <artifactId>mockito-core</artifactId>
> >              <scope>test</scope>
> >          </dependency>
> > +        <dependency>
> > +            <groupId>javax.xml.bind</groupId>
> > +            <artifactId>jaxb-api</artifactId>
> > +            <version>2.2.6</version>
> > +        </dependency>
> > +        <dependency>
> > +            <groupId>com.sun.xml.bind</groupId>
> > +            <artifactId>jaxb-impl</artifactId>
> > +            <version>2.2.6</version>
> > +        </dependency>
> >      </dependencies>
> >
> >      <build>
> > @@ -170,7 +193,7 @@
> >              <plugin>
> >                  <groupId>org.codehaus.mojo</groupId>
> >                  <artifactId>jaxb2-maven-plugin</artifactId>
> > -                <version>1.2</version>
> > +                <version>1.3.1</version>
> >                  <executions>
> >                      <execution>
> >                          <goals>
> > @@ -181,6 +204,7 @@
> >                  <configuration>
> >
>  <packageName>org.apache.bval.jsr303.xml</packageName>
> >                      <extension>true</extension>
> > +
> >
>  <schemaFiles>validation-configuration-1.1.xsd,validation-mapping-1.1.xsd</schemaFiles>
> >                  </configuration>
> >              </plugin>
> >
> >
> > Added:
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/AnyLiteral.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/AnyLiteral.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/AnyLiteral.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/AnyLiteral.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,31 @@
> > +/*
> > + * 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.cdi;
> > +
> > +import javax.enterprise.inject.Any;
> > +import javax.enterprise.util.AnnotationLiteral;
> > +
> > +public class AnyLiteral extends AnnotationLiteral<Any> implements Any {
> > +    public static final AnyLiteral INSTANCE = new AnyLiteral();
> > +
> > +    @Override
> > +    public String toString() {
> > +        return "@javax.enterprise.inject.Any()";
> > +    }
> > +}
> >
> > Added:
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValAnnotatedType.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValAnnotatedType.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValAnnotatedType.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValAnnotatedType.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,96 @@
> > +/*
> > + * 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.cdi;
> > +
> > +import javax.enterprise.inject.spi.AnnotatedConstructor;
> > +import javax.enterprise.inject.spi.AnnotatedField;
> > +import javax.enterprise.inject.spi.AnnotatedMethod;
> > +import javax.enterprise.inject.spi.AnnotatedType;
> > +import javax.enterprise.util.AnnotationLiteral;
> > +import java.lang.annotation.Annotation;
> > +import java.lang.reflect.Type;
> > +import java.util.HashSet;
> > +import java.util.Set;
> > +
> > +public class BValAnnotatedType<A> implements AnnotatedType<A> {
> > +    private final AnnotatedType<A> delegate;
> > +    private final Set<Annotation> annotations;
> > +
> > +    public BValAnnotatedType(final AnnotatedType<A> annotatedType) {
> > +        delegate = annotatedType;
> > +
> > +        annotations = new
> > HashSet<Annotation>(annotatedType.getAnnotations().size());
> > +        annotations.addAll(annotatedType.getAnnotations());
> > +        annotations.add(BValBindingLitteral.INSTANCE);
> > +    }
> > +
> > +    public Class<A> getJavaClass() {
> > +        return delegate.getJavaClass();
> > +    }
> > +
> > +    public Set<AnnotatedConstructor<A>> getConstructors() {
> > +        return delegate.getConstructors();
> > +    }
> > +
> > +    public Set<AnnotatedMethod<? super A>> getMethods() {
> > +        return delegate.getMethods();
> > +    }
> > +
> > +    public Set<AnnotatedField<? super A>> getFields() {
> > +        return delegate.getFields();
> > +    }
> > +
> > +    public Type getBaseType() {
> > +        return delegate.getBaseType();
> > +    }
> > +
> > +    public Set<Type> getTypeClosure() {
> > +        return delegate.getTypeClosure();
> > +    }
> > +
> > +    public <T extends Annotation> T getAnnotation(final Class<T>
> > annotationType) {
> > +        for (final Annotation ann : annotations) {
> > +            if (ann.annotationType().equals(annotationType)) {
> > +                return (T) ann;
> > +            }
> > +        }
> > +        return null;
> > +    }
> > +
> > +    public Set<Annotation> getAnnotations() {
> > +        return annotations;
> > +    }
> > +
> > +    public boolean isAnnotationPresent(Class<? extends Annotation>
> > annotationType) {
> > +        for (final Annotation ann : annotations) {
> > +            if (ann.annotationType().equals(annotationType)) {
> > +                return true;
> > +            }
> > +        }
> > +        return false;
> > +    }
> > +
> > +    public static class BValBindingLitteral extends
> > AnnotationLiteral<BValBinding> implements BValBinding {
> > +        public static final Annotation INSTANCE = new
> > BValBindingLitteral();
> > +
> > +        public Class<? extends Annotation> annotationType() {
> > +            return BValBinding.class;
> > +        }
> > +    }
> > +}
> >
> > Added:
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValBinding.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValBinding.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValBinding.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValBinding.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,31 @@
> > +/*
> > + * 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.cdi;
> > +
> > +import javax.interceptor.InterceptorBinding;
> > +import java.lang.annotation.ElementType;
> > +import java.lang.annotation.Retention;
> > +import java.lang.annotation.RetentionPolicy;
> > +import java.lang.annotation.Target;
> > +
> > +@Retention(RetentionPolicy.RUNTIME)
> > +@Target({ElementType.TYPE})
> > +@InterceptorBinding
> > +public @interface BValBinding {
> > +}
> >
> > Added:
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValExtension.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValExtension.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValExtension.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValExtension.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,269 @@
> > +/*
> > + * 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.cdi;
> > +
> > +import javax.enterprise.context.spi.CreationalContext;
> > +import javax.enterprise.event.Observes;
> > +import javax.enterprise.inject.spi.AfterBeanDiscovery;
> > +import javax.enterprise.inject.spi.AfterDeploymentValidation;
> > +import javax.enterprise.inject.spi.AnnotatedType;
> > +import javax.enterprise.inject.spi.Bean;
> > +import javax.enterprise.inject.spi.BeanManager;
> > +import javax.enterprise.inject.spi.BeforeBeanDiscovery;
> > +import javax.enterprise.inject.spi.BeforeShutdown;
> > +import javax.enterprise.inject.spi.Extension;
> > +import javax.enterprise.inject.spi.InjectionTarget;
> > +import javax.enterprise.inject.spi.ProcessAnnotatedType;
> > +import javax.enterprise.inject.spi.ProcessBean;
> > +import javax.naming.InitialContext;
> > +import javax.naming.NamingException;
> > +import javax.validation.BootstrapConfiguration;
> > +import javax.validation.Configuration;
> > +import javax.validation.Validation;
> > +import javax.validation.Validator;
> > +import javax.validation.ValidatorFactory;
> > +import javax.validation.executable.ExecutableType;
> > +import java.lang.reflect.Modifier;
> > +import java.lang.reflect.Type;
> > +import java.util.Collections;
> > +import java.util.Map;
> > +import java.util.Set;
> > +import java.util.concurrent.ConcurrentHashMap;
> > +import java.util.logging.Level;
> > +import java.util.logging.Logger;
> > +
> > +// mainly copied from deltaspike to not force users to use deltaspike
> > +// which would be a pain in servers
> > +// TODO: get rid of beans.xml adding interceptor automatically
> > +public class BValExtension implements Extension {
> > +    private static final Logger LOGGER =
> > Logger.getLogger(BValExtension.class.getName());
> > +
> > +    private static BValExtension bmpSingleton = null;
> > +    private volatile Map<ClassLoader, BeanManagerInfo> bmInfos = new
> > ConcurrentHashMap<ClassLoader, BeanManagerInfo>();
> > +
> > +    private boolean validatorFound = false;
> > +    private boolean validatorFactoryFound = false;
> > +
> > +    private final Configuration<?> config;
> > +
> > +    private Set<ExecutableType> globalExecutableTypes;
> > +    private boolean isExecutableValidationEnabled;
> > +
> > +    public BValExtension() { // read the config, could be done in a
> > quicker way but this let us get defaults without duplicating code
> > +        config = Validation.byDefaultProvider().configure();
> > +        try {
> > +            final BootstrapConfiguration bootstrap =
> > config.getBootstrapConfiguration();
> > +            globalExecutableTypes =
> > bootstrap.getDefaultValidatedExecutableTypes();
> > +            isExecutableValidationEnabled =
> > bootstrap.isExecutableValidationEnabled();
> > +        } catch (final Exception e) { // custom providers can throw an
> > exception
> > +            LOGGER.log(Level.SEVERE, e.getMessage(), e);
> > +
> > +            globalExecutableTypes = Collections.emptySet();
> > +            isExecutableValidationEnabled = false;
> > +        }
> > +    }
> > +
> > +    public static BValExtension getInstance() {
> > +        return bmpSingleton;
> > +    }
> > +
> > +    public void addBvalBinding(final @Observes BeforeBeanDiscovery
> > beforeBeanDiscovery, final BeanManager beanManager) {
> > +        beforeBeanDiscovery.addInterceptorBinding(BValBinding.class);
> > +    }
> > +
> > +    public <A> void processAnnotatedType(final @Observes
> > ProcessAnnotatedType<A> pat) {
> > +        final Class<A> javaClass =
> pat.getAnnotatedType().getJavaClass();
> > +        final int modifiers = javaClass.getModifiers();
> > +        if (!javaClass.getName().startsWith("javax.") &&
> > !javaClass.getName().startsWith("org.apache.bval")
> > +                && !javaClass.isInterface() &&
> > !Modifier.isFinal(modifiers) && !Modifier.isAbstract(modifiers)) {
> > +            pat.setAnnotatedType(new
> > BValAnnotatedType<A>(pat.getAnnotatedType()));
> > +        }
> > +    }
> > +
> > +    public <A> void processBean(final @Observes ProcessBean<A>
> > processBeanEvent) {
> > +        if (validatorFound && validatorFactoryFound) {
> > +            return;
> > +        }
> > +
> > +        final Bean<A> bean = processBeanEvent.getBean();
> > +        if (ValidatorBean.class.isInstance(bean) ||
> > ValidatorFactoryBean.class.isInstance(bean)) {
> > +            return;
> > +        }
> > +
> > +        final Set<Type> types = bean.getTypes();
> > +        if (!validatorFound) {
> > +            validatorFound = types.contains(Validator.class);
> > +        }
> > +        if (!validatorFactoryFound) {
> > +            validatorFactoryFound =
> > types.contains(ValidatorFactory.class);
> > +        }
> > +    }
> > +
> > +    public void addBValBeans(final @Observes AfterBeanDiscovery
> > afterBeanDiscovery, final BeanManager beanManager) {
> > +        captureBeanManager(beanManager);
> > +        cdiIntegration(afterBeanDiscovery, beanManager);
> > +    }
> > +
> > +    private void captureBeanManager(final BeanManager beanManager) {
> > +        // bean manager holder
> > +        if (bmpSingleton == null) {
> > +            bmpSingleton = this;
> > +        }
> > +        final BeanManagerInfo bmi = getBeanManagerInfo(loader());
> > +        bmi.loadTimeBm = beanManager;
> > +    }
> > +
> > +    private void cdiIntegration(final AfterBeanDiscovery
> > afterBeanDiscovery, final BeanManager beanManager) {
> > +        // add validator and validatorFactory if needed
> > +        ValidatorFactory factory = null;
> > +        if (!validatorFactoryFound) {
> > +            try {
> > +                factory = config.buildValidatorFactory();
> > +                afterBeanDiscovery.addBean(new
> > ValidatorFactoryBean(factory));
> > +            } catch (final Exception e) { // can throw an exception with
> > custom providers
> > +                LOGGER.log(Level.SEVERE, e.getMessage(), e);
> > +            }
> > +        }
> > +        if (!validatorFound) {
> > +            try {
> > +                if (factory == null) {
> > +                    factory = config.buildValidatorFactory();
> > +                }
> > +                afterBeanDiscovery.addBean(new
> > ValidatorBean(factory.getValidator()));
> > +                validatorFound = true;
> > +            } catch (final Exception e) { // getValidator can throw an
> > exception with custom providers
> > +                LOGGER.log(Level.SEVERE, e.getMessage(), e);
> > +            }
> > +        }
> > +
> > +        // add our interceptor, after having added validator if needed
> > since it is injected in the interceptor
> > +        if (validatorFound) {
> > +            afterBeanDiscovery.addBean(new
> > BValInterceptorBean(beanManager));
> > +        } // else we couldn't resolve the interceptor injection point
> > +    }
> > +
> > +    private static ClassLoader loader() {
> > +        return Thread.currentThread().getContextClassLoader();
> > +    }
> > +
> > +    public BeanManager getBeanManager() {
> > +        final BeanManagerInfo bmi = getBeanManagerInfo(loader());
> > +
> > +        BeanManager result = bmi.finalBm;
> > +        if (result == null) {
> > +            synchronized (this) {
> > +                result = resolveBeanManagerViaJndi();
> > +                if (result == null) {
> > +                    result = bmi.loadTimeBm;
> > +                }
> > +                if (result == null) {
> > +                    throw new IllegalStateException("Unable to find
> > BeanManager. " +
> > +                            "Please ensure that you configured the CDI
> > implementation of your choice properly.");
> > +                }
> > +                bmi.finalBm = result;
> > +            }
> > +        }
> > +
> > +        return result;
> > +    }
> > +
> > +    public void cleanupFinalBeanManagers(final @Observes
> > AfterDeploymentValidation adv) {
> > +        for (final BeanManagerInfo bmi : bmpSingleton.bmInfos.values())
> {
> > +            bmi.finalBm = null;
> > +        }
> > +    }
> > +
> > +    public void cleanupStoredBeanManagerOnShutdown(final @Observes
> > BeforeShutdown beforeShutdown) {
> > +        bmpSingleton.bmInfos.remove(loader());
> > +    }
> > +
> > +    private static BeanManager resolveBeanManagerViaJndi() {
> > +        try {
> > +            return (BeanManager) new
> > InitialContext().lookup("java:comp/BeanManager");
> > +        } catch (final NamingException e) {
> > +            return null;
> > +        }
> > +    }
> > +
> > +    private BeanManagerInfo getBeanManagerInfo(final ClassLoader cl) {
> > +        BeanManagerInfo bmi = bmpSingleton.bmInfos.get(cl);
> > +        if (bmi == null) {
> > +            synchronized (this) {
> > +                bmi = bmpSingleton.bmInfos.get(cl);
> > +                if (bmi == null) {
> > +                    bmi = new BeanManagerInfo();
> > +                    bmpSingleton.bmInfos.put(cl, bmi);
> > +                }
> > +            }
> > +        }
> > +        return bmi;
> > +    }
> > +
> > +    public static <T> Releasable<T> inject(final Class<T> clazz) {
> > +        try {
> > +            final BeanManager beanManager =
> > getInstance().getBeanManager();
> > +            final AnnotatedType<T> annotatedType =
> > beanManager.createAnnotatedType(clazz);
> > +            final InjectionTarget<T> it =
> > beanManager.createInjectionTarget(annotatedType);
> > +            final CreationalContext<T> context =
> > beanManager.createCreationalContext(null);
> > +            final T instance = it.produce(context);
> > +            it.inject(instance, context);
> > +            it.postConstruct(instance);
> > +
> > +            return new Releasable<T>(context, it, instance);
> > +        } catch (final Exception e) {
> > +            // no-op
> > +        } catch (final NoClassDefFoundError error) {
> > +            // no-op
> > +        }
> > +        return null;
> > +    }
> > +
> > +    private static class BeanManagerInfo {
> > +        private BeanManager loadTimeBm = null;
> > +        private BeanManager finalBm = null;
> > +    }
> > +
> > +    public static class Releasable<T> {
> > +        private final CreationalContext<T> context;
> > +        private final InjectionTarget<T> injectionTarget;
> > +        private final T instance;
> > +
> > +        private Releasable(final CreationalContext<T> context, final
> > InjectionTarget<T> injectionTarget, final T instance) {
> > +            this.context = context;
> > +            this.injectionTarget = injectionTarget;
> > +            this.instance = instance;
> > +        }
> > +
> > +        public void release() {
> > +            try {
> > +                injectionTarget.preDestroy(instance);
> > +                injectionTarget.dispose(instance);
> > +                context.release();
> > +            } catch (final Exception e) {
> > +                // no-op
> > +            } catch (final NoClassDefFoundError e) {
> > +                // no-op
> > +            }
> > +        }
> > +
> > +        public T getInstance() {
> > +            return instance;
> > +        }
> > +    }
> > +}
> >
> > Added:
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValInterceptor.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValInterceptor.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValInterceptor.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValInterceptor.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,69 @@
> > +/*
> > + * 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.cdi;
> > +
> > +import org.apache.bval.jsr303.util.Proxies;
> > +
> > +import javax.inject.Inject;
> > +import javax.interceptor.AroundInvoke;
> > +import javax.interceptor.Interceptor;
> > +import javax.interceptor.InvocationContext;
> > +import javax.validation.ConstraintViolation;
> > +import javax.validation.ConstraintViolationException;
> > +import javax.validation.Validator;
> > +import javax.validation.executable.ExecutableValidator;
> > +import javax.validation.metadata.MethodDescriptor;
> > +import java.lang.reflect.Method;
> > +import java.util.Set;
> > +
> > +@Interceptor
> > +@BValBinding
> > +public class BValInterceptor {
> > +    @Inject
> > +    private Validator validator;
> > +
> > +    @AroundInvoke
> > +    public Object around(final InvocationContext context) throws
> > Throwable {
> > +        final ExecutableValidator ev = validator.forExecutables();
> > +
> > +        final Method method = context.getMethod();
> > +        final MethodDescriptor constraintsForMethod =
> >
> validator.getConstraintsForClass(Proxies.classFor(method.getDeclaringClass())).getConstraintsForMethod(method.getName(),
> > method.getParameterTypes());
> > +        if (constraintsForMethod == null) {
> > +            return context.proceed();
> > +        }
> > +
> > +        {
> > +            final Set<ConstraintViolation<Object>> violations =
> > ev.validateParameters(context.getTarget(), method,
> context.getParameters());
> > +            if (!violations.isEmpty()) {
> > +                throw new ConstraintViolationException(violations);
> > +            }
> > +        }
> > +
> > +        final Object result = context.proceed();
> > +
> > +        {
> > +            final Set<ConstraintViolation<Object>> violations =
> > ev.validateReturnValue(context.getTarget(), method, result);
> > +            if (!violations.isEmpty()) {
> > +                throw new ConstraintViolationException(violations);
> > +            }
> > +        }
> > +
> > +        return result;
> > +    }
> > +}
> >
> > Added:
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValInterceptorBean.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValInterceptorBean.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValInterceptorBean.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/BValInterceptorBean.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,145 @@
> > +/*
> > + * 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.cdi;
> > +
> > +import javax.enterprise.context.Dependent;
> > +import javax.enterprise.context.spi.CreationalContext;
> > +import javax.enterprise.inject.spi.Annotated;
> > +import javax.enterprise.inject.spi.Bean;
> > +import javax.enterprise.inject.spi.BeanManager;
> > +import javax.enterprise.inject.spi.InjectionPoint;
> > +import javax.enterprise.inject.spi.InjectionTarget;
> > +import javax.enterprise.inject.spi.PassivationCapable;
> > +import java.lang.annotation.Annotation;
> > +import java.lang.reflect.Member;
> > +import java.lang.reflect.Type;
> > +import java.util.Collections;
> > +import java.util.HashSet;
> > +import java.util.Set;
> > +
> > +public class BValInterceptorBean implements Bean<BValInterceptor>,
> > PassivationCapable {
> > +    private final Set<Type> types;
> > +    private final Set<Annotation> qualifiers;
> > +    private final Set<InjectionPoint> injectionPoints;
> > +    private final InjectionTarget<BValInterceptor> injectionTarget;
> > +
> > +    public BValInterceptorBean(final BeanManager bm) {
> > +        types = new HashSet<Type>();
> > +        types.add(BValInterceptor.class);
> > +        types.add(Object.class);
> > +
> > +        qualifiers = new HashSet<Annotation>();
> > +        qualifiers.add(DefaultLiteral.INSTANCE);
> > +        qualifiers.add(AnyLiteral.INSTANCE);
> > +
> > +        injectionTarget =
> > bm.createInjectionTarget(bm.createAnnotatedType(BValInterceptor.class));
> > +        injectionPoints =
> > Collections.singleton(InjectionPoint.class.cast(new
> > BValInterceptorInjectionPoint(this,
> > injectionTarget.getInjectionPoints().iterator().next())));
> > +    }
> > +
> > +    public Set<Type> getTypes() {
> > +        return types;
> > +    }
> > +
> > +    public Set<Annotation> getQualifiers() {
> > +        return qualifiers;
> > +    }
> > +
> > +    public Class<? extends Annotation> getScope() {
> > +        return Dependent.class;
> > +    }
> > +
> > +    public String getName() {
> > +        return null;
> > +    }
> > +
> > +    public boolean isNullable() {
> > +        return false;
> > +    }
> > +
> > +    public Set<InjectionPoint> getInjectionPoints() {
> > +        return injectionPoints;
> > +    }
> > +
> > +    public Class<?> getBeanClass() {
> > +        return BValInterceptor.class;
> > +    }
> > +
> > +    public Set<Class<? extends Annotation>> getStereotypes() {
> > +        return Collections.emptySet();
> > +    }
> > +
> > +    public boolean isAlternative() {
> > +        return false;
> > +    }
> > +
> > +    public BValInterceptor create(final
> > CreationalContext<BValInterceptor> context) {
> > +        final BValInterceptor produced =
> injectionTarget.produce(context);
> > +        injectionTarget.inject(produced, context);
> > +        injectionTarget.postConstruct(produced);
> > +        return produced;
> > +    }
> > +
> > +    public void destroy(final BValInterceptor instance, final
> > CreationalContext<BValInterceptor> context) {
> > +        injectionTarget.preDestroy(instance);
> > +        injectionTarget.dispose(instance);
> > +        context.release();
> > +    }
> > +
> > +    public String getId() {
> > +        return "BValInterceptor-" + hashCode();
> > +    }
> > +
> > +    private static class BValInterceptorInjectionPoint implements
> > InjectionPoint {
> > +        private final InjectionPoint delegate;
> > +        private final Bean<?> bean;
> > +
> > +        public BValInterceptorInjectionPoint(final Bean<?> bean, final
> > InjectionPoint next) {
> > +            this.bean = bean;
> > +            delegate = next;
> > +        }
> > +
> > +        public Type getType() {
> > +            return delegate.getType();
> > +        }
> > +
> > +        public Set<Annotation> getQualifiers() {
> > +            return delegate.getQualifiers();
> > +        }
> > +
> > +        public Bean<?> getBean() {
> > +            return bean;
> > +        }
> > +
> > +        public Member getMember() {
> > +            return delegate.getMember();
> > +        }
> > +
> > +        public Annotated getAnnotated() {
> > +            return delegate.getAnnotated();
> > +        }
> > +
> > +        public boolean isDelegate() {
> > +            return delegate.isDelegate();
> > +        }
> > +
> > +        public boolean isTransient() {
> > +            return delegate.isTransient();
> > +        }
> > +    }
> > +}
> >
> > Added:
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/DefaultLiteral.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/DefaultLiteral.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/DefaultLiteral.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/DefaultLiteral.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,31 @@
> > +/*
> > + * 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.cdi;
> > +
> > +import javax.enterprise.inject.Default;
> > +import javax.enterprise.util.AnnotationLiteral;
> > +
> > +public class DefaultLiteral extends AnnotationLiteral<Default>
> implements
> > Default {
> > +    public static final DefaultLiteral INSTANCE = new DefaultLiteral();
> > +
> > +    @Override
> > +    public String toString() {
> > +        return "@javax.enterprise.inject.Default()";
> > +    }
> > +}
> >
> > Added:
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/ValidatorBean.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/ValidatorBean.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/ValidatorBean.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/ValidatorBean.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,97 @@
> > +/*
> > + * 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.cdi;
> > +
> > +import javax.enterprise.context.ApplicationScoped;
> > +import javax.enterprise.context.spi.CreationalContext;
> > +import javax.enterprise.inject.spi.Bean;
> > +import javax.enterprise.inject.spi.InjectionPoint;
> > +import javax.enterprise.inject.spi.PassivationCapable;
> > +import javax.validation.Validator;
> > +import java.lang.annotation.Annotation;
> > +import java.lang.reflect.Type;
> > +import java.util.Collections;
> > +import java.util.HashSet;
> > +import java.util.Set;
> > +
> > +public class ValidatorBean implements Bean<Validator> ,
> > PassivationCapable{
> > +    private final Set<Type> types;
> > +    private final Set<Annotation> qualifiers;
> > +    private final Validator instance;
> > +
> > +    public ValidatorBean(Validator validator) {
> > +        this.instance = validator;
> > +
> > +        types = new HashSet<Type>();
> > +        types.add(Validator.class);
> > +        types.add(Object.class);
> > +
> > +        qualifiers = new HashSet<Annotation>();
> > +        qualifiers.add(DefaultLiteral.INSTANCE);
> > +        qualifiers.add(AnyLiteral.INSTANCE);
> > +    }
> > +
> > +    public Set<Type> getTypes() {
> > +        return types;
> > +    }
> > +
> > +    public Set<Annotation> getQualifiers() {
> > +        return qualifiers;
> > +    }
> > +
> > +    public Class<? extends Annotation> getScope() {
> > +        return ApplicationScoped.class;
> > +    }
> > +
> > +    public String getName() {
> > +        return null;
> > +    }
> > +
> > +    public boolean isNullable() {
> > +        return false;
> > +    }
> > +
> > +    public Set<InjectionPoint> getInjectionPoints() {
> > +        return Collections.emptySet();
> > +    }
> > +
> > +    public Class<?> getBeanClass() {
> > +        return Validator.class;
> > +    }
> > +
> > +    public Set<Class<? extends Annotation>> getStereotypes() {
> > +        return Collections.emptySet();
> > +    }
> > +
> > +    public boolean isAlternative() {
> > +        return false;
> > +    }
> > +
> > +    public Validator create(final CreationalContext<Validator> context)
> {
> > +        return instance;
> > +    }
> > +
> > +    public void destroy(final Validator instance, final
> > CreationalContext<Validator> context) {
> > +        // no-op
> > +    }
> > +
> > +    public String getId() {
> > +        return "BValValidator-" + hashCode();
> > +    }
> > +}
> >
> > Added:
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/ValidatorFactoryBean.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/ValidatorFactoryBean.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/ValidatorFactoryBean.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/cdi/ValidatorFactoryBean.java
> > Mon Jul  1 10:06:18 2013
> > @@ -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.cdi;
> > +
> > +import javax.enterprise.context.ApplicationScoped;
> > +import javax.enterprise.context.spi.CreationalContext;
> > +import javax.enterprise.inject.spi.Bean;
> > +import javax.enterprise.inject.spi.InjectionPoint;
> > +import javax.enterprise.inject.spi.PassivationCapable;
> > +import javax.validation.Validator;
> > +import javax.validation.ValidatorFactory;
> > +import java.lang.annotation.Annotation;
> > +import java.lang.reflect.Type;
> > +import java.util.Collections;
> > +import java.util.HashSet;
> > +import java.util.Set;
> > +
> > +public class ValidatorFactoryBean implements Bean<ValidatorFactory> ,
> > PassivationCapable{
> > +    private final Set<Type> types;
> > +    private final Set<Annotation> qualifiers;
> > +    private final ValidatorFactory instance;
> > +
> > +    public ValidatorFactoryBean(final ValidatorFactory
> validatorFactory) {
> > +        this.instance = validatorFactory;
> > +
> > +        types = new HashSet<Type>();
> > +        types.add(ValidatorFactory.class);
> > +        types.add(Object.class);
> > +
> > +        qualifiers = new HashSet<Annotation>();
> > +        qualifiers.add(DefaultLiteral.INSTANCE);
> > +        qualifiers.add(AnyLiteral.INSTANCE);
> > +    }
> > +
> > +    public Set<Type> getTypes() {
> > +        return types;
> > +    }
> > +
> > +    public Set<Annotation> getQualifiers() {
> > +        return qualifiers;
> > +    }
> > +
> > +    public Class<? extends Annotation> getScope() {
> > +        return ApplicationScoped.class;
> > +    }
> > +
> > +    public String getName() {
> > +        return null;
> > +    }
> > +
> > +    public boolean isNullable() {
> > +        return false;
> > +    }
> > +
> > +    public Set<InjectionPoint> getInjectionPoints() {
> > +        return Collections.emptySet();
> > +    }
> > +
> > +    public Class<?> getBeanClass() {
> > +        return ValidatorFactory.class;
> > +    }
> > +
> > +    public Set<Class<? extends Annotation>> getStereotypes() {
> > +        return Collections.emptySet();
> > +    }
> > +
> > +    public boolean isAlternative() {
> > +        return false;
> > +    }
> > +
> > +    public ValidatorFactory create(final
> > CreationalContext<ValidatorFactory> context) {
> > +        return instance;
> > +    }
> > +
> > +    public void destroy(final ValidatorFactory instance, final
> > CreationalContext<ValidatorFactory> context) {
> > +        instance.close();
> > +    }
> > +
> > +    public String getId() {
> > +        return "BValValidatorFactory-" + hashCode();
> > +    }
> > +}
> >
> > Added:
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForCharSequence.java
> > URL:
> >
> http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForCharSequence.java?rev=1498347&view=auto
> >
> >
> ==============================================================================
> > ---
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForCharSequence.java
> > (added)
> > +++
> >
> bval/branches/bval-11/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForCharSequence.java
> > Mon Jul  1 10:06:18 2013
> > @@ -0,0 +1,44 @@
> > +/*
> > + * 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.constraints;
> > +
> > +import javax.validation.ConstraintValidator;
> > +import javax.validation.ConstraintValidatorContext;
> > +import javax.validation.constraints.Size;
> > +
> > +/** Check that a string's length is between min and max. */
> > +public class SizeValidatorForCharSequence extends SizeValidator
> > +      implements ConstraintValidator<Size, CharSequence> {
> > +    /**
> > +     * Checks the length of the specified string.
> > +     *
> > +     * @param s       The string to validate.
> > +     * @param context context in which the constraint is evaluated.
> > +     * @return Returns <code>true</code> if the string is
> > <code>null</code> or the length of <code>s</code> between the specified
> > +     *         <code>min</code> and <code>max</code> values (inclusive),
> > <code>false</code> otherwise.
> > +     */
> > +    public boolean isValid(CharSequence s, ConstraintValidatorContext
> > context) {
> > +        if (s == null) {
> > +            return true;
> > +        }
> > +        int length = s.length();
> > +        return length >= min && length <= max;
> > +    }
> > +
> > +}
> >
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message