public abstract class BaseFactory extends Object implements Factory
reflectionStrategy(String, Class)
and ctorStrategy(String, Class)
) to produce objects.
This class caches the produced objects for the lifetime of this object. Effectively this means the lifetime of the ICS object.
Modifier and Type | Field and Description |
---|---|
protected COM.FutureTense.Interfaces.ICS |
ics
Deprecated.
|
protected static org.slf4j.Logger |
LOG
Deprecated.
|
Constructor and Description |
---|
BaseFactory(COM.FutureTense.Interfaces.ICS ics)
Deprecated.
|
BaseFactory(COM.FutureTense.Interfaces.ICS ics,
Factory... roots)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected <T> T |
createFromMethod(String name,
Class<T> c,
Method m)
Deprecated.
|
COM.FutureTense.Interfaces.ICS |
createICS(COM.FutureTense.Interfaces.ICS ics)
Deprecated.
|
protected <T> T |
ctorStrategy(String name,
Class<T> c)
Deprecated.
|
protected Class<?>[] |
factoryClasses(COM.FutureTense.Interfaces.ICS ics)
Deprecated.
Method to find classes to use for the producer methods.
|
<T> T |
getObject(String name,
Class<T> fieldType)
Deprecated.
|
protected Object |
invokeCreateMethod(Method m,
Object from,
String name,
Object... arguments)
Deprecated.
|
protected <T> T |
locate(String askedName,
Class<T> c)
Deprecated.
Internal method to check for Services or create Services.
|
protected <T> T |
namedAnnotationStrategy(String name,
Class<T> c)
Deprecated.
Tries to create the object based on the
ServiceProducer
annotation where the names match. |
protected <T> T |
reflectionStrategy(String name,
Class<T> c)
Deprecated.
Reflection based producer method.
|
protected boolean |
shouldCache(Method m)
Deprecated.
|
protected void |
throwRuntimeException(InvocationTargetException e)
Deprecated.
|
String |
toString()
Deprecated.
|
protected <T> T |
unnamedAnnotationStrategy(String name,
Class<T> c)
Deprecated.
Tries to create the object based on the
ServiceProducer
annotation without a name. |
protected static final org.slf4j.Logger LOG
protected final COM.FutureTense.Interfaces.ICS ics
public BaseFactory(COM.FutureTense.Interfaces.ICS ics)
public BaseFactory(COM.FutureTense.Interfaces.ICS ics, Factory... roots)
protected <T> T locate(String askedName, Class<T> c) throws InvocationTargetException
T
- ics or cached objectaskedName
- name of asset to findc
- current assetInvocationTargetException
- exception from invocationprotected Class<?>[] factoryClasses(COM.FutureTense.Interfaces.ICS ics)
Object.getClass()
.
Subclasses can return and are encouraged to return other classes.ics
- Content Server context objectprotected <T> T namedAnnotationStrategy(String name, Class<T> c) throws InvocationTargetException
ServiceProducer
annotation where the names match.T
- object created by service producername
- namec
- current assetInvocationTargetException
- exception from invocationprotected <T> T unnamedAnnotationStrategy(String name, Class<T> c) throws InvocationTargetException
ServiceProducer
annotation without a name.T
- object created based on service producername
- namec
- current assetInvocationTargetException
- exception from invocationprotected <T> T reflectionStrategy(String name, Class<T> c) throws InvocationTargetException
This method uses reflection to find producer methods to the following rules:
ICS
and Factory
as
arguments. To this class the current ICS and this object will be passed.T
- returnable producer method or nullname
- the simple name of the object to producec
- the class with the type information of the object to produceInvocationTargetException
- when the create<Type> method
throws an exception.protected <T> T createFromMethod(String name, Class<T> c, Method m) throws InvocationTargetException
T
- created method typename
- name of the objectc
- the type of the object to createm
- the method to use to create the objectInvocationTargetException
- exception from invoking specified method from class nameprotected 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 methodInvocationTargetException
- exception from invocationprotected boolean shouldCache(Method m)
protected void throwRuntimeException(InvocationTargetException e)
e
- Exceptionprotected <T> T ctorStrategy(String name, Class<T> c) throws InvocationTargetException
T
- invoked object given classname
- namec
- current assetInvocationTargetException
- exception from invoking constructorpublic COM.FutureTense.Interfaces.ICS createICS(COM.FutureTense.Interfaces.ICS ics)
Copyright © 2010–2017. All rights reserved.