public class InjectorImpl extends Object implements Injector
| Constructor and Description |
|---|
InjectorImpl(String name,
HashMap<Class<?>,Class<?>> implementationClasses,
String[] implementationConventions,
HashMap<Class<?>,javax.inject.Provider<?>> implementationProviders,
InterceptorProvider[] interceptorProviders)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
getClassName(String sFullClassName)
Returns the "class name" of the given full class name
e.g. returns "String" for "java.lang.String" |
protected <T> T |
getComponentInstance(Class<T> componentClass)
Returns a component instance for the given class
If the given class is an interface the implementation is returned. |
<T> T |
getInstance(Class<T> clazz) |
InterceptorProvider[] |
getInterceptorProviders() |
String |
getName() |
protected String |
getPackageName(String sFullClassName)
Returns the "package name" of the given class name
e.g. returns "java.lang" for "java.lang.String" |
protected boolean |
isMonoInstance(Class<?> cl)
Returns a boolean value indicating if the given component is
"mono-instance" or not
By default it returns TRUE if the given class has an annotation ending with "Singleton" This method can be overridden in the sub-class if necessary |
protected boolean |
isMonoInstanceByAnnotation(Class<?> componentClass) |
protected boolean |
isMonoInstanceByAnnotation(Class<?> componentClass,
Class<?> annotationClass)
Method designed to be used in the "isMonoInstance" concrete method.
|
protected boolean |
isMonoInstanceByBooleanStaticField(Class<?> componentClass,
String fieldName)
Method designed to be used in the "isMonoInstance" concrete method.
|
protected boolean |
isMonoInstanceByInterface(Class<?> componentClass,
Class<?> monoInstanceInterface)
Method designed to be used in the "isMonoInstance" concrete method.
|
void |
printAllComponents(PrintStream out)
Utility method to print all the container's components
|
public InjectorImpl(String name, HashMap<Class<?>,Class<?>> implementationClasses, String[] implementationConventions, HashMap<Class<?>,javax.inject.Provider<?>> implementationProviders, InterceptorProvider[] interceptorProviders)
name - implementationClasses - implementationConventions - implementationProviders - interceptorProviders - public InterceptorProvider[] getInterceptorProviders()
getInterceptorProviders in interface Injectorpublic <T> T getInstance(Class<T> clazz)
getInstance in interface Injectorprotected <T> T getComponentInstance(Class<T> componentClass)
componentClass - the requested component class or interfaceprotected boolean isMonoInstance(Class<?> cl)
cl - protected String getClassName(String sFullClassName)
sFullClassName - protected String getPackageName(String sFullClassName)
sFullClassName - public void printAllComponents(PrintStream out)
printAllComponents in interface Injectorout - protected boolean isMonoInstanceByInterface(Class<?> componentClass, Class<?> monoInstanceInterface)
componentClass - the component class to introspectmonoInstanceInterface - the class of the interface used as a markerprotected boolean isMonoInstanceByBooleanStaticField(Class<?> componentClass, String fieldName)
componentClass - the component class to introspectfieldName - the name of the field used as a marker protected boolean isMonoInstanceByAnnotation(Class<?> componentClass, Class<?> annotationClass)
componentClass - the component class to introspectannotationClass - the annotation to be searchedprotected boolean isMonoInstanceByAnnotation(Class<?> componentClass)
Copyright © 2016. All rights reserved.