Evaluating Software Design Patterns
— the "Gang of Four" patterns implemented in Java 6

dk.rode.thesis.meta.reflect.proxy
Class ReferenceInvocationHandler

java.lang.Object
  extended by dk.rode.thesis.meta.reflect.proxy.ReferenceInvocationHandler
All Implemented Interfaces:
InvocationHandler

public class ReferenceInvocationHandler
extends Object
implements InvocationHandler

A reference invocation handler is an invocation handler that has support for referenced objects.

Author:
Gunni Rode / rode.dk
See Also:
Reference, ProxyFactory.getSharedObject(Object, String, Class[], String...)

Field Summary
private  Reference<?> reference
          The reference currently used by this handler.
 
Constructor Summary
ReferenceInvocationHandler(Reference<?> reference)
          Constructor, which creates this handler.
 
Method Summary
 Object invoke(Object proxy, Method method, Object[] arguments)
           
 String toString()
          Returns the string representation of this handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

reference

private Reference<?> reference
The reference currently used by this handler.

Never null.

Constructor Detail

ReferenceInvocationHandler

public ReferenceInvocationHandler(Reference<?> reference)
Constructor, which creates this handler.

Parameters:
reference - The original reference to use; cannot be null.
Throws:
NullPointerException - If reference is null.
Method Detail

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] arguments)
              throws Throwable
Specified by:
invoke in interface InvocationHandler
Throws:
Throwable

toString

public String toString()
Returns the string representation of this handler.

Overrides:
toString in class Object
Returns:
The string representation; never null.

Gunni Rode / rode.dk

Feel free to use and/or modify the Java 6 source code developed for this thesis AT YOUR OWN RISK, but note that the source code comes WITHOUT ANY — and I do mean WITHOUT ANY — form of warranty WHAT SO EVER!

The original thesis and source code are available at rode.dk/thesis.