incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r930237 - /incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/
Date Fri, 02 Apr 2010 11:04:51 GMT
Author: simonetripodi
Date: Fri Apr  2 11:04:50 2010
New Revision: 930237

URL: http://svn.apache.org/viewvc?rev=930237&view=rev
Log:
changed the Singleton policy

Modified:
    incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ConfigurationStateProvider.java
    incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/GuiceAwareConstraintValidatorFactory.java
    incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidationModule.java
    incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidatorFactoryProvider.java
    incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidatorProvider.java

Modified: incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ConfigurationStateProvider.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ConfigurationStateProvider.java?rev=930237&r1=930236&r2=930237&view=diff
==============================================================================
--- incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ConfigurationStateProvider.java
(original)
+++ incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ConfigurationStateProvider.java
Fri Apr  2 11:04:50 2010
@@ -11,12 +11,14 @@ import org.apache.bval.jsr303.Configurat
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
+import com.google.inject.Singleton;
 
 /**
  * The {@code javax.validation.spi.ConfigurationState} provider implementation.
  *
  * @version $Id$
  */
+@Singleton
 public final class ConfigurationStateProvider implements Provider<ConfigurationState>
{
 
     private final ConfigurationImpl configurationState;

Modified: incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/GuiceAwareConstraintValidatorFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/GuiceAwareConstraintValidatorFactory.java?rev=930237&r1=930236&r2=930237&view=diff
==============================================================================
--- incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/GuiceAwareConstraintValidatorFactory.java
(original)
+++ incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/GuiceAwareConstraintValidatorFactory.java
Fri Apr  2 11:04:50 2010
@@ -21,6 +21,7 @@ import javax.validation.ConstraintValida
 
 import com.google.inject.Inject;
 import com.google.inject.Injector;
+import com.google.inject.Singleton;
 
 /**
  * {@code javax.validation.ConstraintValidatorFactory} implementation that
@@ -28,6 +29,7 @@ import com.google.inject.Injector;
  *
  * @version $Id$
  */
+@Singleton
 final class GuiceAwareConstraintValidatorFactory implements ConstraintValidatorFactory {
 
     private final Injector injector;

Modified: incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidationModule.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidationModule.java?rev=930237&r1=930236&r2=930237&view=diff
==============================================================================
--- incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidationModule.java
(original)
+++ incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidationModule.java
Fri Apr  2 11:04:50 2010
@@ -64,6 +64,7 @@ import org.apache.bval.jsr303.DefaultMes
 import org.apache.bval.jsr303.resolver.DefaultTraversableResolver;
 
 import com.google.inject.AbstractModule;
+import com.google.inject.Scopes;
 
