org.perfectjpattern.core.extras.delegate
Class Delegator<I>

java.lang.Object
  extended by org.perfectjpattern.core.extras.delegate.AbstractDelegator<I>
      extended by org.perfectjpattern.core.extras.delegate.Delegator<I>
Type Parameters:
I - Interface type built by this Delegator instance.
All Implemented Interfaces:
IDelegator<I>

public class Delegator<I>
extends AbstractDelegator<I>

Implementation of IDelegator interface for creating Delegate instances based user-defined interface types.

Notes: Base source code implemented by Steve Lewis and Wilhelm Fitzpatrick and adapted to fit PerfectJPattern componentization criteria and code conventions.

Version:
$Revision: 1.0 $ $Date: Jun 25, 2007 7:20:28 AM $
Author:
Steve Lewis, Wilhelm Fitzpatrick, Giovanni Azua
 

Nested Class Summary
 
Nested classes/interfaces inherited from class org.perfectjpattern.core.extras.delegate.AbstractDelegator
AbstractDelegator.DelegateProxy
 
Constructor Summary
Delegator(Class<I> anInterface)
          Creates a Delegator<E> from the type interface.
 
Method Summary
 I build(Class aTarget, String aMethodName)
          Returns Dynamic Proxy that implements the target generic parameter interface.
 I build(Object aTarget, String aMethodName)
          Returns Dynamic Proxy that implements the target generic parameter interface.
 
Methods inherited from class org.perfectjpattern.core.extras.delegate.AbstractDelegator
findMethod, findMethod, findMethod, getArguments, getReturn, isSuitableMethod, isValidReturn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Delegator

public Delegator(Class<I> anInterface)
Creates a Delegator<E> from the type interface.

Parameters:
anInterface - The interface to build references from.
Throws:
IllegalArgumentException - 'anInterface' must not be null.
IllegalArgumentException - 'anInterface' must be an interface type.
Method Detail

build

public I build(Class aTarget,
               String aMethodName)
        throws IllegalArgumentException,
               UnsupportedOperationException
Returns Dynamic Proxy that implements the target generic parameter interface. The implementing Dynamic Proxy executes the underlying method identified by Class type and Method name.

Parameters:
aTarget - non-null class with a bindable static method.
aMethodName - name of the static method.
Returns:
Dynamic proxy implementing the target generic interface.
Throws:
IllegalArgumentException - 'aTarget' must not be null.
UnsupportedOperationException - No suitable method found.

build

public I build(Object aTarget,
               String aMethodName)
        throws IllegalArgumentException,
               UnsupportedOperationException
Returns Dynamic Proxy that implements the target generic parameter interface. The implementing Dynamic Proxy executes the underlying method identified by Object instance and Method name.

Parameters:
aTarget - non-null target with a bindable method.
aMethodName - name of the method.
Returns:
Dynamic proxy implementing the target generic interface.
Throws:
IllegalArgumentException - 'aTarget' must not be null.
UnsupportedOperationException - No suitable method found.


Copyright © 2007-2009. All Rights Reserved.