public class InjectableObjectFactory extends java.lang.Object implements AtmosphereObjectFactory<Injectable<?>>
AtmosphereConfig,AtmosphereFramework,org.atmosphere.cpr.BroadcasterFactory,
{@link org.atmosphere.cpr.AtmosphereResourceFactory } ,{@link org.atmosphere.cpr.DefaultMetaBroadcaster } and
{@link org.atmosphere.cpr.AtmosphereResourceSessionFactory } and classes implementing the {@link Injectable} defined inside
META_INF/services/org.atmosphere.inject.Inject| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
InjectableObjectFactory() |
| Modifier and Type | Method and Description |
|---|---|
AtmosphereObjectFactory |
allowInjectionOf(Injectable<?> injectable)
Pass information to the underlying Dependency Injection Implementation
|
AtmosphereObjectFactory |
allowInjectionOf(Injectable<?> injectable,
boolean first) |
<U> void |
applyMethods(U instance,
java.lang.Class<U> defaultType)
|
void |
configure(AtmosphereConfig config)
Configure an AtmosphereFramework object.
|
protected <T,U extends T> |
fieldInjectionException(java.lang.reflect.Field field,
U instance,
java.lang.Class<T> clazz,
java.lang.Exception ex) |
<U> U |
getInjectable(java.lang.Class<U> u)
Use this method to retrieve available
Injectable. |
<T> T |
inject(T instance)
Apply
Injectable and InjectIntrospector to a class already constructed. |
<U> void |
injectFields(java.util.Set<java.lang.reflect.Field> fields,
U instance,
AtmosphereFramework framework,
java.util.LinkedList<Injectable<?>> injectable) |
<U> void |
injectInjectable(U instance,
java.lang.Class<? extends U> defaultType,
AtmosphereFramework framework) |
protected void |
injectionFailed() |
InjectableObjectFactory |
listener(InjectionListener i) |
protected <T,U extends T> |
methodInjectionException(java.lang.reflect.Method m,
U instance,
java.lang.Class<T> clazz,
java.lang.Exception ex) |
boolean |
needRequestScoped(java.lang.Class defaultType) |
<T,U extends T> |
newClassInstance(java.lang.Class<T> classType,
java.lang.Class<U> defaultType)
Delegate the creation of Object to the underlying object provider like Spring, Guice, etc.
|
protected <T,U extends T> |
nullFieldInjectionFor(java.lang.reflect.Field field,
U instance,
java.lang.Class<T> clazz) |
protected <T,U extends T> |
postFieldInjection(java.lang.reflect.Field field,
U instance,
java.lang.Class<T> clazz) |
protected <T,U extends T> |
postMethodInjection(java.lang.reflect.Method method,
U instance,
java.lang.Class<T> clazz) |
protected <T,U extends T> |
preFieldInjection(java.lang.reflect.Field field,
U instance,
java.lang.Class<T> clazz) |
protected <T,U extends T> |
preMethodInjection(java.lang.reflect.Method method,
U instance,
java.lang.Class<T> clazz) |
void |
requestScoped(java.lang.Object instance,
java.lang.Class defaultType) |
void |
requestScoped(java.lang.Object instance,
java.lang.Class defaultType,
AtmosphereResource r) |
protected void |
retryInjection(AtmosphereFramework framework) |
java.lang.String |
toString() |
public void configure(AtmosphereConfig config)
AtmosphereConfigAwareconfigure in interface AtmosphereConfigAwareconfig - AtmosphereConfigprotected void retryInjection(AtmosphereFramework framework)
public <T,U extends T> U newClassInstance(java.lang.Class<T> classType,
java.lang.Class<U> defaultType)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
AtmosphereObjectFactoryAtmosphereConfigAware. AtmosphereConfigAware.configure(AtmosphereConfig)
should be called in that case.newClassInstance in interface AtmosphereObjectFactory<Injectable<?>>classType - The class' type to be createddefaultType - a class to be created @return an instance of Tjava.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionpublic <T> T inject(T instance)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException
Injectable and InjectIntrospector to a class already constructed.instance - the instance to inject to.java.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionpublic <U> void applyMethods(U instance,
java.lang.Class<U> defaultType)
throws java.lang.IllegalAccessException
U - instance - the requested object.defaultType - the type of the requested objectjava.lang.IllegalAccessExceptionpublic <U> void injectInjectable(U instance,
java.lang.Class<? extends U> defaultType,
AtmosphereFramework framework)
throws java.lang.IllegalAccessException
U - instance - the requested object.defaultType - the type of the requested objectframework - the AtmosphereFrameworkjava.lang.IllegalAccessExceptionpublic <U> void injectFields(java.util.Set<java.lang.reflect.Field> fields,
U instance,
AtmosphereFramework framework,
java.util.LinkedList<Injectable<?>> injectable)
throws java.lang.IllegalAccessException
java.lang.IllegalAccessExceptionpublic AtmosphereObjectFactory allowInjectionOf(Injectable<?> injectable)
AtmosphereObjectFactoryallowInjectionOf in interface AtmosphereObjectFactory<Injectable<?>>injectable - an Zpublic AtmosphereObjectFactory allowInjectionOf(Injectable<?> injectable, boolean first)
public java.lang.String toString()
toString in class java.lang.Objectpublic <U> U getInjectable(java.lang.Class<U> u)
Injectable. This method is for application that inject their
own Injectable and needs already constructed classes.U - the typeu - the classpublic void requestScoped(java.lang.Object instance,
java.lang.Class defaultType,
AtmosphereResource r)
throws java.lang.IllegalAccessException
java.lang.IllegalAccessExceptionpublic void requestScoped(java.lang.Object instance,
java.lang.Class defaultType)
throws java.lang.IllegalAccessException
java.lang.IllegalAccessExceptionpublic boolean needRequestScoped(java.lang.Class defaultType)
throws java.lang.IllegalAccessException
java.lang.IllegalAccessExceptionpublic InjectableObjectFactory listener(InjectionListener i)
protected void injectionFailed()
protected <T,U extends T> void nullFieldInjectionFor(java.lang.reflect.Field field,
U instance,
java.lang.Class<T> clazz)
protected <T,U extends T> void fieldInjectionException(java.lang.reflect.Field field,
U instance,
java.lang.Class<T> clazz,
java.lang.Exception ex)
protected <T,U extends T> void methodInjectionException(java.lang.reflect.Method m,
U instance,
java.lang.Class<T> clazz,
java.lang.Exception ex)
protected <T,U extends T> void preFieldInjection(java.lang.reflect.Field field,
U instance,
java.lang.Class<T> clazz)
protected <T,U extends T> void postFieldInjection(java.lang.reflect.Field field,
U instance,
java.lang.Class<T> clazz)
protected <T,U extends T> void preMethodInjection(java.lang.reflect.Method method,
U instance,
java.lang.Class<T> clazz)
protected <T,U extends T> void postMethodInjection(java.lang.reflect.Method method,
U instance,
java.lang.Class<T> clazz)
Copyright © 2018. All Rights Reserved.