Skip to content

Commit aeb8851

Browse files
committed
Polish ternary expressions
1 parent b24bb68 commit aeb8851

File tree

49 files changed

+59
-60
lines changed

Some content is hidden

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

49 files changed

+59
-60
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpoint.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public MessageAndCondition(ConditionAndOutcome conditionAndOutcome) {
209209
this.message = outcome.getMessage();
210210
}
211211
else {
212-
this.message = (outcome.isMatch() ? "matched" : "did not match");
212+
this.message = outcome.isMatch() ? "matched" : "did not match";
213213
}
214214
}
215215

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/PropertiesMeterFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public PropertiesMeterFilter(MetricsProperties properties) {
5151
@Override
5252
public MeterFilterReply accept(Meter.Id id) {
5353
boolean enabled = lookup(this.properties.getEnable(), id, true);
54-
return (enabled ? MeterFilterReply.NEUTRAL : MeterFilterReply.DENY);
54+
return enabled ? MeterFilterReply.NEUTRAL : MeterFilterReply.DENY;
5555
}
5656

5757
@Override

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ private void addOperations(MultiValueMap<OperationKey, O> indexed, String id,
224224
}
225225

226226
private <T> T getLast(List<T> list) {
227-
return (CollectionUtils.isEmpty(list) ? null : list.get(list.size() - 1));
227+
return CollectionUtils.isEmpty(list) ? null : list.get(list.size() - 1);
228228
}
229229

230230
private void assertNoDuplicateOperations(EndpointBean endpointBean,

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private void register(ServletContext servletContext,
6161
ExposableServletEndpoint endpoint) {
6262
String name = endpoint.getId() + "-actuator-endpoint";
6363
String path = this.basePath + "/" + endpoint.getRootPath();
64-
String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*");
64+
String urlMapping = path.endsWith("/") ? path + "*" : path + "/*";
6565
EndpointServlet endpointServlet = endpoint.getEndpointServlet();
6666
Dynamic registration = servletContext.addServlet(name,
6767
endpointServlet.getServlet());

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/jersey/JerseyEndpointResourceFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private Map<String, Object> extract(
188188
private Response convertToJaxRsResponse(Object response, String httpMethod) {
189189
if (response == null) {
190190
boolean isGet = HttpMethod.GET.equals(httpMethod);
191-
Status status = (isGet ? Status.NOT_FOUND : Status.NO_CONTENT);
191+
Status status = isGet ? Status.NOT_FOUND : Status.NO_CONTENT;
192192
return Response.status(status).build();
193193
}
194194
try {

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/MetricsEndpoint.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private void mergeMeasurements(Map<Statistic, Double> samples, Meter meter) {
132132
}
133133

134134
private BiFunction<Double, Double, Double> mergeFunction(Statistic statistic) {
135-
return (Statistic.MAX.equals(statistic) ? Double::max : Double::sum);
135+
return Statistic.MAX.equals(statistic) ? Double::max : Double::sum;
136136
}
137137

138138
private Map<String, Set<String>> getAvailableTags(List<Meter> meters) {

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private static String getMatchingPattern(HttpServletRequest request) {
123123

124124
private static String getPathInfo(HttpServletRequest request) {
125125
String pathInfo = request.getPathInfo();
126-
String uri = (StringUtils.hasText(pathInfo) ? pathInfo : "/");
126+
String uri = StringUtils.hasText(pathInfo) ? pathInfo : "/";
127127
return uri.replaceAll("//+", "/").replaceAll("/$", "");
128128
}
129129

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/http/HttpExchangeTracer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected void postProcessRequestHeaders(Map<String, List<String>> headers) {
8686
}
8787

8888
private <T> T getIfIncluded(Include include, Supplier<T> valueSupplier) {
89-
return (this.includes.contains(include) ? valueSupplier.get() : null);
89+
return this.includes.contains(include) ? valueSupplier.get() : null;
9090
}
9191

9292
private <T> void setIfIncluded(Include include, Supplier<T> supplier,

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public String determineVirtualHost() {
260260
}
261261

262262
public void setVirtualHost(String virtualHost) {
263-
this.virtualHost = ("".equals(virtualHost) ? "/" : virtualHost);
263+
this.virtualHost = "".equals(virtualHost) ? "/" : virtualHost;
264264
}
265265

266266
public Duration getRequestedHeartbeat() {

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private ConditionMessage(String message) {
4848
}
4949

5050
private ConditionMessage(ConditionMessage prior, String message) {
51-
this.message = (prior.isEmpty() ? message : prior + "; " + message);
51+
this.message = prior.isEmpty() ? message : prior + "; " + message;
5252
}
5353

5454
/**

0 commit comments

Comments
 (0)