 /**
  * The Google-Guice module for Apache Bean Validation.
@@ -78,51 +79,51 @@ public final class ValidationModule exte
     @Override
     protected void configure() {
         // constraints
-        this.bind(AssertFalseValidator.class).asEagerSingleton();
-        this.bind(AssertTrueValidator.class).asEagerSingleton();
-        this.bind(DecimalMaxValidatorForNumber.class).asEagerSingleton();
-        this.bind(DecimalMaxValidatorForString.class).asEagerSingleton();
-        this.bind(DecimalMinValidatorForNumber.class).asEagerSingleton();
-        this.bind(DecimalMinValidatorForString.class).asEagerSingleton();
-        this.bind(DigitsValidatorForNumber.class).asEagerSingleton();
-        this.bind(DigitsValidatorForString.class).asEagerSingleton();
-        this.bind(EmailValidator.class).asEagerSingleton();
-        this.bind(FutureValidatorForCalendar.class).asEagerSingleton();
-        this.bind(FutureValidatorForDate.class).asEagerSingleton();
-        this.bind(MaxValidatorForNumber.class).asEagerSingleton();
-        this.bind(MaxValidatorForString.class).asEagerSingleton();
-        this.bind(MinValidatorForNumber.class).asEagerSingleton();
-        this.bind(MinValidatorForString.class).asEagerSingleton();
-        this.bind(NotEmptyValidator.class).asEagerSingleton();
-        this.bind(NotEmptyValidatorForCollection.class).asEagerSingleton();
-        this.bind(NotEmptyValidatorForMap.class).asEagerSingleton();
-        this.bind(NotEmptyValidatorForString.class).asEagerSingleton();
-        this.bind(NotNullValidator.class).asEagerSingleton();
-        this.bind(NullValidator.class).asEagerSingleton();
-        this.bind(PastValidatorForCalendar.class).asEagerSingleton();
-        this.bind(PastValidatorForDate.class).asEagerSingleton();
-        this.bind(PatternValidator.class).asEagerSingleton();
-        this.bind(SizeValidator.class).asEagerSingleton();
-        this.bind(SizeValidatorForArrayOfBoolean.class).asEagerSingleton();
-        this.bind(SizeValidatorForArrayOfByte.class).asEagerSingleton();
-        this.bind(SizeValidatorForArrayOfChar.class).asEagerSingleton();
-        this.bind(SizeValidatorForArrayOfDouble.class).asEagerSingleton();
-        this.bind(SizeValidatorForArrayOfFloat.class).asEagerSingleton();
-        this.bind(SizeValidatorForArrayOfInt.class).asEagerSingleton();
-        this.bind(SizeValidatorForArrayOfLong.class).asEagerSingleton();
-        this.bind(SizeValidatorForArrayOfObject.class).asEagerSingleton();
-        this.bind(SizeValidatorForArrayOfShort.class).asEagerSingleton();
-        this.bind(SizeValidatorForCollection.class).asEagerSingleton();
-        this.bind(SizeValidatorForMap.class).asEagerSingleton();
-        this.bind(SizeValidatorForString.class).asEagerSingleton();
+        this.bind(AssertFalseValidator.class).in(Scopes.SINGLETON);
+        this.bind(AssertTrueValidator.class).in(Scopes.SINGLETON);
+        this.bind(DecimalMaxValidatorForNumber.class).in(Scopes.SINGLETON);
+        this.bind(DecimalMaxValidatorForString.class).in(Scopes.SINGLETON);
+        this.bind(DecimalMinValidatorForNumber.class).in(Scopes.SINGLETON);
+        this.bind(DecimalMinValidatorForString.class).in(Scopes.SINGLETON);
+        this.bind(DigitsValidatorForNumber.class).in(Scopes.SINGLETON);
+        this.bind(DigitsValidatorForString.class).in(Scopes.SINGLETON);
+        this.bind(EmailValidator.class).in(Scopes.SINGLETON);
+        this.bind(FutureValidatorForCalendar.class).in(Scopes.SINGLETON);
+        this.bind(FutureValidatorForDate.class).in(Scopes.SINGLETON);
+        this.bind(MaxValidatorForNumber.class).in(Scopes.SINGLETON);
+        this.bind(MaxValidatorForString.class).in(Scopes.SINGLETON);
+        this.bind(MinValidatorForNumber.class).in(Scopes.SINGLETON);
+        this.bind(MinValidatorForString.class).in(Scopes.SINGLETON);
+        this.bind(NotEmptyValidator.class).in(Scopes.SINGLETON);
+        this.bind(NotEmptyValidatorForCollection.class).in(Scopes.SINGLETON);
+        this.bind(NotEmptyValidatorForMap.class).in(Scopes.SINGLETON);
+        this.bind(NotEmptyValidatorForString.class).in(Scopes.SINGLETON);
+        this.bind(NotNullValidator.class).in(Scopes.SINGLETON);
+        this.bind(NullValidator.class).in(Scopes.SINGLETON);
+        this.bind(PastValidatorForCalendar.class).in(Scopes.SINGLETON);
+        this.bind(PastValidatorForDate.class).in(Scopes.SINGLETON);
+        this.bind(PatternValidator.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidator.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidatorForArrayOfBoolean.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidatorForArrayOfByte.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidatorForArrayOfChar.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidatorForArrayOfDouble.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidatorForArrayOfFloat.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidatorForArrayOfInt.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidatorForArrayOfLong.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidatorForArrayOfObject.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidatorForArrayOfShort.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidatorForCollection.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidatorForMap.class).in(Scopes.SINGLETON);
+        this.bind(SizeValidatorForString.class).in(Scopes.SINGLETON);
 
         // bootstrap
-        this.bind(MessageInterpolator.class).to(DefaultMessageInterpolator.class).asEagerSingleton();
-        this.bind(TraversableResolver.class).to(DefaultTraversableResolver.class).asEagerSingleton();
-        this.bind(ConstraintValidatorFactory.class).to(GuiceAwareConstraintValidatorFactory.class).asEagerSingleton();
-        this.bind(ConfigurationState.class).toProvider(ConfigurationStateProvider.class).asEagerSingleton();
-        this.bind(ValidatorFactory.class).toProvider(ValidatorFactoryProvider.class).asEagerSingleton();
-        this.bind(Validator.class).toProvider(ValidatorProvider.class).asEagerSingleton();
+        this.bind(MessageInterpolator.class).to(DefaultMessageInterpolator.class).in(Scopes.SINGLETON);
+        this.bind(TraversableResolver.class).to(DefaultTraversableResolver.class).in(Scopes.SINGLETON);
+        this.bind(ConstraintValidatorFactory.class).to(GuiceAwareConstraintValidatorFactory.class);
+        this.bind(ConfigurationState.class).toProvider(ConfigurationStateProvider.class);
+        this.bind(ValidatorFactory.class).toProvider(ValidatorFactoryProvider.class);
+        this.bind(Validator.class).toProvider(ValidatorProvider.class);
     }
 
 }

Modified: incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidatorFactoryProvider.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidatorFactoryProvider.java?rev=930237&r1=930236&r2=930237&view=diff
==============================================================================
--- incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidatorFactoryProvider.java
(original)
+++ incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidatorFactoryProvider.java
Fri Apr  2 11:04:50 2010
@@ -23,12 +23,14 @@ import org.apache.bval.jsr303.ApacheVali
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
+import com.google.inject.Singleton;
 
 /**
  * Validator Factory guice provider implementation.
  *
  * @version $Id$
  */
+@Singleton
 public final class ValidatorFactoryProvider implements Provider<ValidatorFactory> {
 
     private final ApacheValidatorFactory validatorFactory;

Modified: incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidatorProvider.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidatorProvider.java?rev=930237&r1=930236&r2=930237&view=diff
==============================================================================
--- incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidatorProvider.java
(original)
+++ incubator/bval/sandbox/guice-integration/src/main/java/org/apache/bval/extentions/guice/ValidatorProvider.java
Fri Apr  2 11:04:50 2010
@@ -21,12 +21,14 @@ import javax.validation.ValidatorFactory
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
+import com.google.inject.Singleton;
 
 /**
  * Validator guice provider implementation.
  *
  * @version $Id$
  */
+@Singleton
 public final class ValidatorProvider implements Provider<Validator> {
 
     /**



Mime
View raw message