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.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,
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)
AtmosphereConfigAwareconfigure in interface AtmosphereConfigAwareconfig - AtmosphereConfigprotected void retryInjection(AtmosphereFramework framework)
public <T,U extends T> U newClassInstance(Class<T> classType, Class<U> defaultType) throws InstantiationException, 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 TInstantiationExceptionIllegalAccessExceptionpublic <T> T inject(T instance)
throws InstantiationException,
IllegalAccessException
Injectable and InjectIntrospector to a class already constructed.instance - the instance to inject to.InstantiationExceptionIllegalAccessExceptionpublic <U> void applyMethods(U instance,
Class<U> defaultType)
throws IllegalAccessException
U - instance - the requested object.defaultType - the type of the requested objectIllegalAccessExceptionpublic <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 AtmosphereFrameworkIllegalAccessExceptionpublic <U> void injectFields(Set<Field> fields, U instance, AtmosphereFramework framework, LinkedList<Injectable<?>> injectable) throws IllegalAccessException
IllegalAccessExceptionpublic AtmosphereObjectFactory allowInjectionOf(Injectable<?> injectable)
AtmosphereObjectFactoryallowInjectionOf 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
IllegalAccessExceptionpublic void requestScoped(Object instance, Class defaultType) throws IllegalAccessException
IllegalAccessExceptionpublic boolean needRequestScoped(Class defaultType) throws IllegalAccessException
IllegalAccessExceptionpublic 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.