Skip to content

Commit d5ccc68

Browse files
👕 fix check style
1 parent c6497ed commit d5ccc68

File tree

4 files changed

+37
-36
lines changed

4 files changed

+37
-36
lines changed

core/src/test/java/com/ibm/watson/developer_cloud/util/WaitFor.java

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
1111
* specific language governing permissions and limitations under the License.
1212
*/
13-
1413
package com.ibm.watson.developer_cloud.util;
1514

1615
import java.util.concurrent.TimeUnit;
@@ -21,43 +20,42 @@
2120
*/
2221

2322
public class WaitFor {
24-
/**
25-
* Static method used to wait for a specific condition to be satisfied.
26-
*
27-
* @param condition
28-
* The condition to check
29-
* @param time
30-
* The maximum time to wait for the condition to become true
31-
* @param unit
32-
* The time unit of the {@code time} argument
33-
* @param sleepMs
34-
* The time to wait between checks
35-
*
36-
* @return true if the condition was true before the timeout, false if it wasn't.
37-
*/
38-
public static boolean waitFor(Condition condition, long time, TimeUnit unit, long sleepMs) {
39-
long waitMs = unit.toMillis(time);
40-
long startMs = System.currentTimeMillis();
41-
while (System.currentTimeMillis() - startMs < waitMs) {
42-
if (condition.isSatisfied()) {
43-
return true;
44-
}
45-
try {
46-
Thread.sleep(sleepMs);
47-
} catch (InterruptedException e) {
48-
throw new RuntimeException("WaitFor aborted", e);
49-
}
50-
}
51-
return false;
23+
24+
private WaitFor() {}
25+
26+
/**
27+
* Static method used to wait for a specific condition to be satisfied.
28+
*
29+
* @param condition The condition to check
30+
* @param time The maximum time to wait for the condition to become true
31+
* @param unit The time unit of the {@code time} argument
32+
* @param sleepMs The time to wait between checks
33+
*
34+
* @return true if the condition was true before the timeout, false if it wasn't.
35+
*/
36+
public static boolean waitFor(Condition condition, long time, TimeUnit unit, long sleepMs) {
37+
long waitMs = unit.toMillis(time);
38+
long startMs = System.currentTimeMillis();
39+
while (System.currentTimeMillis() - startMs < waitMs) {
40+
if (condition.isSatisfied()) {
41+
return true;
42+
}
43+
try {
44+
Thread.sleep(sleepMs);
45+
} catch (InterruptedException e) {
46+
throw new RuntimeException("WaitFor aborted", e);
47+
}
5248
}
49+
return false;
50+
}
5351

52+
/**
53+
* The Interface Condition.
54+
*/
55+
public interface Condition {
5456
/**
55-
* The Interface Condition.
57+
* @return true/false indicating whether or not the condition has been met.
5658
*/
57-
public interface Condition {
58-
/**
59-
* @return true/false indicating whether or not the condition has been met.
60-
*/
61-
boolean isSatisfied();
62-
}
59+
boolean isSatisfied();
60+
}
6361
}

discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/collection/field/FieldAdapterFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* Override default enum handling for poorly formed JSON field types schema.
2828
*/
2929
public class FieldAdapterFactory implements TypeAdapterFactory {
30+
@SuppressWarnings("unchecked")
3031
@Override
3132
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
3233
if (!Field.class.isAssignableFrom(typeToken.getRawType())) {

discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/common/EagerNumberAdapterFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* Override the default {@link LazilyParsedNumber} for parsing {@link Number}s.
3131
*/
3232
public class EagerNumberAdapterFactory implements TypeAdapterFactory {
33+
@SuppressWarnings("unchecked")
3334
@Override
3435
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
3536
if (!Number.class.isAssignableFrom(typeToken.getRawType())) {

discovery/src/main/java/com/ibm/watson/developer_cloud/discovery/v1/model/query/AggregationAdapterFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* Adapts the abstract {@link Aggregation} to its concrete implementations.
2929
*/
3030
public class AggregationAdapterFactory implements TypeAdapterFactory {
31+
@SuppressWarnings("unchecked")
3132
@Override
3233
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
3334
if (typeToken.getRawType() != Aggregation.class) {

0 commit comments

Comments
 (0)