Skip to content

Commit cc83c2f

Browse files
dadoonetimotov
authored andcommitted
refactoring getter/setters
Fixes #2657
1 parent ac2e6a3 commit cc83c2f

File tree

460 files changed

+6588
-8239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

460 files changed

+6588
-8239
lines changed

src/main/java/org/elasticsearch/action/ActionRequest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ protected ActionRequest(ActionRequest request) {
4949
* <p>When not executing on a thread, it will either be executed on the calling thread, or
5050
* on an expensive, IO based, thread.
5151
*/
52-
public final boolean listenerThreaded() {
52+
public final boolean isListenerThreaded() {
5353
return this.listenerThreaded;
5454
}
5555

5656
/**
5757
* Sets if the response listener be executed on a thread or not.
5858
*/
5959
@SuppressWarnings("unchecked")
60-
public final T listenerThreaded(boolean listenerThreaded) {
60+
public final T setListenerThreaded(boolean listenerThreaded) {
6161
this.listenerThreaded = listenerThreaded;
6262
return (T) this;
6363
}

src/main/java/org/elasticsearch/action/ActionRequestBuilder.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public Request request() {
4242

4343
@SuppressWarnings("unchecked")
4444
public final RequestBuilder setListenerThreaded(boolean listenerThreaded) {
45-
request.listenerThreaded(listenerThreaded);
45+
request.setListenerThreaded(listenerThreaded);
4646
return (RequestBuilder) this;
4747
}
4848

@@ -53,7 +53,7 @@ public final RequestBuilder putHeader(String key, Object value) {
5353
}
5454

5555
public ListenableActionFuture<Response> execute() {
56-
PlainListenableActionFuture<Response> future = new PlainListenableActionFuture<Response>(request.listenerThreaded(), client.threadPool());
56+
PlainListenableActionFuture<Response> future = new PlainListenableActionFuture<Response>(request.isListenerThreaded(), client.threadPool());
5757
execute(future);
5858
return future;
5959
}

src/main/java/org/elasticsearch/action/TransportActionNodeProxy.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public TransportActionNodeProxy(Settings settings, GenericAction<Request, Respon
5454

5555
public ActionFuture<Response> execute(DiscoveryNode node, Request request) throws ElasticSearchException {
5656
PlainActionFuture<Response> future = newFuture();
57-
request.listenerThreaded(false);
57+
request.setListenerThreaded(false);
5858
execute(node, request, future);
5959
return future;
6060
}
@@ -68,7 +68,7 @@ public Response newInstance() {
6868

6969
@Override
7070
public String executor() {
71-
if (request.listenerThreaded()) {
71+
if (request.isListenerThreaded()) {
7272
return ThreadPool.Names.GENERIC;
7373
}
7474
return ThreadPool.Names.SAME;

src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java

+20-20
Original file line numberDiff line numberDiff line change
@@ -57,84 +57,84 @@ public ClusterHealthRequest(String... indices) {
5757
this.indices = indices;
5858
}
5959

60-
public String[] indices() {
60+
public String[] getIndices() {
6161
return indices;
6262
}
6363

64-
public ClusterHealthRequest indices(String[] indices) {
64+
public ClusterHealthRequest setIndices(String[] indices) {
6565
this.indices = indices;
6666
return this;
6767
}
6868

69-
public TimeValue timeout() {
69+
public TimeValue getTimeout() {
7070
return timeout;
7171
}
7272

73-
public ClusterHealthRequest timeout(TimeValue timeout) {
73+
public ClusterHealthRequest setTimeout(TimeValue timeout) {
7474
this.timeout = timeout;
7575
if (masterNodeTimeout == DEFAULT_MASTER_NODE_TIMEOUT) {
7676
masterNodeTimeout = timeout;
7777
}
7878
return this;
7979
}
8080

81-
public ClusterHealthRequest timeout(String timeout) {
82-
return timeout(TimeValue.parseTimeValue(timeout, null));
81+
public ClusterHealthRequest setTimeout(String timeout) {
82+
return setTimeout(TimeValue.parseTimeValue(timeout, null));
8383
}
8484

85-
public ClusterHealthStatus waitForStatus() {
85+
public ClusterHealthStatus getWaitForStatus() {
8686
return waitForStatus;
8787
}
8888

89-
public ClusterHealthRequest waitForStatus(ClusterHealthStatus waitForStatus) {
89+
public ClusterHealthRequest setWaitForStatus(ClusterHealthStatus waitForStatus) {
9090
this.waitForStatus = waitForStatus;
9191
return this;
9292
}
9393

94-
public ClusterHealthRequest waitForGreenStatus() {
95-
return waitForStatus(ClusterHealthStatus.GREEN);
94+
public ClusterHealthRequest setWaitForGreenStatus() {
95+
return setWaitForStatus(ClusterHealthStatus.GREEN);
9696
}
9797

98-
public ClusterHealthRequest waitForYellowStatus() {
99-
return waitForStatus(ClusterHealthStatus.YELLOW);
98+
public ClusterHealthRequest setWaitForYellowStatus() {
99+
return setWaitForStatus(ClusterHealthStatus.YELLOW);
100100
}
101101

102-
public int waitForRelocatingShards() {
102+
public int getWaitForRelocatingShards() {
103103
return waitForRelocatingShards;
104104
}
105105

106-
public ClusterHealthRequest waitForRelocatingShards(int waitForRelocatingShards) {
106+
public ClusterHealthRequest setWaitForRelocatingShards(int waitForRelocatingShards) {
107107
this.waitForRelocatingShards = waitForRelocatingShards;
108108
return this;
109109
}
110110

111-
public int waitForActiveShards() {
111+
public int getWaitForActiveShards() {
112112
return waitForActiveShards;
113113
}
114114

115-
public ClusterHealthRequest waitForActiveShards(int waitForActiveShards) {
115+
public ClusterHealthRequest setWaitForActiveShards(int waitForActiveShards) {
116116
this.waitForActiveShards = waitForActiveShards;
117117
return this;
118118
}
119119

120-
public String waitForNodes() {
120+
public String getWaitForNodes() {
121121
return waitForNodes;
122122
}
123123

124124
/**
125125
* Waits for N number of nodes. Use "12" for exact mapping, ">12" and "<12" for range.
126126
*/
127-
public ClusterHealthRequest waitForNodes(String waitForNodes) {
127+
public ClusterHealthRequest setWaitForNodes(String waitForNodes) {
128128
this.waitForNodes = waitForNodes;
129129
return this;
130130
}
131131

132-
public ClusterHealthRequest local(boolean local) {
132+
public ClusterHealthRequest setLocal(boolean local) {
133133
this.local = local;
134134
return this;
135135
}
136136

137-
public boolean local() {
137+
public boolean getLocal() {
138138
return this.local;
139139
}
140140

src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequestBuilder.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -35,50 +35,50 @@ public ClusterHealthRequestBuilder(ClusterAdminClient clusterClient) {
3535
}
3636

3737
public ClusterHealthRequestBuilder setIndices(String... indices) {
38-
request.indices(indices);
38+
request.setIndices(indices);
3939
return this;
4040
}
4141

4242
public ClusterHealthRequestBuilder setTimeout(TimeValue timeout) {
43-
request.timeout(timeout);
43+
request.setTimeout(timeout);
4444
return this;
4545
}
4646

4747
public ClusterHealthRequestBuilder setTimeout(String timeout) {
48-
request.timeout(timeout);
48+
request.setTimeout(timeout);
4949
return this;
5050
}
5151

5252
public ClusterHealthRequestBuilder setWaitForStatus(ClusterHealthStatus waitForStatus) {
53-
request.waitForStatus(waitForStatus);
53+
request.setWaitForStatus(waitForStatus);
5454
return this;
5555
}
5656

5757
public ClusterHealthRequestBuilder setWaitForGreenStatus() {
58-
request.waitForGreenStatus();
58+
request.setWaitForGreenStatus();
5959
return this;
6060
}
6161

6262
public ClusterHealthRequestBuilder setWaitForYellowStatus() {
63-
request.waitForYellowStatus();
63+
request.setWaitForYellowStatus();
6464
return this;
6565
}
6666

6767
public ClusterHealthRequestBuilder setWaitForRelocatingShards(int waitForRelocatingShards) {
68-
request.waitForRelocatingShards(waitForRelocatingShards);
68+
request.setWaitForRelocatingShards(waitForRelocatingShards);
6969
return this;
7070
}
7171

7272
public ClusterHealthRequestBuilder setWaitForActiveShards(int waitForActiveShards) {
73-
request.waitForActiveShards(waitForActiveShards);
73+
request.setWaitForActiveShards(waitForActiveShards);
7474
return this;
7575
}
7676

7777
/**
7878
* Waits for N number of nodes. Use "12" for exact mapping, ">12" and "<12" for range.
7979
*/
8080
public ClusterHealthRequestBuilder setWaitForNodes(String waitForNodes) {
81-
request.waitForNodes(waitForNodes);
81+
request.setWaitForNodes(waitForNodes);
8282
return this;
8383
}
8484

src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java

+16-75
Original file line numberDiff line numberDiff line change
@@ -59,128 +59,69 @@ public ClusterHealthResponse(String clusterName, List<String> validationFailures
5959
this.validationFailures = validationFailures;
6060
}
6161

62-
public String clusterName() {
63-
return clusterName;
64-
}
65-
6662
public String getClusterName() {
67-
return clusterName();
68-
}
69-
70-
/**
71-
* The validation failures on the cluster level (without index validation failures).
72-
*/
73-
public List<String> validationFailures() {
74-
return this.validationFailures;
63+
return clusterName;
7564
}
7665

7766
/**
7867
* The validation failures on the cluster level (without index validation failures).
7968
*/
8069
public List<String> getValidationFailures() {
81-
return validationFailures();
70+
return this.validationFailures;
8271
}
8372

8473
/**
8574
* All the validation failures, including index level validation failures.
8675
*/
87-
public List<String> allValidationFailures() {
88-
List<String> allFailures = newArrayList(validationFailures());
76+
public List<String> getAllValidationFailures() {
77+
List<String> allFailures = newArrayList(getValidationFailures());
8978
for (ClusterIndexHealth indexHealth : indices.values()) {
90-
allFailures.addAll(indexHealth.validationFailures());
79+
allFailures.addAll(indexHealth.getValidationFailures());
9180
}
9281
return allFailures;
9382
}
9483

95-
/**
96-
* All the validation failures, including index level validation failures.
97-
*/
98-
public List<String> getAllValidationFailures() {
99-
return allValidationFailures();
100-
}
101-
102-
103-
public int activeShards() {
104-
return activeShards;
105-
}
106-
10784
public int getActiveShards() {
108-
return activeShards();
109-
}
110-
111-
public int relocatingShards() {
112-
return relocatingShards;
85+
return activeShards;
11386
}
11487

11588
public int getRelocatingShards() {
116-
return relocatingShards();
117-
}
118-
119-
public int activePrimaryShards() {
120-
return activePrimaryShards;
89+
return relocatingShards;
12190
}
12291

12392
public int getActivePrimaryShards() {
124-
return activePrimaryShards();
125-
}
126-
127-
public int initializingShards() {
128-
return initializingShards;
93+
return activePrimaryShards;
12994
}
13095

13196
public int getInitializingShards() {
132-
return initializingShards();
133-
}
134-
135-
public int unassignedShards() {
136-
return unassignedShards;
97+
return initializingShards;
13798
}
13899

139100
public int getUnassignedShards() {
140-
return unassignedShards();
141-
}
142-
143-
public int numberOfNodes() {
144-
return this.numberOfNodes;
101+
return unassignedShards;
145102
}
146103

147104
public int getNumberOfNodes() {
148-
return numberOfNodes();
149-
}
150-
151-
public int numberOfDataNodes() {
152-
return this.numberOfDataNodes;
105+
return this.numberOfNodes;
153106
}
154107

155108
public int getNumberOfDataNodes() {
156-
return numberOfDataNodes();
109+
return this.numberOfDataNodes;
157110
}
158111

159112
/**
160113
* <tt>true</tt> if the waitForXXX has timeout out and did not match.
161114
*/
162-
public boolean timedOut() {
163-
return this.timedOut;
164-
}
165-
166115
public boolean isTimedOut() {
167-
return this.timedOut();
168-
}
169-
170-
public ClusterHealthStatus status() {
171-
return status;
116+
return this.timedOut;
172117
}
173118

174119
public ClusterHealthStatus getStatus() {
175-
return status();
176-
}
177-
178-
public Map<String, ClusterIndexHealth> indices() {
179-
return indices;
120+
return status;
180121
}
181122

182123
public Map<String, ClusterIndexHealth> getIndices() {
183-
return indices();
124+
return indices;
184125
}
185126

186127
@Override
@@ -203,7 +144,7 @@ public void readFrom(StreamInput in) throws IOException {
203144
int size = in.readVInt();
204145
for (int i = 0; i < size; i++) {
205146
ClusterIndexHealth indexHealth = readClusterIndexHealth(in);
206-
indices.put(indexHealth.index(), indexHealth);
147+
indices.put(indexHealth.getIndex(), indexHealth);
207148
}
208149
timedOut = in.readBoolean();
209150
size = in.readVInt();

0 commit comments

Comments
 (0)