X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Finject%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Finject%2FInjectorBuilder.java;h=f0c0292b2c40d23cf306413c2ab26aae687f0426;hb=94ddca39fadbe7931a17c179424afd123bd2863a;hp=fe6c2a93bf5422f7f76e295738b4c89e1015cf74;hpb=4a575582a5c2999bd816b197d9cf274b4b3ddcd7;p=utils diff --git a/support/inject/src/main/java/org/wamblee/inject/InjectorBuilder.java b/support/inject/src/main/java/org/wamblee/inject/InjectorBuilder.java index fe6c2a93..f0c0292b 100644 --- a/support/inject/src/main/java/org/wamblee/inject/InjectorBuilder.java +++ b/support/inject/src/main/java/org/wamblee/inject/InjectorBuilder.java @@ -20,25 +20,28 @@ import java.util.ServiceLoader; /** * Utility for obtaining an implementation of the {@link InjectorFactory} using - * {@link ServiceLoader} and for obtaining a {@link SimpleInjector}. + * {@link ServiceLoader} and for obtaining a {@link SimpleInjector}. * - * The builder takes care that the factory and simple injector are built only once. - * For test code, make sure to call {@link #setInjectorFactory(InjectorFactory)} - * before each test case to force the retrieval of a new factory and injector. This - * is important because if the simple injector is not created again it will use - * cached {@link Injector} instances from other tests. + * The builder takes care that the factory and simple injector are built only + * once. For test code, make sure to call + * {@link #setInjectorFactory(InjectorFactory)} before each test case to force + * the retrieval of a new factory and injector. This is important because if the + * simple injector is not created again it will use cached {@link Injector} + * instances from other tests. * * @author Erik Brakkee */ public class InjectorBuilder { private static InjectorFactory FACTORY; - - private static SimpleInjector INJECTOR; + + private static SimpleInjector INJECTOR; /** - * Sets the injector factory. This is useful for testing. - * @param aFactory Factory to use. + * Sets the injector factory. This is useful for testing. + * + * @param aFactory + * Factory to use. */ public static void setInjectorFactory(InjectorFactory aFactory) { FACTORY = aFactory; @@ -53,18 +56,20 @@ public class InjectorBuilder { */ public static InjectorFactory getInjectorFactory() { if (FACTORY == null) { - FACTORY = findInjectorFactory(); + FACTORY = findInjectorFactory(); INJECTOR = new SimpleInjector(FACTORY); } return FACTORY; } - + /** - * Gets an injector that support injection into any type of object and - * performs caching of the injector obtained from the {@link InjectorFactory}. + * 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() { + public static Injector getInjector() { getInjectorFactory(); return INJECTOR; }