jcommon.extract.ResourceCallbackChain Maven / Gradle / Ivy
package jcommon.extract;
/**
* Implements {@link IResourceCallback} and provides genericized parameters
* for convencience.
*
* @author David Hoyt
*/
public abstract class ResourceCallbackChain implements IResourceCallback {
//
private T param;
private IResourceCallback chainedCallback;
//
//
public ResourceCallbackChain(final IResourceCallback ChainedCallback) {
init(ChainedCallback, null);
}
public ResourceCallbackChain(final IResourceCallback ChainedCallback, T Parameter) {
init(ChainedCallback, Parameter);
}
private void init(final IResourceCallback ChainedCallback, final T Parameter) {
this.param = Parameter;
this.chainedCallback = ChainedCallback;
}
//
//
public T getParameter() {
return param;
}
public IResourceCallback getChainedCallback() {
return chainedCallback;
}
//
//
@Override
public void error(Resources resources) {
error(resources, param);
if (chainedCallback != null)
chainedCallback.error(resources);
}
@Override
public void prepare(Resources resources) {
prepare(resources, param);
if (chainedCallback != null)
chainedCallback.prepare(resources);
}
@Override
public void cancelled(Resources resources) {
cancelled(resources, param);
if (chainedCallback != null)
chainedCallback.cancelled(resources);
}
@Override
public void completed(Resources resources) {
completed(resources, param);
if (chainedCallback != null)
chainedCallback.completed(resources);
}
//
//
protected void error(Resources resources, T param) {
}
protected void prepare(Resources resources, T param) {
}
protected void cancelled(Resources resources, T param) {
}
//
//
protected abstract void completed(Resources resources, T param);
//
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy