mrcode.duckprxy.impl
Class DuckPrxyImpl

java.lang.Object
  extended by mrcode.duckprxy.impl.DuckPrxyImpl
All Implemented Interfaces:
DuckPrxy

public class DuckPrxyImpl
extends java.lang.Object
implements DuckPrxy

A (more or less) simple implementation of DuckProxy that uses java reflections. How to delegate is mostly determined when a method is called.

Author:
Christian Haselbach

Constructor Summary
DuckPrxyImpl()
           
 
Method Summary
<T> T
makeProxy(java.lang.Class<T> mainInterface, java.lang.Object delegate, java.lang.Class<?>... interfaces)
          Creates an object that implements the defined interfaces delegating to a given object, mainly using duck typing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DuckPrxyImpl

public DuckPrxyImpl()
Method Detail

makeProxy

public <T> T makeProxy(java.lang.Class<T> mainInterface,
                       java.lang.Object delegate,
                       java.lang.Class<?>... interfaces)
Description copied from interface: DuckPrxy
Creates an object that implements the defined interfaces delegating to a given object, mainly using duck typing.

Specified by:
makeProxy in interface DuckPrxy
Type Parameters:
T - The class of the main interface.
Parameters:
mainInterface - The main interface that the resulting object shall implement.
delegate - The object to delegate the calls to.
interfaces - Secondary interfaces to implement.
Returns:
An object implementing the main interface and secondary interfaces, delegating to the delegate object.


Copyright © 2008. All Rights Reserved.