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

dk.rode.thesis.state
Class Handler

java.lang.Object
  extended by dk.rode.thesis.state.Handler
All Implemented Interfaces:
InvocationHandler

 class Handler
extends Object
implements InvocationHandler

The handler class is used to perform the actual state change when the step sequence value goes from even to odd or vice versa.

Author:
Gunni Rode / rode.dk
See Also:
StepSequence.Factory.create(int, int)

Field Summary
private  StepSequenceImpl sequence
          The current sequence target.
 
Constructor Summary
Handler(int step, int value)
          Constructor.
 
Method Summary
 Object invoke(Object proxy, Method method, Object[] args)
           
 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

sequence

private StepSequenceImpl sequence
The current sequence target.

This represents the current state.

Never null.

Constructor Detail

Handler

Handler(int step,
        int value)
Constructor.

Parameters:
step - The step; cannot be zero.
value - The initial sequence value.
Throws:
IllegalArgumentException - If step is zero.
Method Detail

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              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.