org.atmosphere.inject
Class InjectableObjectFactory

java.lang.Object
  extended by org.atmosphere.inject.InjectableObjectFactory
All Implemented Interfaces:
AtmosphereObjectFactory<Injectable<?>>, AtmosphereConfigAware

public class InjectableObjectFactory
extends Object
implements AtmosphereObjectFactory<Injectable<?>>

Support injection of Atmosphere's Internal object using AtmosphereConfig,AtmosphereFramework,{@link AtmosphereFramework,{@link org.atmosphere.cpr.BroadcasterFactory, {@link org.atmosphere.cpr.AtmosphereResourceFactory } ,{@link org.atmosphere.cpr.DefaultMetaBroadcaster } and {@link org.atmosphere.cpr.AtmosphereResourceSessionFactory }

Author:
Jeanfrancois Arcand

Field Summary
static Class<Injectable<?>>[] DEFAULT_ATMOSPHERE_INJECTABLE
           
protected static org.slf4j.Logger logger
           
 
Constructor Summary
InjectableObjectFactory()
           
 
Method Summary
 AtmosphereObjectFactory allowInjectionOf(Injectable<?> injectable)
          Pass information to the underlying Dependency Injection Implementation
 void configure(AtmosphereConfig config)
          Configure an AtmosphereFramework object.
<U> void
injectAtmosphereInternalObject(U instance, Class<U> defaultType, AtmosphereFramework framework)
           
<T,U extends T>
U
newClassInstance(Class<T> classType, Class<U> defaultType)
          Delegate the creation of Object to the underlying object provider like Spring, Guice, etc.
<U> void
postConstructExecution(U instance, Class<U> defaultType)
          Execute method.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static final org.slf4j.Logger logger

DEFAULT_ATMOSPHERE_INJECTABLE

public static final Class<Injectable<?>>[] DEFAULT_ATMOSPHERE_INJECTABLE
Constructor Detail

InjectableObjectFactory

public InjectableObjectFactory()
Method Detail

configure

public void configure(AtmosphereConfig config)
Description copied from interface: AtmosphereConfigAware
Configure an AtmosphereFramework object.

Specified by:
configure in interface AtmosphereConfigAware
Parameters:
config - AtmosphereConfig

newClassInstance

public <T,U extends T> U newClassInstance(Class<T> classType,
                                          Class<U> defaultType)
                             throws InstantiationException,
                                    IllegalAccessException
Description copied from interface: AtmosphereObjectFactory
Delegate the creation of Object to the underlying object provider like Spring, Guice, etc. When creating a class, it is important to check if the class can be configured via its implementation of the AtmosphereConfigAware. AtmosphereConfigAware.configure(AtmosphereConfig) should be called in that case.

Specified by:
newClassInstance in interface AtmosphereObjectFactory<Injectable<?>>
Parameters:
classType - The class' type to be created
defaultType - a class to be created @return an instance of T
Throws:
InstantiationException
IllegalAccessException

postConstructExecution

public <U> void postConstructExecution(U instance,
                                       Class<U> defaultType)
                            throws IllegalAccessException
Execute method.

Type Parameters:
U -
Parameters:
instance - the requested object.
defaultType - the type of the requested object
Throws:
IllegalAccessException

injectAtmosphereInternalObject

public <U> void injectAtmosphereInternalObject(U instance,
                                               Class<U> defaultType,
                                               AtmosphereFramework framework)
                                    throws IllegalAccessException
Type Parameters:
U -
Parameters:
instance - the requested object.
defaultType - the type of the requested object
framework - the AtmosphereFramework
Throws:
IllegalAccessException

allowInjectionOf

public AtmosphereObjectFactory allowInjectionOf(Injectable<?> injectable)
Description copied from interface: AtmosphereObjectFactory
Pass information to the underlying Dependency Injection Implementation

Specified by:
allowInjectionOf in interface AtmosphereObjectFactory<Injectable<?>>
Parameters:
injectable - an Z
Returns:
this

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015. All Rights Reserved.