|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.fatwire.gst.foundation.controller.action.support.BaseFactory
public abstract class BaseFactory
Factory making use to reflection (reflectionStrategy(String, Class)
and ctorStrategy(String, Class)
) to produce objects.
Field Summary | |
---|---|
protected COM.FutureTense.Interfaces.ICS |
ics
|
protected static org.apache.commons.logging.Log |
LOG
|
Constructor Summary | |
---|---|
BaseFactory(COM.FutureTense.Interfaces.ICS ics)
|
|
BaseFactory(COM.FutureTense.Interfaces.ICS ics,
Factory... roots)
|
Method Summary | ||
---|---|---|
protected
|
createFromMethod(String name,
Class<T> c,
Method m)
|
|
COM.FutureTense.Interfaces.ICS |
createICS(COM.FutureTense.Interfaces.ICS ics)
|
|
protected
|
ctorStrategy(String name,
Class<T> c)
|
|
protected Class<?>[] |
factoryClasses(COM.FutureTense.Interfaces.ICS ics)
Method to find classes to use for the producer methods. |
|
|
getObject(String name,
Class<T> fieldType)
|
|
protected Object |
invokeCreateMethod(Method m,
Object from,
String name,
Object... arguments)
|
|
protected
|
locate(String askedName,
Class<T> c)
Internal method to check for Services or create Services. |
|
protected
|
namedAnnotationStrategy(String name,
Class<T> c)
Tries to create the object based on the ServiceProducer
annotation where the names match. |
|
protected
|
reflectionStrategy(String name,
Class<T> c)
Reflection based producer method. |
|
protected boolean |
shouldCache(Method m)
|
|
protected void |
throwRuntimeException(InvocationTargetException e)
|
|
String |
toString()
|
|
protected
|
unnamedAnnotationStrategy(String name,
Class<T> c)
Tries to create the object based on the ServiceProducer
annotation without a name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.commons.logging.Log LOG
protected final COM.FutureTense.Interfaces.ICS ics
Constructor Detail |
---|
public BaseFactory(COM.FutureTense.Interfaces.ICS ics)
public BaseFactory(COM.FutureTense.Interfaces.ICS ics, Factory... roots)
Method Detail |
---|
public final <T> T getObject(String name, Class<T> fieldType)
getObject
in interface Factory
protected <T> T locate(String askedName, Class<T> c) throws InvocationTargetException
name
- c
-
InvocationTargetException
protected Class<?>[] factoryClasses(COM.FutureTense.Interfaces.ICS ics)
Object.getClass()
. Subclasses can return and
are encouraged to return other classes.
ics
-
protected <T> T namedAnnotationStrategy(String name, Class<T> c) throws InvocationTargetException
ServiceProducer
annotation where the names match.
name
- c
-
InvocationTargetException
protected <T> T unnamedAnnotationStrategy(String name, Class<T> c) throws InvocationTargetException
ServiceProducer
annotation without a name.
name
- c
-
InvocationTargetException
protected <T> T reflectionStrategy(String name, Class<T> c) throws InvocationTargetException
ICS
and Factory
as
arguments. To this class the current ICS and this object will be passed.
name
- the simple name of the object to producec
- the class with the type information of the object to produce
InvocationTargetException
- when the create<Type> method
throws an exception.protected <T> T createFromMethod(String name, Class<T> c, Method m) throws InvocationTargetException
name
- name of the objectc
- the type of the object to createm
- the method to use to create the object
InvocationTargetException
protected Object invokeCreateMethod(Method m, Object from, String name, Object... arguments) throws InvocationTargetException
m
- method in invokefrom
- object to invoke fromname
- the name of the objectarguments
- the arguments to pass to the method
InvocationTargetException
protected boolean shouldCache(Method m)
protected void throwRuntimeException(InvocationTargetException e)
e
- protected <T> T ctorStrategy(String name, Class<T> c) throws InvocationTargetException
name
- c
-
InvocationTargetException
public COM.FutureTense.Interfaces.ICS createICS(COM.FutureTense.Interfaces.ICS ics)
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |