public class DelegateAdaptorFactory extends AbstractInjectionFactory
| Constructor and Description |
|---|
DelegateAdaptorFactory()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<T> ComponentAdapter<T> |
createComponentAdapter(ComponentMonitor componentMonitor,
LifecycleStrategy lifecycleStrategy,
Properties componentProperties,
Object componentKey,
Class<T> componentImplementation,
Parameter... parameters) |
static <INSTANCE,RETURN_TYPE> |
createDelegate(Class<INSTANCE> targetType,
String methodName,
Object... parameters)
Generic-friendly instantiation.
|
static Properties |
createDelegateProprties(Object targetObject,
String methodName,
Object... parameters)
Use this static factory method as a way of creating all the necessary properties that are required by the adapter.
|
accept, verify, wrapLifeCyclepublic DelegateAdaptorFactory()
public <T> ComponentAdapter<T> createComponentAdapter(ComponentMonitor componentMonitor, LifecycleStrategy lifecycleStrategy, Properties componentProperties, Object componentKey, Class<T> componentImplementation, Parameter... parameters) throws PicoCompositionException
PicoCompositionExceptionpublic static Properties createDelegateProprties(Object targetObject, String methodName, Object... parameters)
Example:
DelegateAdapterFactory factory = new DelegateAdapterFactory();
HttpServletRequest request = .....;
//When object is instantiated will lazily call: request.getSession(false);
Properties props = createDelegateProperties(request, "getSession", false);
DelegateMethodAdapter adapter = createComponentAdapter(new ConsoleComponentMonitor(), new DefaultLifecycleStrategy(),
props, HttpSession.class, HttpSession.class);
targetObject - the object to be operated on.methodName - the name of the method to invoke.parameters - the parameters to supply upon invocation. (Also used to find matching argument).public static <INSTANCE,RETURN_TYPE> DelegateMethod<INSTANCE,RETURN_TYPE> createDelegate(Class<INSTANCE> targetType, String methodName, Object... parameters)
INSTANCE - RETURN_TYPE - targetType - the type of object being instantiated.methodName - the method name to invoke when called.parameters - the method paramters to use.Copyright © 2003-2014 Codehaus. All Rights Reserved.