Polish ternary expressions

This commit is contained in:
Phillip Webb
2018-07-29 09:16:06 +01:00
parent b24bb688b8
commit aeb885192e
49 changed files with 59 additions and 60 deletions

View File

@@ -260,7 +260,7 @@ public class RabbitProperties {
}
public void setVirtualHost(String virtualHost) {
this.virtualHost = ("".equals(virtualHost) ? "/" : virtualHost);
this.virtualHost = "".equals(virtualHost) ? "/" : virtualHost;
}
public Duration getRequestedHeartbeat() {

View File

@@ -48,7 +48,7 @@ public final class ConditionMessage {
}
private ConditionMessage(ConditionMessage prior, String message) {
this.message = (prior.isEmpty() ? message : prior + "; " + message);
this.message = prior.isEmpty() ? message : prior + "; " + message;
}
/**

View File

@@ -111,7 +111,7 @@ public class ConditionOutcome {
* @return the message or {@code null}
*/
public String getMessage() {
return (this.message.isEmpty() ? null : this.message.toString());
return this.message.isEmpty() ? null : this.message.toString();
}
/**

View File

@@ -52,7 +52,7 @@ public class H2ConsoleAutoConfiguration {
@Bean
public ServletRegistrationBean<WebServlet> h2Console() {
String path = this.properties.getPath();
String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*");
String urlMapping = path.endsWith("/") ? path + "*" : path + "/*";
ServletRegistrationBean<WebServlet> registration = new ServletRegistrationBean<>(
new WebServlet(), urlMapping);
H2ConsoleProperties.Settings settings = this.properties.getSettings();

View File

@@ -72,7 +72,7 @@ public class ProjectInfoAutoConfiguration {
}
protected Properties loadFrom(Resource location, String prefix) throws IOException {
String p = (prefix.endsWith(".") ? prefix : prefix + ".");
String p = prefix.endsWith(".") ? prefix : prefix + ".";
Properties source = PropertiesLoaderUtils.loadProperties(location);
Properties target = new Properties();
for (String key : source.stringPropertyNames()) {

View File

@@ -195,7 +195,7 @@ public class JerseyAutoConfiguration implements ServletContextAware {
if (!applicationPath.startsWith("/")) {
applicationPath = "/" + applicationPath;
}
return (applicationPath.equals("/") ? "/*" : applicationPath + "/*");
return applicationPath.equals("/") ? "/*" : applicationPath + "/*";
}
@Override

View File

@@ -69,7 +69,7 @@ public class ResourceProperties {
String[] normalized = new String[staticLocations.length];
for (int i = 0; i < staticLocations.length; i++) {
String location = staticLocations[i];
normalized[i] = (location.endsWith("/") ? location : location + "/");
normalized[i] = location.endsWith("/") ? location : location + "/";
}
return normalized;
}

View File

@@ -61,7 +61,7 @@ public class WebConversionService extends DefaultFormattingConversionService {
*/
public WebConversionService(String dateFormat) {
super(false);
this.dateFormat = (StringUtils.hasText(dateFormat) ? dateFormat : null);
this.dateFormat = StringUtils.hasText(dateFormat) ? dateFormat : null;
if (this.dateFormat != null) {
addFormatters();
}

View File

@@ -77,7 +77,7 @@ public class WebServicesAutoConfiguration {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
String path = this.properties.getPath();
String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*");
String urlMapping = path.endsWith("/") ? path + "*" : path + "/*";
ServletRegistrationBean<MessageDispatcherServlet> registration = new ServletRegistrationBean<>(
servlet, urlMapping);
WebServicesProperties.Servlet servletProperties = this.properties.getServlet();
@@ -152,7 +152,7 @@ public class WebServicesAutoConfiguration {
}
private String ensureTrailingSlash(String path) {
return (path.endsWith("/") ? path : path + "/");
return path.endsWith("/") ? path : path + "/";
}
}