|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.progeeks.util.DelegateInvocationHandler
public abstract class DelegateInvocationHandler
Adapts an interface or set of interfaces to a delegate object allowing interception of specific methods for local handling. This is useful for cases where interface implementations are too numerous or are unknown until runtime but it is still desirable to override specific methods on those implementations. Right now, the delegate object must implement the same interfaces that this proxy does but that may be relaxed in the future to make this class more like AdapterInvocationHandler in that respect. This class is abstract because it must be subclassed to provide the specific method overrides for the delegate object.
Constructor Summary | |
---|---|
protected |
DelegateInvocationHandler(java.lang.Object delegate)
Creates a new dynamic proxy that will pass methods defined in any public interface for the delegate to any methods defined on this local implementation but will otherwise pass all methods on to the delegate. |
protected |
DelegateInvocationHandler(java.lang.Object delegate,
java.lang.Class[] interfaces)
Creates a new dynamic proxy that will pass methods defined in the specified interfaces to any methods defined on this local implementation but will otherwise pass all methods on to the delegate. |
Method Summary | |
---|---|
protected java.lang.Object |
getDelegate()
|
protected java.lang.Class[] |
getMappedInterfaces()
|
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
static void |
main(java.lang.String[] args)
|
static java.lang.Object |
newProxy(java.lang.ClassLoader loader,
DelegateInvocationHandler handler)
Creates a new dynamic proxy that implements the interfaces defined in the handler and passes the method calls directly to the specified DelegateInvocationHandler instance. |
static java.lang.Object |
newProxy(DelegateInvocationHandler handler)
Creates a new dynamic proxy that implements the interfaces defined in the handler and passes the method calls directly to the specified DelegateInvocationHandler instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DelegateInvocationHandler(java.lang.Object delegate, java.lang.Class[] interfaces)
protected DelegateInvocationHandler(java.lang.Object delegate)
Method Detail |
---|
protected java.lang.Object getDelegate()
protected java.lang.Class[] getMappedInterfaces()
public static java.lang.Object newProxy(DelegateInvocationHandler handler)
public static java.lang.Object newProxy(java.lang.ClassLoader loader, DelegateInvocationHandler handler)
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |