Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.picocontainer.gems.adapters
Class DelegateAdaptorFactory

    java.lang.Object
      org.picocontainer.injectors.AbstractInjectionFactory
          org.picocontainer.gems.adapters.DelegateAdaptorFactory

All Implemented Interfaces:
  Serializable, org.picocontainer.ComponentFactory, org.picocontainer.InjectionFactory

    public class DelegateAdaptorFactory

extends org.picocontainer.injectors.AbstractInjectionFactory

Mirrored AdaptorFactory for handling delegate methods.

Author:
  Michael Rimov
See Also:
  Serialized Form

Constructor Summary
`DelegateAdaptorFactory()` Default constructor.

Method Summary
`
`<T> org.picocontainer.ComponentAdapter<T>`
` | `createComponentAdapter(org.picocontainer.ComponentMonitor componentMonitor, org.picocontainer.LifecycleStrategy lifecycleStrategy, Properties componentProperties, Object componentKey, Class<T> componentImplementation, org.picocontainer.Parameter... parameters)`
`static
`<INSTANCE,RETURN_TYPE> DelegateMethod<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.

Methods inherited from class org.picocontainer.injectors.AbstractInjectionFactory
`accept, verify`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DelegateAdaptorFactory

    public DelegateAdaptorFactory()

  Default constructor.

Method Detail

### createComponentAdapter

    public <T> org.picocontainer.ComponentAdapter<T> createComponentAdapter(org.picocontainer.ComponentMonitor componentMonitor,
                                                                            org.picocontainer.LifecycleStrategy lifecycleStrategy,
                                                                            Properties componentProperties,
                                                                            Object componentKey,
                                                                            Class<T> componentImplementation,
                                                                            org.picocontainer.Parameter... parameters)
                                                                 throws org.picocontainer.PicoCompositionException

  Throws:
    `org.picocontainer.PicoCompositionException`

### createDelegateProprties

    public 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.

  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);

  Parameters:
    `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).
  Returns:
    the appropriate properties that can be used with createComponentAdapter().

### createDelegate

    public static <INSTANCE,RETURN_TYPE> DelegateMethod<INSTANCE,RETURN_TYPE> createDelegate(Class<INSTANCE> targetType,
                                                                                             String methodName,
                                                                                             Object... parameters)

  Generic-friendly instantiation. If you have control of your own code, you can also just use the DelegateMethod constructors.

  Type Parameters:
    `INSTANCE` -
    `RETURN_TYPE` -
  Parameters:
    `targetType` - the type of object being instantiated.
    `methodName` - the method name to invoke when called.
    `parameters` - the method paramters to use.
  Returns:
    DelegateMethod instance.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2009 Codehaus. All Rights Reserved.