Renames Self to Request in ActionRequests
This commit is contained in:
parent
91464c7687
commit
df44754605
|
@ -28,7 +28,7 @@ import java.io.IOException;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public abstract class ActionRequest<Self extends ActionRequest<Self>> extends TransportRequest {
|
||||
public abstract class ActionRequest<Request extends ActionRequest<Request>> extends TransportRequest {
|
||||
|
||||
public ActionRequest() {
|
||||
super();
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.io.IOException;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class BroadcastRequest<Self extends BroadcastRequest<Self>> extends ActionRequest<Self> implements IndicesRequest.Replaceable {
|
||||
public class BroadcastRequest<Request extends BroadcastRequest<Request>> extends ActionRequest<Request> implements IndicesRequest.Replaceable {
|
||||
|
||||
protected String[] indices;
|
||||
private IndicesOptions indicesOptions = IndicesOptions.strictExpandOpenAndForbidClosed();
|
||||
|
@ -55,9 +55,9 @@ public class BroadcastRequest<Self extends BroadcastRequest<Self>> extends Actio
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public final Self indices(String... indices) {
|
||||
public final Request indices(String... indices) {
|
||||
this.indices = indices;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,9 +71,9 @@ public class BroadcastRequest<Self extends BroadcastRequest<Self>> extends Actio
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self indicesOptions(IndicesOptions indicesOptions) {
|
||||
public final Request indicesOptions(IndicesOptions indicesOptions) {
|
||||
this.indicesOptions = indicesOptions;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,7 @@ import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds;
|
|||
* Abstract class that allows to mark action requests that support acknowledgements.
|
||||
* Facilitates consistency across different api.
|
||||
*/
|
||||
public abstract class AcknowledgedRequest<Self extends MasterNodeRequest<Self>> extends MasterNodeRequest<Self> implements AckedRequest {
|
||||
public abstract class AcknowledgedRequest<Request extends MasterNodeRequest<Request>> extends MasterNodeRequest<Request> implements AckedRequest {
|
||||
|
||||
public static final TimeValue DEFAULT_ACK_TIMEOUT = timeValueSeconds(30);
|
||||
|
||||
|
@ -52,9 +52,9 @@ public abstract class AcknowledgedRequest<Self extends MasterNodeRequest<Self>>
|
|||
* @return the request itself
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self timeout(String timeout) {
|
||||
public final Request timeout(String timeout) {
|
||||
this.timeout = TimeValue.parseTimeValue(timeout, this.timeout, getClass().getSimpleName() + ".timeout");
|
||||
return (Self)this;
|
||||
return (Request)this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,9 +63,9 @@ public abstract class AcknowledgedRequest<Self extends MasterNodeRequest<Self>>
|
|||
* @return the request itself
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self timeout(TimeValue timeout) {
|
||||
public final Request timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,14 +27,14 @@ import java.io.IOException;
|
|||
/**
|
||||
* Base request for master based read operations that allows to read the cluster state from the local node if needed
|
||||
*/
|
||||
public abstract class MasterNodeReadRequest<Self extends MasterNodeReadRequest<Self>> extends MasterNodeRequest<Self> {
|
||||
public abstract class MasterNodeReadRequest<Request extends MasterNodeReadRequest<Request>> extends MasterNodeRequest<Request> {
|
||||
|
||||
protected boolean local = false;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self local(boolean local) {
|
||||
public final Request local(boolean local) {
|
||||
this.local = local;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
public final boolean local() {
|
||||
|
|
|
@ -29,7 +29,7 @@ import java.io.IOException;
|
|||
/**
|
||||
* A based request for master based operation.
|
||||
*/
|
||||
public abstract class MasterNodeRequest<Self extends MasterNodeRequest<Self>> extends ActionRequest<Self> {
|
||||
public abstract class MasterNodeRequest<Request extends MasterNodeRequest<Request>> extends ActionRequest<Request> {
|
||||
|
||||
public static final TimeValue DEFAULT_MASTER_NODE_TIMEOUT = TimeValue.timeValueSeconds(30);
|
||||
|
||||
|
@ -47,15 +47,15 @@ public abstract class MasterNodeRequest<Self extends MasterNodeRequest<Self>> ex
|
|||
* A timeout value in case the master has not been discovered yet or disconnected.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self masterNodeTimeout(TimeValue timeout) {
|
||||
public final Request masterNodeTimeout(TimeValue timeout) {
|
||||
this.masterNodeTimeout = timeout;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A timeout value in case the master has not been discovered yet or disconnected.
|
||||
*/
|
||||
public final Self masterNodeTimeout(String timeout) {
|
||||
public final Request masterNodeTimeout(String timeout) {
|
||||
return masterNodeTimeout(TimeValue.parseTimeValue(timeout, null, getClass().getSimpleName() + ".masterNodeTimeout"));
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import java.io.IOException;
|
|||
|
||||
/**
|
||||
*/
|
||||
public abstract class ClusterInfoRequest<Self extends ClusterInfoRequest<Self>> extends MasterNodeReadRequest<Self> implements IndicesRequest.Replaceable {
|
||||
public abstract class ClusterInfoRequest<Request extends ClusterInfoRequest<Request>> extends MasterNodeReadRequest<Request> implements IndicesRequest.Replaceable {
|
||||
|
||||
private String[] indices = Strings.EMPTY_ARRAY;
|
||||
private String[] types = Strings.EMPTY_ARRAY;
|
||||
|
@ -39,21 +39,21 @@ public abstract class ClusterInfoRequest<Self extends ClusterInfoRequest<Self>>
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Self indices(String... indices) {
|
||||
public Request indices(String... indices) {
|
||||
this.indices = indices;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Self types(String... types) {
|
||||
public Request types(String... types) {
|
||||
this.types = types;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Self indicesOptions(IndicesOptions indicesOptions) {
|
||||
public Request indicesOptions(IndicesOptions indicesOptions) {
|
||||
this.indicesOptions = indicesOptions;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.io.IOException;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public abstract class BaseNodesRequest<Self extends BaseNodesRequest<Self>> extends ActionRequest<Self> {
|
||||
public abstract class BaseNodesRequest<Request extends BaseNodesRequest<Request>> extends ActionRequest<Request> {
|
||||
|
||||
public static String[] ALL_NODES = Strings.EMPTY_ARRAY;
|
||||
|
||||
|
@ -57,9 +57,9 @@ public abstract class BaseNodesRequest<Self extends BaseNodesRequest<Self>> exte
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self nodesIds(String... nodesIds) {
|
||||
public final Request nodesIds(String... nodesIds) {
|
||||
this.nodesIds = nodesIds;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
public TimeValue timeout() {
|
||||
|
@ -67,15 +67,15 @@ public abstract class BaseNodesRequest<Self extends BaseNodesRequest<Self>> exte
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self timeout(TimeValue timeout) {
|
||||
public final Request timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self timeout(String timeout) {
|
||||
public final Request timeout(String timeout) {
|
||||
this.timeout = TimeValue.parseTimeValue(timeout, null, getClass().getSimpleName() + ".timeout");
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,7 +38,7 @@ import static org.elasticsearch.action.ValidateActions.addValidationError;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class ReplicationRequest<Self extends ReplicationRequest<Self>> extends ActionRequest<Self> implements IndicesRequest {
|
||||
public class ReplicationRequest<Request extends ReplicationRequest<Request>> extends ActionRequest<Request> implements IndicesRequest {
|
||||
|
||||
public static final TimeValue DEFAULT_TIMEOUT = new TimeValue(1, TimeUnit.MINUTES);
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class ReplicationRequest<Self extends ReplicationRequest<Self>> extends A
|
|||
/**
|
||||
* Copy constructor that creates a new request that is a copy of the one provided as an argument.
|
||||
*/
|
||||
protected ReplicationRequest(Self request) {
|
||||
protected ReplicationRequest(Request request) {
|
||||
this(request, request);
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class ReplicationRequest<Self extends ReplicationRequest<Self>> extends A
|
|||
* Copy constructor that creates a new request that is a copy of the one provided as an argument.
|
||||
* The new request will inherit though headers and context from the original request that caused it.
|
||||
*/
|
||||
protected ReplicationRequest(Self request, ActionRequest<?> originalRequest) {
|
||||
protected ReplicationRequest(Request request, ActionRequest<?> originalRequest) {
|
||||
super(originalRequest);
|
||||
this.timeout = request.timeout();
|
||||
this.index = request.index();
|
||||
|
@ -96,15 +96,15 @@ public class ReplicationRequest<Self extends ReplicationRequest<Self>> extends A
|
|||
* A timeout to wait if the index operation can't be performed immediately. Defaults to <tt>1m</tt>.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self timeout(TimeValue timeout) {
|
||||
public final Request timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A timeout to wait if the index operation can't be performed immediately. Defaults to <tt>1m</tt>.
|
||||
*/
|
||||
public final Self timeout(String timeout) {
|
||||
public final Request timeout(String timeout) {
|
||||
return timeout(TimeValue.parseTimeValue(timeout, null, getClass().getSimpleName() + ".timeout"));
|
||||
}
|
||||
|
||||
|
@ -117,9 +117,9 @@ public class ReplicationRequest<Self extends ReplicationRequest<Self>> extends A
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self index(String index) {
|
||||
public final Request index(String index) {
|
||||
this.index = index;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,9 +150,9 @@ public class ReplicationRequest<Self extends ReplicationRequest<Self>> extends A
|
|||
* Sets the consistency level of write. Defaults to {@link org.elasticsearch.action.WriteConsistencyLevel#DEFAULT}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self consistencyLevel(WriteConsistencyLevel consistencyLevel) {
|
||||
public final Request consistencyLevel(WriteConsistencyLevel consistencyLevel) {
|
||||
this.consistencyLevel = consistencyLevel;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -196,9 +196,9 @@ public class ReplicationRequest<Self extends ReplicationRequest<Self>> extends A
|
|||
* index/delete request is resolved by the transport action
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Self setShardId(ShardId shardId) {
|
||||
public Request setShardId(ShardId shardId) {
|
||||
this.shardId = shardId;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,8 @@ import java.util.concurrent.TimeUnit;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public abstract class InstanceShardOperationRequest<Self extends InstanceShardOperationRequest<Self>> extends ActionRequest<Self> implements IndicesRequest {
|
||||
public abstract class InstanceShardOperationRequest<Request extends InstanceShardOperationRequest<Request>> extends ActionRequest<Request>
|
||||
implements IndicesRequest {
|
||||
|
||||
public static final TimeValue DEFAULT_TIMEOUT = new TimeValue(1, TimeUnit.MINUTES);
|
||||
|
||||
|
@ -77,9 +78,9 @@ public abstract class InstanceShardOperationRequest<Self extends InstanceShardOp
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self index(String index) {
|
||||
public final Request index(String index) {
|
||||
this.index = index;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
public TimeValue timeout() {
|
||||
|
@ -90,15 +91,15 @@ public abstract class InstanceShardOperationRequest<Self extends InstanceShardOp
|
|||
* A timeout to wait if the index operation can't be performed immediately. Defaults to <tt>1m</tt>.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self timeout(TimeValue timeout) {
|
||||
public final Request timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A timeout to wait if the index operation can't be performed immediately. Defaults to <tt>1m</tt>.
|
||||
*/
|
||||
public final Self timeout(String timeout) {
|
||||
public final Request timeout(String timeout) {
|
||||
return timeout(TimeValue.parseTimeValue(timeout, null, getClass().getSimpleName() + ".timeout"));
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.io.IOException;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public abstract class SingleShardRequest<Self extends SingleShardRequest<Self>> extends ActionRequest<Self> implements IndicesRequest {
|
||||
public abstract class SingleShardRequest<Request extends SingleShardRequest<Request>> extends ActionRequest<Request> implements IndicesRequest {
|
||||
|
||||
public static final IndicesOptions INDICES_OPTIONS = IndicesOptions.strictSingleIndexNoExpandForbidClosed();
|
||||
|
||||
|
@ -91,9 +91,9 @@ public abstract class SingleShardRequest<Self extends SingleShardRequest<Self>>
|
|||
* Sets the index.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self index(String index) {
|
||||
public final Request index(String index) {
|
||||
this.index = index;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -117,9 +117,9 @@ public abstract class SingleShardRequest<Self extends SingleShardRequest<Self>>
|
|||
* Controls if the operation will be executed on a separate thread when executed locally.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self operationThreaded(boolean threadedOperation) {
|
||||
public final Request operationThreaded(boolean threadedOperation) {
|
||||
this.threadedOperation = threadedOperation;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.io.IOException;
|
|||
/**
|
||||
* A base class for task requests
|
||||
*/
|
||||
public class BaseTasksRequest<Self extends BaseTasksRequest<Self>> extends ActionRequest<Self> {
|
||||
public class BaseTasksRequest<Request extends BaseTasksRequest<Request>> extends ActionRequest<Request> {
|
||||
|
||||
|
||||
public static final String[] ALL_ACTIONS = Strings.EMPTY_ARRAY;
|
||||
|
@ -82,9 +82,9 @@ public class BaseTasksRequest<Self extends BaseTasksRequest<Self>> extends Actio
|
|||
* Sets the list of action masks for the actions that should be returned
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self actions(String... actions) {
|
||||
public final Request actions(String... actions) {
|
||||
this.actions = actions;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -99,9 +99,9 @@ public class BaseTasksRequest<Self extends BaseTasksRequest<Self>> extends Actio
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self nodesIds(String... nodesIds) {
|
||||
public final Request nodesIds(String... nodesIds) {
|
||||
this.nodesIds = nodesIds;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,9 +112,9 @@ public class BaseTasksRequest<Self extends BaseTasksRequest<Self>> extends Actio
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Self parentNode(String parentNode) {
|
||||
public Request parentNode(String parentNode) {
|
||||
this.parentNode = parentNode;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -125,9 +125,9 @@ public class BaseTasksRequest<Self extends BaseTasksRequest<Self>> extends Actio
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Self parentTaskId(long parentTaskId) {
|
||||
public Request parentTaskId(long parentTaskId) {
|
||||
this.parentTaskId = parentTaskId;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,15 +136,15 @@ public class BaseTasksRequest<Self extends BaseTasksRequest<Self>> extends Actio
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self timeout(TimeValue timeout) {
|
||||
public final Request timeout(TimeValue timeout) {
|
||||
this.timeout = timeout;
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Self timeout(String timeout) {
|
||||
public final Request timeout(String timeout) {
|
||||
this.timeout = TimeValue.parseTimeValue(timeout, null, getClass().getSimpleName() + ".timeout");
|
||||
return (Self) this;
|
||||
return (Request) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue