de.unikassel.android.sdcframework.util
Class AbstractChainWorker<T>

Package class diagram package AbstractChainWorker
java.lang.Object
  extended by de.unikassel.android.sdcframework.util.AbstractChainWorker<T>
Type Parameters:
T - the workers client type
All Implemented Interfaces:
ChainWorker<T>
Direct Known Subclasses:
AbstractConnectionStrategy, AbstractDatabaseFullStrategy

public abstract class AbstractChainWorker<T>
extends Object
implements ChainWorker<T>

Generic abstract Implementation of the "Chain of Responsibility" pattern..

Extending classes have to implement the process(Object) method and can override the doWork(Object) method if necessary.


Field Summary
private  ChainWorker<T> successor
          The successor
 
Constructor Summary
AbstractChainWorker()
          Constructor
 
Method Summary
 boolean doWork(T client)
          The work method called by the client
 ChainWorker<T> getSuccessor()
          The getter for the successor
protected abstract  boolean process(T client)
          Processing method of the worker
 void setSuccessor(ChainWorker<T> successor)
          The setter for the successor
 ChainWorker<T> withSuccessor(ChainWorker<T> successor)
          A setter for the successor returning a reference to successor set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

successor

private ChainWorker<T> successor
The successor

Constructor Detail

AbstractChainWorker

public AbstractChainWorker()
Constructor

Method Detail

doWork

public boolean doWork(T client)
Description copied from interface: ChainWorker
The work method called by the client

Specified by:
doWork in interface ChainWorker<T>
Parameters:
client - the client to do the work for
Returns:
true if successful, false otherwise

process

protected abstract boolean process(T client)
Processing method of the worker

Parameters:
client - the client
Returns:
true if successful

getSuccessor

public final ChainWorker<T> getSuccessor()
Description copied from interface: ChainWorker
The getter for the successor

Specified by:
getSuccessor in interface ChainWorker<T>
Returns:
the successor

setSuccessor

public final void setSuccessor(ChainWorker<T> successor)
Description copied from interface: ChainWorker
The setter for the successor

Specified by:
setSuccessor in interface ChainWorker<T>
Parameters:
successor - the successor to set

withSuccessor

public final ChainWorker<T> withSuccessor(ChainWorker<T> successor)
Description copied from interface: ChainWorker
A setter for the successor returning a reference to successor set

Specified by:
withSuccessor in interface ChainWorker<T>
Parameters:
successor - the successor to set
Returns:
a reference to the successor set