com.fasterxml.clustermate.client.operation.GetOperationResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clustermate-client Show documentation
Show all versions of clustermate-client Show documentation
Building blocks for client libraries that access
ClusterMate-based service.
package com.fasterxml.clustermate.client.operation;
import com.fasterxml.clustermate.client.ClusterServerNode;
import com.fasterxml.clustermate.client.call.GetContentProcessor;
/**
* {@link OperationResult} subtype used with GET operations, adds actual
* result (of type T
which is type of {@link GetContentProcessor}
* passed to call).
*
* @param Result type of {@link GetContentProcessor}
*/
public class GetOperationResult extends ReadOperationResult>
{
/**
* Actual contents successfully fetched, if any.
*/
protected T _contents;
public GetOperationResult(OperationConfig config) {
super(config);
}
public GetOperationResult setContents(ClusterServerNode server, T contents)
{
if (server == null) {
throw new IllegalArgumentException("Should not set null server");
}
if (_server != null) {
throw new IllegalStateException("Already received successful response from "+_server+"; trying to override with "+server);
}
_server = server;
_contents = contents;
return this;
}
// // // Extended API
public T getContents() { return _contents; }
}