Added utility class, ForwardingServerListener, that forwards calls to

underlying ServerCall.Listener.

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=85910420
This commit is contained in:
nabeelmian 2015-02-09 11:45:17 -08:00 committed by Eric Anderson
parent 8aa79b39fc
commit d2e35b0d02
1 changed files with 32 additions and 0 deletions

View File

@ -169,4 +169,36 @@ public class ServerInterceptors {
return delegate.isCancelled();
}
}
/**
* Utility base class for decorating {@link ServerCall.Listener} instances.
*/
public static class ForwardingListener<RespT> extends ServerCall.Listener<RespT> {
private final ServerCall.Listener<RespT> delegate;
public ForwardingListener(ServerCall.Listener<RespT> delegate) {
this.delegate = delegate;
}
@Override
public void onPayload(RespT payload) {
delegate.onPayload(payload);
}
@Override
public void onHalfClose() {
delegate.onHalfClose();
}
@Override
public void onCancel() {
delegate.onCancel();
}
@Override
public void onComplete() {
delegate.onComplete();
}
}
}