incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1074866 - /incubator/bval/trunk/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java
Date Sat, 26 Feb 2011 15:10:43 GMT
Author: simonetripodi
Date: Sat Feb 26 15:10:42 2011
New Revision: 1074866

URL: http://svn.apache.org/viewvc?rev=1074866&view=rev
Log:
no reason to prefer the ValidatorProvider, request ValidatorFactory injection and create Validator
instances

Modified:
    incubator/bval/trunk/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java

Modified: incubator/bval/trunk/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java?rev=1074866&r1=1074865&r2=1074866&view=diff
==============================================================================
--- incubator/bval/trunk/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java
(original)
+++ incubator/bval/trunk/bval-guice/src/main/java/org/apache/bval/guice/ValidateMethodInterceptor.java
Sat Feb 26 15:10:42 2011
@@ -26,6 +26,7 @@ import javax.inject.Inject;
 import javax.validation.ConstraintViolation;
 import javax.validation.ConstraintViolationException;
 import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
 
 import org.aopalliance.intercept.MethodInterceptor;
 import org.aopalliance.intercept.MethodInvocation;
@@ -43,18 +44,18 @@ public final class ValidateMethodInterce
     private static final Class<?>[] MESSAGE_CAUSE_TYPES = new Class[]{ String.class,
Throwable.class };
 
     /**
-     * The {@link ValidatorProvider} reference.
+     * The {@link ValidatorFactory} reference.
      */
     @Inject
-    private ValidatorProvider validatorProvider;
+    private ValidatorFactory validatorFactory;
 
     /**
-     * Sets the {@link ValidatorProvider} reference.
+     * Sets the {@link ValidatorFactory} reference.
      *
-     * @param validatorProvider the {@link ValidatorProvider} reference.
+     * @param validatorFactory the {@link ValidatorFactory} reference
      */
-    public void setValidatorProvider(ValidatorProvider validatorProvider) {
-        this.validatorProvider = validatorProvider;
+    public void setValidatorFactory(ValidatorFactory validatorFactory) {
+        this.validatorFactory = validatorFactory;
     }
 
     /**
@@ -63,7 +64,7 @@ public final class ValidateMethodInterce
     public Object invoke(MethodInvocation invocation) throws Throwable {
         Validate validate = invocation.getMethod().getAnnotation(Validate.class);
 
-        Validator validator = this.validatorProvider.get();
+        Validator validator = this.validatorFactory.getValidator();
         MethodValidator methodValidator = validator.unwrap(MethodValidator.class);
 
         Set<ConstraintViolation<?>> constraintViolations = new HashSet<ConstraintViolation<?>>();



Mime
View raw message