public class InjectableObjectFactory extends 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.InjectModifier 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,
Class<U> defaultType)
|
void |
configure(AtmosphereConfig config)
Configure an AtmosphereFramework object.
|
protected <T,U extends T> |
fieldInjectionException(Field field,
U instance,
Class<T> clazz,
Exception ex) |
<U> U |
getInjectable(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(Set<Field> fields,
U instance,
AtmosphereFramework framework,
LinkedList<Injectable<?>> injectable) |
<U> void |
injectInjectable(U instance,
Class<? extends U> defaultType,
AtmosphereFramework framework) |
protected void |
injectionFailed() |
InjectableObjectFactory |
listener(InjectionListener i) |
protected <T,U extends T> |
methodInjectionException(Method m,
U instance,
Class<T> clazz,
Exception ex) |
boolean |
needRequestScoped(Class defaultType) |
<T,U extends T> |
newClassInstance(Class<T> classType,
Class<U> defaultType)
Delegate the creation of Object to the underlying object provider like Spring, Guice, etc.
|
protected <T,U extends T> |
nullFieldInjectionFor(Field field,
U instance,
Class<T> clazz) |
protected <T,U extends T> |
postFieldInjection(Field field,
U instance,
Class<T> clazz) |
protected <T,U extends T> |
postMethodInjection(Method method,
U instance,
Class<T> clazz) |
protected <T,U extends T> |
preFieldInjection(Field field,
U instance,
Class<T> clazz) |
protected <T,U extends T> |
preMethodInjection(Method method,
U instance,
Class<T> clazz) |
void |
requestScoped(Object instance,
Class defaultType) |
void |
requestScoped(Object instance,
Class defaultType,
AtmosphereResource r) |
protected void |
retryInjection(AtmosphereFramework framework) |
String |
toString() |
public void configure(AtmosphereConfig config)
AtmosphereConfigAware
configure
in interface AtmosphereConfigAware
config
- AtmosphereConfig
protected void retryInjection(AtmosphereFramework framework)
public <T,U extends T> U newClassInstance(Class<T> classType, Class<U> defaultType) throws InstantiationException, IllegalAccessException
AtmosphereObjectFactory
AtmosphereConfigAware
. 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 TInstantiationException
IllegalAccessException
public <T> T inject(T instance) throws InstantiationException, IllegalAccessException
Injectable
and InjectIntrospector
to a class already constructed.instance
- the instance to inject to.InstantiationException
IllegalAccessException
public <U> void applyMethods(U instance, Class<U> defaultType) throws IllegalAccessException
U
- instance
- the requested object.defaultType
- the type of the requested objectIllegalAccessException
public <U> void injectInjectable(U instance, Class<? extends U> defaultType, AtmosphereFramework framework) throws IllegalAccessException
U
- instance
- the requested object.defaultType
- the type of the requested objectframework
- the AtmosphereFramework
IllegalAccessException
public <U> void injectFields(Set<Field> fields, U instance, AtmosphereFramework framework, LinkedList<Injectable<?>> injectable) throws IllegalAccessException
IllegalAccessException
public AtmosphereObjectFactory allowInjectionOf(Injectable<?> injectable)
AtmosphereObjectFactory
allowInjectionOf
in interface AtmosphereObjectFactory<Injectable<?>>
injectable
- an Zpublic AtmosphereObjectFactory allowInjectionOf(Injectable<?> injectable, boolean first)
public <U> U getInjectable(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(Object instance, Class defaultType, AtmosphereResource r) throws IllegalAccessException
IllegalAccessException
public void requestScoped(Object instance, Class defaultType) throws IllegalAccessException
IllegalAccessException
public boolean needRequestScoped(Class defaultType) throws IllegalAccessException
IllegalAccessException
public InjectableObjectFactory listener(InjectionListener i)
protected void injectionFailed()
protected <T,U extends T> void nullFieldInjectionFor(Field field, U instance, Class<T> clazz)
protected <T,U extends T> void fieldInjectionException(Field field, U instance, Class<T> clazz, Exception ex)
protected <T,U extends T> void methodInjectionException(Method m, U instance, Class<T> clazz, Exception ex)
protected <T,U extends T> void preFieldInjection(Field field, U instance, Class<T> clazz)
protected <T,U extends T> void postFieldInjection(Field field, U instance, Class<T> clazz)
protected <T,U extends T> void preMethodInjection(Method method, U instance, Class<T> clazz)
Copyright © 2016. All rights reserved.