(no commit message)
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Wed, 28 Jul 2010 18:22:35 +0000 (18:22 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Wed, 28 Jul 2010 18:22:35 +0000 (18:22 +0000)
support/inject/src/main/java/org/wamblee/inject/Injectable.java
support/inject/src/main/java/org/wamblee/inject/InjectorBuilder.java [moved from support/inject/src/main/java/org/wamblee/inject/InjectorFactoryBuilder.java with 90% similarity]
support/inject/src/main/java/org/wamblee/inject/InjectorFactory.java
support/inject/src/main/java/org/wamblee/inject/SimpleInjector.java
support/inject/src/main/java/org/wamblee/inject/package-info.java
support/inject/src/test/java/org/wamblee/inject/InjectorBuilderTest.java [moved from support/inject/src/test/java/org/wamblee/inject/InjectorFactoryBuilderTest.java with 78% similarity]

index a87c236b2cd33c8330bf62893ae42926b4da2004..ccc408f7a0eca2e5a914ce3d7d80f205b4e7986e 100644 (file)
@@ -22,15 +22,15 @@ package org.wamblee.inject;
  * initialize fields of derived classes to null as these will override the
  * initializations of this base class.
  * 
- * This class uses {@link InjectorFactoryBuilder} to obtain an implementation of 
+ * This class uses {@link InjectorBuilder} to obtain an implementation of 
  * a {@link InjectorFactory} to use. 
  * 
  * @author Erik Brakkee
  */
 public abstract class Injectable {
 
-    private final SimpleInjector injector = 
-        InjectorFactoryBuilder.getInjector();
+    private final Injector injector = 
+        InjectorBuilder.getInjector();
 
     /**
      * Inheritance style constructor.
@@ -53,7 +53,7 @@ public abstract class Injectable {
      * Gets the default injector.
      * @return Injector. 
      */
-    public SimpleInjector getInjector() {
+    public Injector getInjector() {
         return injector;
     }
 }
similarity index 90%
rename from support/inject/src/main/java/org/wamblee/inject/InjectorFactoryBuilder.java
rename to support/inject/src/main/java/org/wamblee/inject/InjectorBuilder.java
index 197311a8b262927ee39d9b45e6a9fcea79940217..fe6c2a93bf5422f7f76e295738b4c89e1015cf74 100644 (file)
@@ -30,7 +30,7 @@ import java.util.ServiceLoader;
  * 
  * @author Erik Brakkee
  */
-public class InjectorFactoryBuilder {
+public class InjectorBuilder {
 
     private static InjectorFactory FACTORY;
     
@@ -59,7 +59,12 @@ public class InjectorFactoryBuilder {
         return FACTORY;
     }
     
-    public static SimpleInjector getInjector() { 
+    /**
+     * Gets an injector that support injection into any type of object and 
+     * performs caching of the injector obtained from the {@link InjectorFactory}.
+     * @return Injector.
+     */
+    public static Injector getInjector() { 
         getInjectorFactory();
         return INJECTOR;
     }
index 9f2dfe2283ec70039d431ed6b3d6a4d443ebf500..d36720de8eca93ebc6853f5e861502be5677ea98 100644 (file)
@@ -22,7 +22,7 @@ package org.wamblee.inject;
  * testing. 
  * 
  * Implementations of this class must have a default no-arg constructor to be usable by 
- * {@link InjectorFactoryBuilder}.
+ * {@link InjectorBuilder}.
  * 
  * @author Erik Brakkee
  */
index 9e83064c98cbe5e8f7f5007e94e0fb14ff751b82..b41eb4c35f65cd6faa5f577bc031edd076b9d5df 100644 (file)
@@ -53,11 +53,11 @@ package org.wamblee.inject;
  * 
  * For more advanced cases, the injector factory can also be directly
  * constructed instead of being obtained through the
- * {@link InjectorFactoryBuilder}.
+ * {@link InjectorBuilder}.
  * 
  * @author Erik Brakkee
  */
-public class SimpleInjector {
+public class SimpleInjector implements Injector {
 
     private InjectorCache cache;
 
index c07c8ab89a81d11168956f4f36b7c956eeddf534..2d07bb1f46c9304c662226f743e793e852c6740f 100644 (file)
  * 
  * <p>Users of this package will typically use: </p>
  * <ul>
- *   <li> <code>SimpleInjector</code>: This is the class used to perform injection of dependencies into 
+ *   <li> <code>Injector</code>: This is the interface used to perform injection of dependencies into 
  *        a given object. </li>
  *   <li> <code>Injectable</code>: By subclassing this class, the classes automatically get their 
  *        dependencies injected at construction. </li>
- *   <li> <code>InjectorFactoryBuilder</code>: To get an injector factory reference for use in the 
- *       <code>SimpleInjector</code>
+ *   <li> <code>InjectorBuilder</code>: To get an instance of the  <code>Injector</code>.
+ *   </li>
  * </ul>
  * 
  * <h2>Implementors of the package</h2>
@@ -38,7 +38,7 @@
  *   <li> <code>Injector</code>: The main interface to be implemented is the {@link Injector}, by which injection is done.</li>
  *   <li> <code>InjectorFactory</code>: Injectors are created by an implementation of the {@link InjectorFactory} which 
  * creates injectors based on the class.</li>
- *   <li> <code>InjectorFactoryBuilder</code>: Implementations must make their <code>InjectorFactory</code>
+ *   <li> <code>InjectorBuilder</code>: Implementations must make their <code>InjectorFactory</code>
  *       available through the <code>ServiceLoader</code> mechanism. 
  *   </li>
  * </ul>
@@ -49,4 +49,3 @@
  */
 package org.wamblee.inject;
 
-
similarity index 78%
rename from support/inject/src/test/java/org/wamblee/inject/InjectorFactoryBuilderTest.java
rename to support/inject/src/test/java/org/wamblee/inject/InjectorBuilderTest.java
index 6e20e32a52d6dbdb20aef825d4f3d8959453ce7b..e1c10a805c82dcd76a049f180596df7967b6c3e2 100644 (file)
@@ -21,16 +21,16 @@ import static junit.framework.TestCase.*;
 
 import static org.mockito.Mockito.*; 
 
-public class InjectorFactoryBuilderTest {
+public class InjectorBuilderTest {
     
     @After
     public void tearDown() { 
-        InjectorFactoryBuilder.setInjectorFactory(null);
+        InjectorBuilder.setInjectorFactory(null);
     }
 
     @Test
     public void testGetInjectorFactory() { 
-        InjectorFactory factory = InjectorFactoryBuilder.getInjectorFactory(); 
+        InjectorFactory factory = InjectorBuilder.getInjectorFactory(); 
         assertTrue(factory instanceof TestInjectorFactory);
     }
     
@@ -38,8 +38,8 @@ public class InjectorFactoryBuilderTest {
     public void testOVerrideInjectorFactory() { 
         InjectorFactory factory = mock(InjectorFactory.class);
         
-        InjectorFactoryBuilder.setInjectorFactory(factory); 
-        InjectorFactory factory2 = InjectorFactoryBuilder.getInjectorFactory(); 
+        InjectorBuilder.setInjectorFactory(factory); 
+        InjectorFactory factory2 = InjectorBuilder.getInjectorFactory(); 
         assertSame(factory, factory2);  
     }
 }