Polish ternary expressions
Consistently format ternary expressions and always favor `!=` as the the check.
This commit is contained in:
parent
bbf94c22da
commit
41efea51a7
|
@ -72,7 +72,7 @@ public class CloudFoundryWebEndpointDiscoverer extends WebEndpointDiscoverer {
|
||||||
AnnotationAttributes attributes = AnnotatedElementUtils
|
AnnotationAttributes attributes = AnnotatedElementUtils
|
||||||
.getMergedAnnotationAttributes(extensionBean.getClass(),
|
.getMergedAnnotationAttributes(extensionBean.getClass(),
|
||||||
EndpointWebExtension.class);
|
EndpointWebExtension.class);
|
||||||
Class<?> endpoint = (attributes == null ? null : attributes.getClass("endpoint"));
|
Class<?> endpoint = (attributes != null ? attributes.getClass("endpoint") : null);
|
||||||
return (endpoint != null && HealthEndpoint.class.isAssignableFrom(endpoint));
|
return (endpoint != null && HealthEndpoint.class.isAssignableFrom(endpoint));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,9 +126,8 @@ public class ReactiveCloudFoundryActuatorAutoConfiguration {
|
||||||
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
|
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
|
||||||
boolean skipSslValidation = environment.getProperty(
|
boolean skipSslValidation = environment.getProperty(
|
||||||
"management.cloudfoundry.skip-ssl-validation", Boolean.class, false);
|
"management.cloudfoundry.skip-ssl-validation", Boolean.class, false);
|
||||||
return (cloudControllerUrl == null ? null
|
return (cloudControllerUrl != null ? new ReactiveCloudFoundrySecurityService(
|
||||||
: new ReactiveCloudFoundrySecurityService(webClientBuilder,
|
webClientBuilder, cloudControllerUrl, skipSslValidation) : null);
|
||||||
cloudControllerUrl, skipSslValidation));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CorsConfiguration getCorsConfiguration() {
|
private CorsConfiguration getCorsConfiguration() {
|
||||||
|
|
|
@ -130,8 +130,8 @@ public class CloudFoundryActuatorAutoConfiguration {
|
||||||
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
|
String cloudControllerUrl = environment.getProperty("vcap.application.cf_api");
|
||||||
boolean skipSslValidation = environment.getProperty(
|
boolean skipSslValidation = environment.getProperty(
|
||||||
"management.cloudfoundry.skip-ssl-validation", Boolean.class, false);
|
"management.cloudfoundry.skip-ssl-validation", Boolean.class, false);
|
||||||
return (cloudControllerUrl == null ? null : new CloudFoundrySecurityService(
|
return (cloudControllerUrl != null ? new CloudFoundrySecurityService(
|
||||||
restTemplateBuilder, cloudControllerUrl, skipSslValidation));
|
restTemplateBuilder, cloudControllerUrl, skipSslValidation) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CorsConfiguration getCorsConfiguration() {
|
private CorsConfiguration getCorsConfiguration() {
|
||||||
|
|
|
@ -125,8 +125,8 @@ public class ConditionsReportEndpoint {
|
||||||
this.unconditionalClasses = report.getUnconditionalClasses();
|
this.unconditionalClasses = report.getUnconditionalClasses();
|
||||||
report.getConditionAndOutcomesBySource().forEach(
|
report.getConditionAndOutcomesBySource().forEach(
|
||||||
(source, conditionAndOutcomes) -> add(source, conditionAndOutcomes));
|
(source, conditionAndOutcomes) -> add(source, conditionAndOutcomes));
|
||||||
this.parentId = context.getParent() == null ? null
|
this.parentId = (context.getParent() != null ? context.getParent().getId()
|
||||||
: context.getParent().getId();
|
: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void add(String source, ConditionAndOutcomes conditionAndOutcomes) {
|
private void add(String source, ConditionAndOutcomes conditionAndOutcomes) {
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class ElasticsearchHealthIndicatorAutoConfiguration {
|
||||||
protected ElasticsearchHealthIndicator createHealthIndicator(Client client) {
|
protected ElasticsearchHealthIndicator createHealthIndicator(Client client) {
|
||||||
Duration responseTimeout = this.properties.getResponseTimeout();
|
Duration responseTimeout = this.properties.getResponseTimeout();
|
||||||
return new ElasticsearchHealthIndicator(client,
|
return new ElasticsearchHealthIndicator(client,
|
||||||
responseTimeout == null ? 100 : responseTimeout.toMillis(),
|
responseTimeout != null ? responseTimeout.toMillis() : 100,
|
||||||
this.properties.getIndices());
|
this.properties.getIndices());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ public class DataSourceHealthIndicatorAutoConfiguration extends
|
||||||
private String getValidationQuery(DataSource source) {
|
private String getValidationQuery(DataSource source) {
|
||||||
DataSourcePoolMetadata poolMetadata = this.poolMetadataProvider
|
DataSourcePoolMetadata poolMetadata = this.poolMetadataProvider
|
||||||
.getDataSourcePoolMetadata(source);
|
.getDataSourcePoolMetadata(source);
|
||||||
return (poolMetadata == null ? null : poolMetadata.getValidationQuery());
|
return (poolMetadata != null ? poolMetadata.getValidationQuery() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,10 +68,10 @@ public class PropertiesMeterFilter implements MeterFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private long[] convertSla(Meter.Type meterType, ServiceLevelAgreementBoundary[] sla) {
|
private long[] convertSla(Meter.Type meterType, ServiceLevelAgreementBoundary[] sla) {
|
||||||
long[] converted = Arrays.stream(sla == null ? EMPTY_SLA : sla)
|
long[] converted = Arrays.stream(sla != null ? sla : EMPTY_SLA)
|
||||||
.map((candidate) -> candidate.getValue(meterType))
|
.map((candidate) -> candidate.getValue(meterType))
|
||||||
.filter(Objects::nonNull).mapToLong(Long::longValue).toArray();
|
.filter(Objects::nonNull).mapToLong(Long::longValue).toArray();
|
||||||
return (converted.length == 0 ? null : converted);
|
return (converted.length != 0 ? converted : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> T lookup(Map<String, T> values, Id id, T defaultValue) {
|
private <T> T lookup(Map<String, T> values, Id id, T defaultValue) {
|
||||||
|
@ -82,7 +82,7 @@ public class PropertiesMeterFilter implements MeterFilter {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
int lastDot = name.lastIndexOf('.');
|
int lastDot = name.lastIndexOf('.');
|
||||||
name = lastDot == -1 ? "" : name.substring(0, lastDot);
|
name = (lastDot != -1 ? name.substring(0, lastDot) : "");
|
||||||
}
|
}
|
||||||
return values.getOrDefault("all", defaultValue);
|
return values.getOrDefault("all", defaultValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class WavefrontPropertiesConfigAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getUriAsString(WavefrontProperties properties) {
|
private String getUriAsString(WavefrontProperties properties) {
|
||||||
return properties.getUri() == null ? null : properties.getUri().toString();
|
return (properties.getUri() != null ? properties.getUri().toString() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class TomcatMetricsAutoConfiguration {
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public TomcatMetrics tomcatMetrics() {
|
public TomcatMetrics tomcatMetrics() {
|
||||||
return new TomcatMetrics(this.context == null ? null : this.context.getManager(),
|
return new TomcatMetrics(this.context != null ? this.context.getManager() : null,
|
||||||
Collections.emptyList());
|
Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,8 +125,9 @@ class ManagementContextConfigurationImportSelector
|
||||||
Map<String, Object> annotationAttributes = annotationMetadata
|
Map<String, Object> annotationAttributes = annotationMetadata
|
||||||
.getAnnotationAttributes(
|
.getAnnotationAttributes(
|
||||||
ManagementContextConfiguration.class.getName());
|
ManagementContextConfiguration.class.getName());
|
||||||
return (annotationAttributes == null ? ManagementContextType.ANY
|
return (annotationAttributes != null
|
||||||
: (ManagementContextType) annotationAttributes.get("value"));
|
? (ManagementContextType) annotationAttributes.get("value")
|
||||||
|
: ManagementContextType.ANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int readOrder(AnnotationMetadata annotationMetadata) {
|
private int readOrder(AnnotationMetadata annotationMetadata) {
|
||||||
|
|
|
@ -52,15 +52,17 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServletContext getServletContext() {
|
public ServletContext getServletContext() {
|
||||||
return getWebServer() == null ? null : getWebServer().getServletContext();
|
return (getWebServer() != null ? getWebServer().getServletContext() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegisteredServlet getRegisteredServlet(int index) {
|
public RegisteredServlet getRegisteredServlet(int index) {
|
||||||
return getWebServer() == null ? null : getWebServer().getRegisteredServlet(index);
|
return (getWebServer() != null ? getWebServer().getRegisteredServlet(index)
|
||||||
|
: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegisteredFilter getRegisteredFilter(int index) {
|
public RegisteredFilter getRegisteredFilter(int index) {
|
||||||
return getWebServer() == null ? null : getWebServer().getRegisteredFilters(index);
|
return (getWebServer() != null ? getWebServer().getRegisteredFilters(index)
|
||||||
|
: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MockServletWebServer
|
public static class MockServletWebServer
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
package org.springframework.boot.actuate.audit;
|
package org.springframework.boot.actuate.audit;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -43,8 +44,13 @@ public class AuditEventsEndpoint {
|
||||||
@ReadOperation
|
@ReadOperation
|
||||||
public AuditEventsDescriptor events(@Nullable String principal,
|
public AuditEventsDescriptor events(@Nullable String principal,
|
||||||
@Nullable OffsetDateTime after, @Nullable String type) {
|
@Nullable OffsetDateTime after, @Nullable String type) {
|
||||||
return new AuditEventsDescriptor(this.auditEventRepository.find(principal,
|
List<AuditEvent> events = this.auditEventRepository.find(principal,
|
||||||
after == null ? null : after.toInstant(), type));
|
getInstant(after), type);
|
||||||
|
return new AuditEventsDescriptor(events);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Instant getInstant(OffsetDateTime offsetDateTime) {
|
||||||
|
return (offsetDateTime != null ? offsetDateTime.toInstant() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class BeansEndpoint {
|
||||||
}
|
}
|
||||||
ConfigurableApplicationContext parent = getConfigurableParent(context);
|
ConfigurableApplicationContext parent = getConfigurableParent(context);
|
||||||
return new ContextBeans(describeBeans(context.getBeanFactory()),
|
return new ContextBeans(describeBeans(context.getBeanFactory()),
|
||||||
parent == null ? null : parent.getId());
|
parent != null ? parent.getId() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<String, BeanDescriptor> describeBeans(
|
private static Map<String, BeanDescriptor> describeBeans(
|
||||||
|
@ -168,8 +168,8 @@ public class BeansEndpoint {
|
||||||
private BeanDescriptor(String[] aliases, String scope, Class<?> type,
|
private BeanDescriptor(String[] aliases, String scope, Class<?> type,
|
||||||
String resource, String[] dependencies) {
|
String resource, String[] dependencies) {
|
||||||
this.aliases = aliases;
|
this.aliases = aliases;
|
||||||
this.scope = StringUtils.hasText(scope) ? scope
|
this.scope = (StringUtils.hasText(scope) ? scope
|
||||||
: BeanDefinition.SCOPE_SINGLETON;
|
: BeanDefinition.SCOPE_SINGLETON);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
this.dependencies = dependencies;
|
this.dependencies = dependencies;
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
|
||||||
prefix, sanitize(prefix, safeSerialize(mapper, bean, prefix))));
|
prefix, sanitize(prefix, safeSerialize(mapper, bean, prefix))));
|
||||||
});
|
});
|
||||||
return new ContextConfigurationProperties(beanDescriptors,
|
return new ContextConfigurationProperties(beanDescriptors,
|
||||||
context.getParent() == null ? null : context.getParent().getId());
|
context.getParent() != null ? context.getParent().getId() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConfigurationBeanFactoryMetadata getBeanFactoryMetadata(
|
private ConfigurationBeanFactoryMetadata getBeanFactoryMetadata(
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ElasticsearchHealthIndicator extends AbstractHealthIndicator {
|
||||||
public ElasticsearchHealthIndicator(Client client, long responseTimeout,
|
public ElasticsearchHealthIndicator(Client client, long responseTimeout,
|
||||||
List<String> indices) {
|
List<String> indices) {
|
||||||
this(client, responseTimeout,
|
this(client, responseTimeout,
|
||||||
(indices == null ? null : StringUtils.toStringArray(indices)));
|
(indices != null ? StringUtils.toStringArray(indices) : null));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -224,7 +224,7 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> T getLast(List<T> list) {
|
private <T> T getLast(List<T> list) {
|
||||||
return CollectionUtils.isEmpty(list) ? null : list.get(list.size() - 1);
|
return (CollectionUtils.isEmpty(list) ? null : list.get(list.size() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertNoDuplicateOperations(EndpointBean endpointBean,
|
private void assertNoDuplicateOperations(EndpointBean endpointBean,
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class JacksonJmxOperationResponseMapper implements JmxOperationResponseMa
|
||||||
private final JavaType mapType;
|
private final JavaType mapType;
|
||||||
|
|
||||||
public JacksonJmxOperationResponseMapper(ObjectMapper objectMapper) {
|
public JacksonJmxOperationResponseMapper(ObjectMapper objectMapper) {
|
||||||
this.objectMapper = (objectMapper == null ? new ObjectMapper() : objectMapper);
|
this.objectMapper = (objectMapper != null ? objectMapper : new ObjectMapper());
|
||||||
this.listType = this.objectMapper.getTypeFactory()
|
this.listType = this.objectMapper.getTypeFactory()
|
||||||
.constructParametricType(List.class, Object.class);
|
.constructParametricType(List.class, Object.class);
|
||||||
this.mapType = this.objectMapper.getTypeFactory()
|
this.mapType = this.objectMapper.getTypeFactory()
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
|
||||||
*/
|
*/
|
||||||
public PathMappedEndpoints(String basePath, EndpointsSupplier<?> supplier) {
|
public PathMappedEndpoints(String basePath, EndpointsSupplier<?> supplier) {
|
||||||
Assert.notNull(supplier, "Supplier must not be null");
|
Assert.notNull(supplier, "Supplier must not be null");
|
||||||
this.basePath = (basePath == null ? "" : basePath);
|
this.basePath = (basePath != null ? basePath : "");
|
||||||
this.endpoints = getEndpoints(Collections.singleton(supplier));
|
this.endpoints = getEndpoints(Collections.singleton(supplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
|
||||||
public PathMappedEndpoints(String basePath,
|
public PathMappedEndpoints(String basePath,
|
||||||
Collection<EndpointsSupplier<?>> suppliers) {
|
Collection<EndpointsSupplier<?>> suppliers) {
|
||||||
Assert.notNull(suppliers, "Suppliers must not be null");
|
Assert.notNull(suppliers, "Suppliers must not be null");
|
||||||
this.basePath = (basePath == null ? "" : basePath);
|
this.basePath = (basePath != null ? basePath : "");
|
||||||
this.endpoints = getEndpoints(suppliers);
|
this.endpoints = getEndpoints(suppliers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
|
||||||
*/
|
*/
|
||||||
public String getRootPath(String endpointId) {
|
public String getRootPath(String endpointId) {
|
||||||
PathMappedEndpoint endpoint = getEndpoint(endpointId);
|
PathMappedEndpoint endpoint = getEndpoint(endpointId);
|
||||||
return (endpoint == null ? null : endpoint.getRootPath());
|
return (endpoint != null ? endpoint.getRootPath() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,7 +144,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPath(PathMappedEndpoint endpoint) {
|
private String getPath(PathMappedEndpoint endpoint) {
|
||||||
return (endpoint == null ? null : this.basePath + "/" + endpoint.getRootPath());
|
return (endpoint != null ? this.basePath + "/" + endpoint.getRootPath() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> List<T> asList(Stream<T> stream) {
|
private <T> List<T> asList(Stream<T> stream) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class ServletEndpointRegistrar implements ServletContextInitializer {
|
||||||
public ServletEndpointRegistrar(String basePath,
|
public ServletEndpointRegistrar(String basePath,
|
||||||
Collection<ExposableServletEndpoint> servletEndpoints) {
|
Collection<ExposableServletEndpoint> servletEndpoints) {
|
||||||
Assert.notNull(servletEndpoints, "ServletEndpoints must not be null");
|
Assert.notNull(servletEndpoints, "ServletEndpoints must not be null");
|
||||||
this.basePath = (basePath == null ? "" : basePath);
|
this.basePath = (basePath != null ? basePath : "");
|
||||||
this.servletEndpoints = servletEndpoints;
|
this.servletEndpoints = servletEndpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ public class JerseyEndpointResourceFactory {
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
multivaluedMap.forEach((name, values) -> {
|
multivaluedMap.forEach((name, values) -> {
|
||||||
if (!CollectionUtils.isEmpty(values)) {
|
if (!CollectionUtils.isEmpty(values)) {
|
||||||
result.put(name, values.size() == 1 ? values.get(0) : values);
|
result.put(name, values.size() != 1 ? values : values.get(0));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -309,7 +309,7 @@ public abstract class AbstractWebFluxEndpointHandlerMapping
|
||||||
arguments.putAll(body);
|
arguments.putAll(body);
|
||||||
}
|
}
|
||||||
exchange.getRequest().getQueryParams().forEach((name, values) -> arguments
|
exchange.getRequest().getQueryParams().forEach((name, values) -> arguments
|
||||||
.put(name, values.size() == 1 ? values.get(0) : values));
|
.put(name, values.size() != 1 ? values : values.get(0)));
|
||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,8 +323,8 @@ public abstract class AbstractWebFluxEndpointHandlerMapping
|
||||||
.onErrorMap(InvalidEndpointRequestException.class,
|
.onErrorMap(InvalidEndpointRequestException.class,
|
||||||
(ex) -> new ResponseStatusException(HttpStatus.BAD_REQUEST,
|
(ex) -> new ResponseStatusException(HttpStatus.BAD_REQUEST,
|
||||||
ex.getReason()))
|
ex.getReason()))
|
||||||
.defaultIfEmpty(new ResponseEntity<>(httpMethod == HttpMethod.GET
|
.defaultIfEmpty(new ResponseEntity<>(httpMethod != HttpMethod.GET
|
||||||
? HttpStatus.NOT_FOUND : HttpStatus.NO_CONTENT));
|
? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResponseEntity<Object> toResponseEntity(Object response) {
|
private ResponseEntity<Object> toResponseEntity(Object response) {
|
||||||
|
|
|
@ -257,7 +257,7 @@ public abstract class AbstractWebMvcEndpointHandlerMapping
|
||||||
arguments.putAll(body);
|
arguments.putAll(body);
|
||||||
}
|
}
|
||||||
request.getParameterMap().forEach((name, values) -> arguments.put(name,
|
request.getParameterMap().forEach((name, values) -> arguments.put(name,
|
||||||
values.length == 1 ? values[0] : Arrays.asList(values)));
|
values.length != 1 ? Arrays.asList(values) : values[0]));
|
||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,8 +269,8 @@ public abstract class AbstractWebMvcEndpointHandlerMapping
|
||||||
|
|
||||||
private Object handleResult(Object result, HttpMethod httpMethod) {
|
private Object handleResult(Object result, HttpMethod httpMethod) {
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return new ResponseEntity<>(httpMethod == HttpMethod.GET
|
return new ResponseEntity<>(httpMethod != HttpMethod.GET
|
||||||
? HttpStatus.NOT_FOUND : HttpStatus.NO_CONTENT);
|
? HttpStatus.NO_CONTENT : HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
if (!(result instanceof WebEndpointResponse)) {
|
if (!(result instanceof WebEndpointResponse)) {
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.springframework.boot.actuate.endpoint.annotation.Selector;
|
||||||
import org.springframework.boot.context.properties.bind.PlaceholdersResolver;
|
import org.springframework.boot.context.properties.bind.PlaceholdersResolver;
|
||||||
import org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver;
|
import org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver;
|
||||||
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
|
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
|
||||||
|
import org.springframework.boot.origin.Origin;
|
||||||
import org.springframework.boot.origin.OriginLookup;
|
import org.springframework.boot.origin.OriginLookup;
|
||||||
import org.springframework.core.env.CompositePropertySource;
|
import org.springframework.core.env.CompositePropertySource;
|
||||||
import org.springframework.core.env.ConfigurableEnvironment;
|
import org.springframework.core.env.ConfigurableEnvironment;
|
||||||
|
@ -152,11 +153,16 @@ public class EnvironmentEndpoint {
|
||||||
private PropertyValueDescriptor describeValueOf(String name, PropertySource<?> source,
|
private PropertyValueDescriptor describeValueOf(String name, PropertySource<?> source,
|
||||||
PlaceholdersResolver resolver) {
|
PlaceholdersResolver resolver) {
|
||||||
Object resolved = resolver.resolvePlaceholders(source.getProperty(name));
|
Object resolved = resolver.resolvePlaceholders(source.getProperty(name));
|
||||||
String origin = (source instanceof OriginLookup)
|
String origin = ((source instanceof OriginLookup)
|
||||||
? ((OriginLookup<Object>) source).getOrigin(name).toString() : null;
|
? getOrigin((OriginLookup<Object>) source, name) : null);
|
||||||
return new PropertyValueDescriptor(sanitize(name, resolved), origin);
|
return new PropertyValueDescriptor(sanitize(name, resolved), origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getOrigin(OriginLookup<Object> lookup, String name) {
|
||||||
|
Origin origin = lookup.getOrigin(name);
|
||||||
|
return (origin != null ? origin.toString() : null);
|
||||||
|
}
|
||||||
|
|
||||||
private PlaceholdersResolver getResolver() {
|
private PlaceholdersResolver getResolver() {
|
||||||
return new PropertySourcesPlaceholdersSanitizingResolver(getPropertySources(),
|
return new PropertySourcesPlaceholdersSanitizingResolver(getPropertySources(),
|
||||||
this.sanitizer);
|
this.sanitizer);
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class FlywayEndpoint {
|
||||||
.put(name, new FlywayDescriptor(flyway.info().all())));
|
.put(name, new FlywayDescriptor(flyway.info().all())));
|
||||||
ApplicationContext parent = target.getParent();
|
ApplicationContext parent = target.getParent();
|
||||||
contextFlywayBeans.put(target.getId(), new ContextFlywayBeans(flywayBeans,
|
contextFlywayBeans.put(target.getId(), new ContextFlywayBeans(flywayBeans,
|
||||||
parent == null ? null : parent.getId()));
|
parent != null ? parent.getId() : null));
|
||||||
target = parent;
|
target = parent;
|
||||||
}
|
}
|
||||||
return new ApplicationFlywayBeans(contextFlywayBeans);
|
return new ApplicationFlywayBeans(contextFlywayBeans);
|
||||||
|
@ -170,7 +170,7 @@ public class FlywayEndpoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String nullSafeToString(Object obj) {
|
private String nullSafeToString(Object obj) {
|
||||||
return (obj == null ? null : obj.toString());
|
return (obj != null ? obj.toString() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MigrationType getType() {
|
public MigrationType getType() {
|
||||||
|
|
|
@ -57,8 +57,8 @@ public class CompositeReactiveHealthIndicator implements ReactiveHealthIndicator
|
||||||
Assert.notNull(indicators, "Indicators must not be null");
|
Assert.notNull(indicators, "Indicators must not be null");
|
||||||
this.indicators = new LinkedHashMap<>(indicators);
|
this.indicators = new LinkedHashMap<>(indicators);
|
||||||
this.healthAggregator = healthAggregator;
|
this.healthAggregator = healthAggregator;
|
||||||
this.timeoutCompose = (mono) -> this.timeout != null ? mono.timeout(
|
this.timeoutCompose = (mono) -> (this.timeout != null ? mono.timeout(
|
||||||
Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono;
|
Duration.ofMillis(this.timeout), Mono.just(this.timeoutHealth)) : mono);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator
|
||||||
super("DataSource health check failed");
|
super("DataSource health check failed");
|
||||||
this.dataSource = dataSource;
|
this.dataSource = dataSource;
|
||||||
this.query = query;
|
this.query = query;
|
||||||
this.jdbcTemplate = (dataSource == null ? null : new JdbcTemplate(dataSource));
|
this.jdbcTemplate = (dataSource != null ? new JdbcTemplate(dataSource) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class LiquibaseEndpoint {
|
||||||
createReport(liquibase, service, factory)));
|
createReport(liquibase, service, factory)));
|
||||||
ApplicationContext parent = target.getParent();
|
ApplicationContext parent = target.getParent();
|
||||||
contextBeans.put(target.getId(), new ContextLiquibaseBeans(liquibaseBeans,
|
contextBeans.put(target.getId(), new ContextLiquibaseBeans(liquibaseBeans,
|
||||||
parent == null ? null : parent.getId()));
|
parent != null ? parent.getId() : null));
|
||||||
target = parent;
|
target = parent;
|
||||||
}
|
}
|
||||||
return new ApplicationLiquibaseBeans(contextBeans);
|
return new ApplicationLiquibaseBeans(contextBeans);
|
||||||
|
@ -204,8 +204,8 @@ public class LiquibaseEndpoint {
|
||||||
this.execType = ranChangeSet.getExecType();
|
this.execType = ranChangeSet.getExecType();
|
||||||
this.id = ranChangeSet.getId();
|
this.id = ranChangeSet.getId();
|
||||||
this.labels = ranChangeSet.getLabels().getLabels();
|
this.labels = ranChangeSet.getLabels().getLabels();
|
||||||
this.checksum = ranChangeSet.getLastCheckSum() == null ? null
|
this.checksum = (ranChangeSet.getLastCheckSum() != null
|
||||||
: ranChangeSet.getLastCheckSum().toString();
|
? ranChangeSet.getLastCheckSum().toString() : null);
|
||||||
this.orderExecuted = ranChangeSet.getOrderExecuted();
|
this.orderExecuted = ranChangeSet.getOrderExecuted();
|
||||||
this.tag = ranChangeSet.getTag();
|
this.tag = ranChangeSet.getTag();
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class LoggersEndpoint {
|
||||||
Assert.notNull(name, "Name must not be null");
|
Assert.notNull(name, "Name must not be null");
|
||||||
LoggerConfiguration configuration = this.loggingSystem
|
LoggerConfiguration configuration = this.loggingSystem
|
||||||
.getLoggerConfiguration(name);
|
.getLoggerConfiguration(name);
|
||||||
return (configuration == null ? null : new LoggerLevels(configuration));
|
return (configuration != null ? new LoggerLevels(configuration) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@WriteOperation
|
@WriteOperation
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class HeapDumpWebEndpoint {
|
||||||
if (this.lock.tryLock(this.timeout, TimeUnit.MILLISECONDS)) {
|
if (this.lock.tryLock(this.timeout, TimeUnit.MILLISECONDS)) {
|
||||||
try {
|
try {
|
||||||
return new WebEndpointResponse<>(
|
return new WebEndpointResponse<>(
|
||||||
dumpHeap(live == null ? true : live));
|
dumpHeap(live != null ? live : true));
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
this.lock.unlock();
|
this.lock.unlock();
|
||||||
|
|
|
@ -96,10 +96,15 @@ public class MetricsEndpoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Tag> parseTags(List<String> tags) {
|
private List<Tag> parseTags(List<String> tags) {
|
||||||
return tags == null ? Collections.emptyList() : tags.stream().map((t) -> {
|
if (tags == null) {
|
||||||
String[] tagParts = t.split(":", 2);
|
return Collections.emptyList();
|
||||||
return Tag.of(tagParts[0], tagParts[1]);
|
}
|
||||||
}).collect(Collectors.toList());
|
return tags.stream().map(this::parseTag).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tag parseTag(String tag) {
|
||||||
|
String[] parts = tag.split(":", 2);
|
||||||
|
return Tag.of(parts[0], parts[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collectMeters(List<Meter> meters, MeterRegistry registry, String name,
|
private void collectMeters(List<Meter> meters, MeterRegistry registry, String name,
|
||||||
|
@ -125,7 +130,7 @@ public class MetricsEndpoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
private BiFunction<Double, Double, Double> mergeFunction(Statistic statistic) {
|
private BiFunction<Double, Double, Double> mergeFunction(Statistic statistic) {
|
||||||
return Statistic.MAX.equals(statistic) ? Double::max : Double::sum;
|
return (Statistic.MAX.equals(statistic) ? Double::max : Double::sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Set<String>> getAvailableTags(List<Meter> meters) {
|
private Map<String, Set<String>> getAvailableTags(List<Meter> meters) {
|
||||||
|
|
|
@ -36,9 +36,9 @@ public class DefaultRestTemplateExchangeTagsProvider
|
||||||
@Override
|
@Override
|
||||||
public Iterable<Tag> getTags(String urlTemplate, HttpRequest request,
|
public Iterable<Tag> getTags(String urlTemplate, HttpRequest request,
|
||||||
ClientHttpResponse response) {
|
ClientHttpResponse response) {
|
||||||
Tag uriTag = StringUtils.hasText(urlTemplate)
|
Tag uriTag = (StringUtils.hasText(urlTemplate)
|
||||||
? RestTemplateExchangeTags.uri(urlTemplate)
|
? RestTemplateExchangeTags.uri(urlTemplate)
|
||||||
: RestTemplateExchangeTags.uri(request);
|
: RestTemplateExchangeTags.uri(request));
|
||||||
return Arrays.asList(RestTemplateExchangeTags.method(request), uriTag,
|
return Arrays.asList(RestTemplateExchangeTags.method(request), uriTag,
|
||||||
RestTemplateExchangeTags.status(response),
|
RestTemplateExchangeTags.status(response),
|
||||||
RestTemplateExchangeTags.clientName(request));
|
RestTemplateExchangeTags.clientName(request));
|
||||||
|
|
|
@ -64,7 +64,7 @@ public final class RestTemplateExchangeTags {
|
||||||
* @return the uri tag
|
* @return the uri tag
|
||||||
*/
|
*/
|
||||||
public static Tag uri(String uriTemplate) {
|
public static Tag uri(String uriTemplate) {
|
||||||
String uri = StringUtils.hasText(uriTemplate) ? uriTemplate : "none";
|
String uri = (StringUtils.hasText(uriTemplate) ? uriTemplate : "none");
|
||||||
return Tag.of("uri", ensureLeadingSlash(stripUri(uri)));
|
return Tag.of("uri", ensureLeadingSlash(stripUri(uri)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ public final class WebMvcTags {
|
||||||
* @return the method tag whose value is a capitalized method (e.g. GET).
|
* @return the method tag whose value is a capitalized method (e.g. GET).
|
||||||
*/
|
*/
|
||||||
public static Tag method(HttpServletRequest request) {
|
public static Tag method(HttpServletRequest request) {
|
||||||
return (request == null ? METHOD_UNKNOWN : Tag.of("method", request.getMethod()));
|
return (request != null ? Tag.of("method", request.getMethod()) : METHOD_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,8 +67,9 @@ public final class WebMvcTags {
|
||||||
* @return the status tag derived from the status of the response
|
* @return the status tag derived from the status of the response
|
||||||
*/
|
*/
|
||||||
public static Tag status(HttpServletResponse response) {
|
public static Tag status(HttpServletResponse response) {
|
||||||
return (response == null ? STATUS_UNKNOWN :
|
return (response != null
|
||||||
Tag.of("status", Integer.toString(response.getStatus())));
|
? Tag.of("status", Integer.toString(response.getStatus()))
|
||||||
|
: STATUS_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class HttpExchangeTracer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> T getIfIncluded(Include include, Supplier<T> valueSupplier) {
|
private <T> T getIfIncluded(Include include, Supplier<T> valueSupplier) {
|
||||||
return this.includes.contains(include) ? valueSupplier.get() : null;
|
return (this.includes.contains(include) ? valueSupplier.get() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> void setIfIncluded(Include include, Supplier<T> supplier,
|
private <T> void setIfIncluded(Include include, Supplier<T> supplier,
|
||||||
|
|
|
@ -59,8 +59,8 @@ public class MappingsEndpoint {
|
||||||
this.descriptionProviders
|
this.descriptionProviders
|
||||||
.forEach((provider) -> mappings.put(provider.getMappingName(),
|
.forEach((provider) -> mappings.put(provider.getMappingName(),
|
||||||
provider.describeMappings(applicationContext)));
|
provider.describeMappings(applicationContext)));
|
||||||
return new ContextMappings(mappings, applicationContext.getParent() == null ? null
|
return new ContextMappings(mappings, applicationContext.getParent() != null
|
||||||
: applicationContext.getId());
|
? applicationContext.getId() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -64,7 +64,7 @@ final class DispatcherServletHandlerMappings {
|
||||||
initializeDispatcherServletIfPossible();
|
initializeDispatcherServletIfPossible();
|
||||||
handlerMappings = this.dispatcherServlet.getHandlerMappings();
|
handlerMappings = this.dispatcherServlet.getHandlerMappings();
|
||||||
}
|
}
|
||||||
return handlerMappings == null ? Collections.emptyList() : handlerMappings;
|
return (handlerMappings != null ? handlerMappings : Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeDispatcherServletIfPossible() {
|
private void initializeDispatcherServletIfPossible() {
|
||||||
|
|
|
@ -73,11 +73,11 @@ public class HttpTraceWebFilter implements WebFilter, Ordered {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
|
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
|
||||||
Mono<?> principal = this.includes.contains(Include.PRINCIPAL)
|
Mono<?> principal = (this.includes.contains(Include.PRINCIPAL)
|
||||||
? exchange.getPrincipal().cast(Object.class).defaultIfEmpty(NONE)
|
? exchange.getPrincipal().cast(Object.class).defaultIfEmpty(NONE)
|
||||||
: Mono.just(NONE);
|
: Mono.just(NONE));
|
||||||
Mono<?> session = this.includes.contains(Include.SESSION_ID)
|
Mono<?> session = (this.includes.contains(Include.SESSION_ID)
|
||||||
? exchange.getSession() : Mono.just(NONE);
|
? exchange.getSession() : Mono.just(NONE));
|
||||||
return Mono.zip(principal, session)
|
return Mono.zip(principal, session)
|
||||||
.flatMap((tuple) -> filter(exchange, chain,
|
.flatMap((tuple) -> filter(exchange, chain,
|
||||||
asType(tuple.getT1(), Principal.class),
|
asType(tuple.getT1(), Principal.class),
|
||||||
|
@ -97,17 +97,17 @@ public class HttpTraceWebFilter implements WebFilter, Ordered {
|
||||||
exchange);
|
exchange);
|
||||||
HttpTrace trace = this.tracer.receivedRequest(request);
|
HttpTrace trace = this.tracer.receivedRequest(request);
|
||||||
return chain.filter(exchange).doAfterSuccessOrError((aVoid, ex) -> {
|
return chain.filter(exchange).doAfterSuccessOrError((aVoid, ex) -> {
|
||||||
this.tracer.sendingResponse(trace,
|
TraceableServerHttpResponse response = new TraceableServerHttpResponse(
|
||||||
new TraceableServerHttpResponse(ex == null ? exchange.getResponse()
|
(ex != null ? new CustomStatusResponseDecorator(ex,
|
||||||
: new CustomStatusResponseDecorator(ex,
|
exchange.getResponse()) : exchange.getResponse()));
|
||||||
exchange.getResponse())),
|
this.tracer.sendingResponse(trace, response, () -> principal,
|
||||||
() -> principal, () -> getStartedSessionId(session));
|
() -> getStartedSessionId(session));
|
||||||
this.repository.add(trace);
|
this.repository.add(trace);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getStartedSessionId(WebSession session) {
|
private String getStartedSessionId(WebSession session) {
|
||||||
return (session != null && session.isStarted()) ? session.getId() : null;
|
return (session != null && session.isStarted() ? session.getId() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class CustomStatusResponseDecorator
|
private static final class CustomStatusResponseDecorator
|
||||||
|
@ -117,9 +117,9 @@ public class HttpTraceWebFilter implements WebFilter, Ordered {
|
||||||
|
|
||||||
private CustomStatusResponseDecorator(Throwable ex, ServerHttpResponse delegate) {
|
private CustomStatusResponseDecorator(Throwable ex, ServerHttpResponse delegate) {
|
||||||
super(delegate);
|
super(delegate);
|
||||||
this.status = ex instanceof ResponseStatusException
|
this.status = (ex instanceof ResponseStatusException
|
||||||
? ((ResponseStatusException) ex).getStatus()
|
? ((ResponseStatusException) ex).getStatus()
|
||||||
: HttpStatus.INTERNAL_SERVER_ERROR;
|
: HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -45,8 +45,8 @@ class ServerWebExchangeTraceableRequest implements TraceableRequest {
|
||||||
this.method = request.getMethodValue();
|
this.method = request.getMethodValue();
|
||||||
this.headers = request.getHeaders();
|
this.headers = request.getHeaders();
|
||||||
this.uri = request.getURI();
|
this.uri = request.getURI();
|
||||||
this.remoteAddress = request.getRemoteAddress() == null ? null
|
this.remoteAddress = (request.getRemoteAddress() != null
|
||||||
: request.getRemoteAddress().getAddress().toString();
|
? request.getRemoteAddress().getAddress().toString() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -38,8 +38,8 @@ class TraceableServerHttpResponse implements TraceableResponse {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStatus() {
|
public int getStatus() {
|
||||||
return this.response.getStatusCode() == null ? 200
|
return (this.response.getStatusCode() != null
|
||||||
: this.response.getStatusCode().value();
|
? this.response.getStatusCode().value() : 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -86,8 +86,9 @@ public class HttpTraceFilter extends OncePerRequestFilter implements Ordered {
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
TraceableHttpServletResponse traceableResponse = new TraceableHttpServletResponse(
|
TraceableHttpServletResponse traceableResponse = new TraceableHttpServletResponse(
|
||||||
status == response.getStatus() ? response
|
status != response.getStatus()
|
||||||
: new CustomStatusResponseWrapper(response, status));
|
? new CustomStatusResponseWrapper(response, status)
|
||||||
|
: response);
|
||||||
this.tracer.sendingResponse(trace, traceableResponse,
|
this.tracer.sendingResponse(trace, traceableResponse,
|
||||||
request::getUserPrincipal, () -> getSessionId(request));
|
request::getUserPrincipal, () -> getSessionId(request));
|
||||||
this.repository.add(trace);
|
this.repository.add(trace);
|
||||||
|
@ -96,7 +97,7 @@ public class HttpTraceFilter extends OncePerRequestFilter implements Ordered {
|
||||||
|
|
||||||
private String getSessionId(HttpServletRequest request) {
|
private String getSessionId(HttpServletRequest request) {
|
||||||
HttpSession session = request.getSession(false);
|
HttpSession session = request.getSession(false);
|
||||||
return session == null ? null : session.getId();
|
return (session != null ? session.getId() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class CustomStatusResponseWrapper
|
private static final class CustomStatusResponseWrapper
|
||||||
|
|
|
@ -255,7 +255,7 @@ public class ConfigurationPropertiesReportEndpointTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMixedBoolean() {
|
public boolean isMixedBoolean() {
|
||||||
return (this.mixedBoolean == null ? false : this.mixedBoolean);
|
return (this.mixedBoolean != null ? this.mixedBoolean : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMixedBoolean(Boolean mixedBoolean) {
|
public void setMixedBoolean(Boolean mixedBoolean) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class ReflectiveOperationInvokerTests {
|
||||||
ReflectionUtils.findMethod(Example.class, "reverse", String.class),
|
ReflectionUtils.findMethod(Example.class, "reverse", String.class),
|
||||||
OperationType.READ);
|
OperationType.READ);
|
||||||
this.parameterValueMapper = (parameter,
|
this.parameterValueMapper = (parameter,
|
||||||
value) -> (value == null ? null : value.toString());
|
value) -> (value != null ? value.toString() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -190,8 +190,9 @@ public class JmxEndpointExporterTests {
|
||||||
@Override
|
@Override
|
||||||
public ObjectName getObjectName(ExposableJmxEndpoint endpoint)
|
public ObjectName getObjectName(ExposableJmxEndpoint endpoint)
|
||||||
throws MalformedObjectNameException {
|
throws MalformedObjectNameException {
|
||||||
return (endpoint == null ? null
|
return (endpoint != null
|
||||||
: new ObjectName("boot:type=Endpoint,name=" + endpoint.getId()));
|
? new ObjectName("boot:type=Endpoint,name=" + endpoint.getId())
|
||||||
|
: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ public class TestJmxOperation implements JmxOperation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object invoke(InvocationContext context) {
|
public Object invoke(InvocationContext context) {
|
||||||
return (this.invoke == null ? "result"
|
return (this.invoke != null ? this.invoke.apply(context.getArguments())
|
||||||
: this.invoke.apply(context.getArguments()));
|
: "result");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -835,7 +835,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||||
|
|
||||||
@ReadOperation
|
@ReadOperation
|
||||||
public String read(@Nullable Principal principal) {
|
public String read(@Nullable Principal principal) {
|
||||||
return principal == null ? "None" : principal.getName();
|
return (principal != null ? principal.getName() : "None");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -856,7 +856,7 @@ public abstract class AbstractWebEndpointIntegrationTests<T extends Configurable
|
||||||
@ReadOperation
|
@ReadOperation
|
||||||
public String read(SecurityContext securityContext) {
|
public String read(SecurityContext securityContext) {
|
||||||
Principal principal = securityContext.getPrincipal();
|
Principal principal = securityContext.getPrincipal();
|
||||||
return principal == null ? "None" : principal.getName();
|
return (principal != null ? principal.getName() : "None");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,8 +326,8 @@ public class HttpExchangeTracerTests {
|
||||||
private String mixedCase(String input) {
|
private String mixedCase(String input) {
|
||||||
StringBuilder output = new StringBuilder();
|
StringBuilder output = new StringBuilder();
|
||||||
for (int i = 0; i < input.length(); i++) {
|
for (int i = 0; i < input.length(); i++) {
|
||||||
output.append(i % 2 == 0 ? Character.toLowerCase(input.charAt(i))
|
output.append(i % 2 != 0 ? Character.toUpperCase(input.charAt(i))
|
||||||
: Character.toUpperCase(input.charAt(i)));
|
: Character.toLowerCase(input.charAt(i)));
|
||||||
}
|
}
|
||||||
return output.toString();
|
return output.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class FlywayAutoConfiguration {
|
||||||
private String getProperty(Supplier<String> property,
|
private String getProperty(Supplier<String> property,
|
||||||
Supplier<String> defaultValue) {
|
Supplier<String> defaultValue) {
|
||||||
String value = property.get();
|
String value = property.get();
|
||||||
return (value == null ? defaultValue.get() : value);
|
return (value != null ? value : defaultValue.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkLocationExists(String... locations) {
|
private void checkLocationExists(String... locations) {
|
||||||
|
|
|
@ -56,9 +56,9 @@ class IntegrationAutoConfigurationScanRegistrar extends IntegrationComponentScan
|
||||||
@Override
|
@Override
|
||||||
protected Collection<String> getBasePackages(
|
protected Collection<String> getBasePackages(
|
||||||
AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
|
AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
|
||||||
return AutoConfigurationPackages.has(this.beanFactory)
|
return (AutoConfigurationPackages.has(this.beanFactory)
|
||||||
? AutoConfigurationPackages.get(this.beanFactory)
|
? AutoConfigurationPackages.get(this.beanFactory)
|
||||||
: Collections.emptyList();
|
: Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@IntegrationComponentScan
|
@IntegrationComponentScan
|
||||||
|
|
|
@ -234,8 +234,8 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
|
||||||
}
|
}
|
||||||
if (!StringUtils.hasText(driverClassName)) {
|
if (!StringUtils.hasText(driverClassName)) {
|
||||||
throw new DataSourceBeanCreationException(
|
throw new DataSourceBeanCreationException(
|
||||||
"Failed to determine a suitable driver class",
|
"Failed to determine a suitable driver class", this,
|
||||||
this, this.embeddedDatabaseConnection);
|
this.embeddedDatabaseConnection);
|
||||||
}
|
}
|
||||||
return driverClassName;
|
return driverClassName;
|
||||||
}
|
}
|
||||||
|
@ -277,12 +277,12 @@ public class DataSourceProperties implements BeanClassLoaderAware, InitializingB
|
||||||
return this.url;
|
return this.url;
|
||||||
}
|
}
|
||||||
String databaseName = determineDatabaseName();
|
String databaseName = determineDatabaseName();
|
||||||
String url = (databaseName == null ? null
|
String url = (databaseName != null
|
||||||
: this.embeddedDatabaseConnection.getUrl(databaseName));
|
? this.embeddedDatabaseConnection.getUrl(databaseName) : null);
|
||||||
if (!StringUtils.hasText(url)) {
|
if (!StringUtils.hasText(url)) {
|
||||||
throw new DataSourceBeanCreationException(
|
throw new DataSourceBeanCreationException(
|
||||||
"Failed to determine suitable jdbc url",
|
"Failed to determine suitable jdbc url", this,
|
||||||
this, this.embeddedDatabaseConnection);
|
this.embeddedDatabaseConnection);
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ public class LiquibaseAutoConfiguration {
|
||||||
private String getProperty(Supplier<String> property,
|
private String getProperty(Supplier<String> property,
|
||||||
Supplier<String> defaultValue) {
|
Supplier<String> defaultValue) {
|
||||||
String value = property.get();
|
String value = property.get();
|
||||||
return value == null ? defaultValue.get() : value;
|
return (value != null ? value : defaultValue.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,8 @@ public class MongoClientFactory {
|
||||||
if (options == null) {
|
if (options == null) {
|
||||||
options = MongoClientOptions.builder().build();
|
options = MongoClientOptions.builder().build();
|
||||||
}
|
}
|
||||||
String host = this.properties.getHost() == null ? "localhost"
|
String host = (this.properties.getHost() != null ? this.properties.getHost()
|
||||||
: this.properties.getHost();
|
: "localhost");
|
||||||
return new MongoClient(Collections.singletonList(new ServerAddress(host, port)),
|
return new MongoClient(Collections.singletonList(new ServerAddress(host, port)),
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
@ -101,8 +101,8 @@ public class MongoClientFactory {
|
||||||
int port = getValue(properties.getPort(), MongoProperties.DEFAULT_PORT);
|
int port = getValue(properties.getPort(), MongoProperties.DEFAULT_PORT);
|
||||||
List<ServerAddress> seeds = Collections
|
List<ServerAddress> seeds = Collections
|
||||||
.singletonList(new ServerAddress(host, port));
|
.singletonList(new ServerAddress(host, port));
|
||||||
return credentials == null ? new MongoClient(seeds, options)
|
return (credentials != null ? new MongoClient(seeds, credentials, options)
|
||||||
: new MongoClient(seeds, credentials, options);
|
: new MongoClient(seeds, options));
|
||||||
}
|
}
|
||||||
return createMongoClient(MongoProperties.DEFAULT_URI, options);
|
return createMongoClient(MongoProperties.DEFAULT_URI, options);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ public class MongoClientFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> T getValue(T value, T fallback) {
|
private <T> T getValue(T value, T fallback) {
|
||||||
return (value == null ? fallback : value);
|
return (value != null ? value : fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasCustomAddress() {
|
private boolean hasCustomAddress() {
|
||||||
|
|
|
@ -86,8 +86,8 @@ public class ReactiveMongoClientFactory {
|
||||||
private MongoClient createEmbeddedMongoClient(MongoClientSettings settings,
|
private MongoClient createEmbeddedMongoClient(MongoClientSettings settings,
|
||||||
int port) {
|
int port) {
|
||||||
Builder builder = builder(settings);
|
Builder builder = builder(settings);
|
||||||
String host = this.properties.getHost() == null ? "localhost"
|
String host = (this.properties.getHost() != null ? this.properties.getHost()
|
||||||
: this.properties.getHost();
|
: "localhost");
|
||||||
ClusterSettings clusterSettings = ClusterSettings.builder()
|
ClusterSettings clusterSettings = ClusterSettings.builder()
|
||||||
.hosts(Collections.singletonList(new ServerAddress(host, port))).build();
|
.hosts(Collections.singletonList(new ServerAddress(host, port))).build();
|
||||||
builder.clusterSettings(clusterSettings);
|
builder.clusterSettings(clusterSettings);
|
||||||
|
@ -119,16 +119,16 @@ public class ReactiveMongoClientFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyCredentials(Builder builder) {
|
private void applyCredentials(Builder builder) {
|
||||||
String database = this.properties.getAuthenticationDatabase() == null
|
String database = (this.properties.getAuthenticationDatabase() != null
|
||||||
? this.properties.getMongoClientDatabase()
|
? this.properties.getAuthenticationDatabase()
|
||||||
: this.properties.getAuthenticationDatabase();
|
: this.properties.getMongoClientDatabase());
|
||||||
builder.credential((MongoCredential.createCredential(
|
builder.credential((MongoCredential.createCredential(
|
||||||
this.properties.getUsername(), database, this.properties.getPassword())));
|
this.properties.getUsername(), database, this.properties.getPassword())));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> T getOrDefault(T value, T defaultValue) {
|
private <T> T getOrDefault(T value, T defaultValue) {
|
||||||
return (value == null ? defaultValue : value);
|
return (value != null ? value : defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MongoClient createMongoClient(Builder builder) {
|
private MongoClient createMongoClient(Builder builder) {
|
||||||
|
|
|
@ -91,8 +91,8 @@ class DataSourceInitializedPublisher implements BeanPostProcessor {
|
||||||
if (this.properties == null) {
|
if (this.properties == null) {
|
||||||
return true; // better safe than sorry
|
return true; // better safe than sorry
|
||||||
}
|
}
|
||||||
Supplier<String> defaultDdlAuto = () -> EmbeddedDatabaseConnection
|
Supplier<String> defaultDdlAuto = () -> (EmbeddedDatabaseConnection
|
||||||
.isEmbedded(dataSource) ? "create-drop" : "none";
|
.isEmbedded(dataSource) ? "create-drop" : "none");
|
||||||
Map<String, Object> hibernate = this.properties
|
Map<String, Object> hibernate = this.properties
|
||||||
.getHibernateProperties(new HibernateSettings().ddlAuto(defaultDdlAuto));
|
.getHibernateProperties(new HibernateSettings().ddlAuto(defaultDdlAuto));
|
||||||
if (hibernate.containsKey("hibernate.hbm2ddl.auto")) {
|
if (hibernate.containsKey("hibernate.hbm2ddl.auto")) {
|
||||||
|
|
|
@ -72,8 +72,8 @@ final class OAuth2ClientPropertiesRegistrationAdapter {
|
||||||
|
|
||||||
private static Builder getBuilder(String registrationId, String configuredProviderId,
|
private static Builder getBuilder(String registrationId, String configuredProviderId,
|
||||||
Map<String, Provider> providers) {
|
Map<String, Provider> providers) {
|
||||||
String providerId = (configuredProviderId == null ? registrationId
|
String providerId = (configuredProviderId != null ? configuredProviderId
|
||||||
: configuredProviderId);
|
: registrationId);
|
||||||
CommonOAuth2Provider provider = getCommonProvider(providerId);
|
CommonOAuth2Provider provider = getCommonProvider(providerId);
|
||||||
if (provider == null && !providers.containsKey(providerId)) {
|
if (provider == null && !providers.containsKey(providerId)) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
|
@ -89,10 +89,10 @@ final class OAuth2ClientPropertiesRegistrationAdapter {
|
||||||
|
|
||||||
private static String getErrorMessage(String configuredProviderId,
|
private static String getErrorMessage(String configuredProviderId,
|
||||||
String registrationId) {
|
String registrationId) {
|
||||||
return (configuredProviderId == null
|
return (configuredProviderId != null
|
||||||
? "Provider ID must be specified for client registration '"
|
? "Unknown provider ID '" + configuredProviderId + "'"
|
||||||
+ registrationId + "'"
|
: "Provider ID must be specified for client registration '"
|
||||||
: "Unknown provider ID '" + configuredProviderId + "'");
|
+ registrationId + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Builder getBuilder(Builder builder, Provider provider) {
|
private static Builder getBuilder(Builder builder, Provider provider) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ final class SessionStoreMappings {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getName(Class<?> configuration) {
|
private String getName(Class<?> configuration) {
|
||||||
return (configuration == null ? null : configuration.getName());
|
return (configuration != null ? configuration.getName() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,8 @@ public class TransactionManagerCustomizers {
|
||||||
|
|
||||||
public TransactionManagerCustomizers(
|
public TransactionManagerCustomizers(
|
||||||
Collection<? extends PlatformTransactionManagerCustomizer<?>> customizers) {
|
Collection<? extends PlatformTransactionManagerCustomizer<?>> customizers) {
|
||||||
this.customizers = (customizers == null ? Collections.emptyList()
|
this.customizers = (customizers != null ? new ArrayList<>(customizers)
|
||||||
: new ArrayList<>(customizers));
|
: Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -110,9 +110,9 @@ public class TomcatWebServerFactoryCustomizer implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private int determineMaxHttpHeaderSize() {
|
private int determineMaxHttpHeaderSize() {
|
||||||
return this.serverProperties.getMaxHttpHeaderSize() > 0
|
return (this.serverProperties.getMaxHttpHeaderSize() > 0
|
||||||
? this.serverProperties.getMaxHttpHeaderSize()
|
? this.serverProperties.getMaxHttpHeaderSize()
|
||||||
: this.serverProperties.getTomcat().getMaxHttpHeaderSize();
|
: this.serverProperties.getTomcat().getMaxHttpHeaderSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void customizeAcceptCount(ConfigurableTomcatWebServerFactory factory,
|
private void customizeAcceptCount(ConfigurableTomcatWebServerFactory factory,
|
||||||
|
|
|
@ -205,7 +205,7 @@ public abstract class AbstractErrorWebExceptionHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
private String htmlEscape(Object input) {
|
private String htmlEscape(Object input) {
|
||||||
return (input == null ? null : HtmlUtils.htmlEscape(input.toString()));
|
return (input != null ? HtmlUtils.htmlEscape(input.toString()) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -338,7 +338,7 @@ public class WebMvcAutoConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer getSeconds(Duration cachePeriod) {
|
private Integer getSeconds(Duration cachePeriod) {
|
||||||
return (cachePeriod == null ? null : (int) cachePeriod.getSeconds());
|
return (cachePeriod != null ? (int) cachePeriod.getSeconds() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class HazelcastJpaDependencyAutoConfigurationTests {
|
||||||
String[] dependsOn = ((BeanDefinitionRegistry) context
|
String[] dependsOn = ((BeanDefinitionRegistry) context
|
||||||
.getSourceApplicationContext()).getBeanDefinition("entityManagerFactory")
|
.getSourceApplicationContext()).getBeanDefinition("entityManagerFactory")
|
||||||
.getDependsOn();
|
.getDependsOn();
|
||||||
return dependsOn != null ? Arrays.asList(dependsOn) : Collections.emptyList();
|
return (dependsOn != null ? Arrays.asList(dependsOn) : Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
|
|
@ -52,15 +52,17 @@ public class MockServletWebServerFactory extends AbstractServletWebServerFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServletContext getServletContext() {
|
public ServletContext getServletContext() {
|
||||||
return getWebServer() == null ? null : getWebServer().getServletContext();
|
return (getWebServer() != null ? getWebServer().getServletContext() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegisteredServlet getRegisteredServlet(int index) {
|
public RegisteredServlet getRegisteredServlet(int index) {
|
||||||
return getWebServer() == null ? null : getWebServer().getRegisteredServlet(index);
|
return (getWebServer() != null ? getWebServer().getRegisteredServlet(index)
|
||||||
|
: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegisteredFilter getRegisteredFilter(int index) {
|
public RegisteredFilter getRegisteredFilter(int index) {
|
||||||
return getWebServer() == null ? null : getWebServer().getRegisteredFilters(index);
|
return (getWebServer() != null ? getWebServer().getRegisteredFilters(index)
|
||||||
|
: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MockServletWebServer
|
public static class MockServletWebServer
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class SourceOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String asString(Object arg) {
|
private String asString(Object arg) {
|
||||||
return (arg == null ? null : String.valueOf(arg));
|
return (arg != null ? String.valueOf(arg) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getSources() {
|
public List<String> getSources() {
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class CliTester implements TestRule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sources[i] = new File(arg).isAbsolute() ? arg : this.prefix + arg;
|
sources[i] = (new File(arg).isAbsolute() ? arg : this.prefix + arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sources;
|
return sources;
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class ClassLoaderFile implements Serializable {
|
||||||
public ClassLoaderFile(Kind kind, long lastModified, byte[] contents) {
|
public ClassLoaderFile(Kind kind, long lastModified, byte[] contents) {
|
||||||
Assert.notNull(kind, "Kind must not be null");
|
Assert.notNull(kind, "Kind must not be null");
|
||||||
Assert.isTrue(kind != Kind.DELETED ? contents != null : contents == null,
|
Assert.isTrue(kind != Kind.DELETED ? contents != null : contents == null,
|
||||||
() -> "Contents must " + (kind == Kind.DELETED ? "" : "not ")
|
() -> "Contents must " + (kind != Kind.DELETED ? "not " : "")
|
||||||
+ "be null");
|
+ "be null");
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.lastModified = lastModified;
|
this.lastModified = lastModified;
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class MockClientHttpRequestFactory implements ClientHttpRequestFactory {
|
||||||
|
|
||||||
public ClientHttpResponse asHttpResponse(AtomicLong seq) {
|
public ClientHttpResponse asHttpResponse(AtomicLong seq) {
|
||||||
MockClientHttpResponse httpResponse = new MockClientHttpResponse(
|
MockClientHttpResponse httpResponse = new MockClientHttpResponse(
|
||||||
this.payload == null ? NO_DATA : this.payload, this.status);
|
this.payload != null ? this.payload : NO_DATA, this.status);
|
||||||
waitForDelay();
|
waitForDelay();
|
||||||
if (this.payload != null) {
|
if (this.payload != null) {
|
||||||
httpResponse.getHeaders().setContentLength(this.payload.length);
|
httpResponse.getHeaders().setContentLength(this.payload.length);
|
||||||
|
|
|
@ -148,7 +148,7 @@ class PropertiesMigrationReport {
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> List<T> asNewList(List<T> source) {
|
private <T> List<T> asNewList(List<T> source) {
|
||||||
return (source == null ? Collections.emptyList() : new ArrayList<>(source));
|
return (source != null ? new ArrayList<>(source) : Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PropertyMigration> getRenamed() {
|
public List<PropertyMigration> getRenamed() {
|
||||||
|
|
|
@ -278,8 +278,8 @@ public class ApplicationContextAssert<C extends ApplicationContext>
|
||||||
"%nExpecting:%n <%s>%nsingle bean of type:%n <%s>%nbut found:%n <%s>",
|
"%nExpecting:%n <%s>%nsingle bean of type:%n <%s>%nbut found:%n <%s>",
|
||||||
getApplicationContext(), type, names));
|
getApplicationContext(), type, names));
|
||||||
}
|
}
|
||||||
T bean = (names.length == 0 ? null
|
T bean = (names.length != 0 ? getApplicationContext().getBean(names[0], type)
|
||||||
: getApplicationContext().getBean(names[0], type));
|
: null);
|
||||||
return Assertions.assertThat(bean).as("Bean of type <%s> from <%s>", type,
|
return Assertions.assertThat(bean).as("Bean of type <%s> from <%s>", type,
|
||||||
getApplicationContext());
|
getApplicationContext());
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,11 +93,11 @@ public final class WebApplicationContextRunner extends
|
||||||
*/
|
*/
|
||||||
public static Supplier<ConfigurableWebApplicationContext> withMockServletContext(
|
public static Supplier<ConfigurableWebApplicationContext> withMockServletContext(
|
||||||
Supplier<ConfigurableWebApplicationContext> contextFactory) {
|
Supplier<ConfigurableWebApplicationContext> contextFactory) {
|
||||||
return (contextFactory == null ? null : () -> {
|
return (contextFactory != null ? () -> {
|
||||||
ConfigurableWebApplicationContext context = contextFactory.get();
|
ConfigurableWebApplicationContext context = contextFactory.get();
|
||||||
context.setServletContext(new MockServletContext());
|
context.setServletContext(new MockServletContext());
|
||||||
return context;
|
return context;
|
||||||
});
|
} : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,7 @@ public final class TestPropertyValues {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String applySuffix(String name) {
|
protected String applySuffix(String name) {
|
||||||
return (this.suffix == null ? name : name + "-" + this.suffix);
|
return (this.suffix != null ? name + "-" + this.suffix : name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class TestRestTemplate {
|
||||||
*/
|
*/
|
||||||
public TestRestTemplate(RestTemplateBuilder restTemplateBuilder, String username,
|
public TestRestTemplate(RestTemplateBuilder restTemplateBuilder, String username,
|
||||||
String password, HttpClientOption... httpClientOptions) {
|
String password, HttpClientOption... httpClientOptions) {
|
||||||
this(restTemplateBuilder == null ? null : restTemplateBuilder.build(), username,
|
this(restTemplateBuilder != null ? restTemplateBuilder.build() : null, username,
|
||||||
password, httpClientOptions);
|
password, httpClientOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,8 +138,8 @@ public class TestRestTemplate {
|
||||||
HttpClientOption... httpClientOptions) {
|
HttpClientOption... httpClientOptions) {
|
||||||
Assert.notNull(restTemplate, "RestTemplate must not be null");
|
Assert.notNull(restTemplate, "RestTemplate must not be null");
|
||||||
this.httpClientOptions = httpClientOptions;
|
this.httpClientOptions = httpClientOptions;
|
||||||
if (getRequestFactoryClass(restTemplate).isAssignableFrom(
|
if (getRequestFactoryClass(restTemplate)
|
||||||
HttpComponentsClientHttpRequestFactory.class)) {
|
.isAssignableFrom(HttpComponentsClientHttpRequestFactory.class)) {
|
||||||
restTemplate.setRequestFactory(
|
restTemplate.setRequestFactory(
|
||||||
new CustomHttpComponentsClientHttpRequestFactory(httpClientOptions));
|
new CustomHttpComponentsClientHttpRequestFactory(httpClientOptions));
|
||||||
}
|
}
|
||||||
|
|
|
@ -423,7 +423,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
|
||||||
this.metadataCollector.add(ItemMetadata.newProperty(endpointKey, "enabled",
|
this.metadataCollector.add(ItemMetadata.newProperty(endpointKey, "enabled",
|
||||||
Boolean.class.getName(), type, null,
|
Boolean.class.getName(), type, null,
|
||||||
String.format("Whether to enable the %s endpoint.", endpointId),
|
String.format("Whether to enable the %s endpoint.", endpointId),
|
||||||
(enabledByDefault == null ? true : enabledByDefault), null));
|
(enabledByDefault != null ? enabledByDefault : true), null));
|
||||||
if (hasMainReadOperation(element)) {
|
if (hasMainReadOperation(element)) {
|
||||||
this.metadataCollector.add(ItemMetadata.newProperty(endpointKey,
|
this.metadataCollector.add(ItemMetadata.newProperty(endpointKey,
|
||||||
"cache.time-to-live", Duration.class.getName(), type, null,
|
"cache.time-to-live", Duration.class.getName(), type, null,
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser {
|
||||||
String type = instance.toString();
|
String type = instance.toString();
|
||||||
type = type.substring(DURATION_OF.length(), type.indexOf('('));
|
type = type.substring(DURATION_OF.length(), type.indexOf('('));
|
||||||
String suffix = DURATION_SUFFIX.get(type);
|
String suffix = DURATION_SUFFIX.get(type);
|
||||||
return (suffix == null ? null : factoryValue + suffix);
|
return (suffix != null ? factoryValue + suffix : null);
|
||||||
}
|
}
|
||||||
return factoryValue;
|
return factoryValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class SpringBootExtension {
|
||||||
|
|
||||||
private String determineArtifactBaseName() {
|
private String determineArtifactBaseName() {
|
||||||
Jar artifactTask = findArtifactTask();
|
Jar artifactTask = findArtifactTask();
|
||||||
return (artifactTask == null ? null : artifactTask.getBaseName());
|
return (artifactTask != null ? artifactTask.getBaseName() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Jar findArtifactTask() {
|
private Jar findArtifactTask() {
|
||||||
|
|
|
@ -162,9 +162,9 @@ final class JavaPluginAction implements PluginApplicationAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasConfigurationProcessorOnClasspath(JavaCompile compile) {
|
private boolean hasConfigurationProcessorOnClasspath(JavaCompile compile) {
|
||||||
Set<File> files = compile.getOptions().getAnnotationProcessorPath() != null
|
Set<File> files = (compile.getOptions().getAnnotationProcessorPath() != null
|
||||||
? compile.getOptions().getAnnotationProcessorPath().getFiles()
|
? compile.getOptions().getAnnotationProcessorPath().getFiles()
|
||||||
: compile.getClasspath().getFiles();
|
: compile.getClasspath().getFiles());
|
||||||
return files.stream().map(File::getName).anyMatch(
|
return files.stream().map(File::getName).anyMatch(
|
||||||
(name) -> name.startsWith("spring-boot-configuration-processor"));
|
(name) -> name.startsWith("spring-boot-configuration-processor"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,9 +57,9 @@ public class BuildInfo extends ConventionTask {
|
||||||
new File(getDestinationDir(), "build-info.properties"))
|
new File(getDestinationDir(), "build-info.properties"))
|
||||||
.writeBuildProperties(new ProjectDetails(
|
.writeBuildProperties(new ProjectDetails(
|
||||||
this.properties.getGroup(),
|
this.properties.getGroup(),
|
||||||
this.properties.getArtifact() == null
|
this.properties.getArtifact() != null
|
||||||
? "unspecified"
|
? this.properties.getArtifact()
|
||||||
: this.properties.getArtifact(),
|
: "unspecified",
|
||||||
this.properties.getVersion(),
|
this.properties.getVersion(),
|
||||||
this.properties.getName(), this.properties.getTime(),
|
this.properties.getName(), this.properties.getTime(),
|
||||||
coerceToStringValues(
|
coerceToStringValues(
|
||||||
|
@ -77,8 +77,8 @@ public class BuildInfo extends ConventionTask {
|
||||||
*/
|
*/
|
||||||
@OutputDirectory
|
@OutputDirectory
|
||||||
public File getDestinationDir() {
|
public File getDestinationDir() {
|
||||||
return this.destinationDir != null ? this.destinationDir
|
return (this.destinationDir != null ? this.destinationDir
|
||||||
: getProject().getBuildDir();
|
: getProject().getBuildDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,8 +54,8 @@ public class BootJar extends Jar implements BootArchive {
|
||||||
|
|
||||||
private Action<CopySpec> classpathFiles(Spec<File> filter) {
|
private Action<CopySpec> classpathFiles(Spec<File> filter) {
|
||||||
return (copySpec) -> copySpec
|
return (copySpec) -> copySpec
|
||||||
.from((Callable<Iterable<File>>) () -> this.classpath == null
|
.from((Callable<Iterable<File>>) () -> (this.classpath != null
|
||||||
? Collections.emptyList() : this.classpath.filter(filter));
|
? this.classpath.filter(filter) : Collections.emptyList()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ public class BootJar extends Jar implements BootArchive {
|
||||||
public void classpath(Object... classpath) {
|
public void classpath(Object... classpath) {
|
||||||
FileCollection existingClasspath = this.classpath;
|
FileCollection existingClasspath = this.classpath;
|
||||||
this.classpath = getProject().files(
|
this.classpath = getProject().files(
|
||||||
existingClasspath == null ? Collections.emptyList() : existingClasspath,
|
existingClasspath != null ? existingClasspath : Collections.emptyList(),
|
||||||
classpath);
|
classpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,8 @@ public class BootWar extends War implements BootArchive {
|
||||||
public BootWar() {
|
public BootWar() {
|
||||||
getWebInf().into("lib-provided",
|
getWebInf().into("lib-provided",
|
||||||
(copySpec) -> copySpec.from(
|
(copySpec) -> copySpec.from(
|
||||||
(Callable<Iterable<File>>) () -> this.providedClasspath == null
|
(Callable<Iterable<File>>) () -> (this.providedClasspath != null
|
||||||
? Collections.emptyList() : this.providedClasspath));
|
? this.providedClasspath : Collections.emptyList())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -120,7 +120,7 @@ public class BootWar extends War implements BootArchive {
|
||||||
public void providedClasspath(Object... classpath) {
|
public void providedClasspath(Object... classpath) {
|
||||||
FileCollection existingClasspath = this.providedClasspath;
|
FileCollection existingClasspath = this.providedClasspath;
|
||||||
this.providedClasspath = getProject().files(
|
this.providedClasspath = getProject().files(
|
||||||
existingClasspath == null ? Collections.emptyList() : existingClasspath,
|
existingClasspath != null ? existingClasspath : Collections.emptyList(),
|
||||||
classpath);
|
classpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,8 +284,8 @@ class BootZipCopyAction implements CopyAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
private long getTime(FileCopyDetails details) {
|
private long getTime(FileCopyDetails details) {
|
||||||
return this.preserveFileTimestamps ? details.getLastModified()
|
return (this.preserveFileTimestamps ? details.getLastModified()
|
||||||
: CONSTANT_TIME_FOR_ZIP_ENTRIES;
|
: CONSTANT_TIME_FOR_ZIP_ENTRIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ final class AsciiBytes {
|
||||||
public boolean matches(CharSequence name, char suffix) {
|
public boolean matches(CharSequence name, char suffix) {
|
||||||
int charIndex = 0;
|
int charIndex = 0;
|
||||||
int nameLen = name.length();
|
int nameLen = name.length();
|
||||||
int totalLen = (nameLen + (suffix == 0 ? 0 : 1));
|
int totalLen = (nameLen + (suffix != 0 ? 1 : 0));
|
||||||
for (int i = this.offset; i < this.offset + this.length; i++) {
|
for (int i = this.offset; i < this.offset + this.length; i++) {
|
||||||
int b = this.bytes[i];
|
int b = this.bytes[i];
|
||||||
int remainingUtfBytes = getNumberOfUtfBytes(b) - 1;
|
int remainingUtfBytes = getNumberOfUtfBytes(b) - 1;
|
||||||
|
@ -250,7 +250,7 @@ final class AsciiBytes {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int hashCode(int hash, char suffix) {
|
public static int hashCode(int hash, char suffix) {
|
||||||
return (suffix == 0 ? hash : (31 * hash + suffix));
|
return (suffix != 0 ? (31 * hash + suffix) : hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class JarFile extends java.util.jar.JarFile {
|
||||||
parser.addVisitor(centralDirectoryVisitor());
|
parser.addVisitor(centralDirectoryVisitor());
|
||||||
this.data = parser.parse(data, filter == null);
|
this.data = parser.parse(data, filter == null);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.manifestSupplier = manifestSupplier != null ? manifestSupplier : () -> {
|
this.manifestSupplier = (manifestSupplier != null ? manifestSupplier : () -> {
|
||||||
try (InputStream inputStream = getInputStream(MANIFEST_NAME)) {
|
try (InputStream inputStream = getInputStream(MANIFEST_NAME)) {
|
||||||
if (inputStream == null) {
|
if (inputStream == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -130,7 +130,7 @@ public class JarFile extends java.util.jar.JarFile {
|
||||||
catch (IOException ex) {
|
catch (IOException ex) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private CentralDirectoryVisitor centralDirectoryVisitor() {
|
private CentralDirectoryVisitor centralDirectoryVisitor() {
|
||||||
|
|
|
@ -36,7 +36,7 @@ final class StringSequence implements CharSequence {
|
||||||
private int hash;
|
private int hash;
|
||||||
|
|
||||||
StringSequence(String source) {
|
StringSequence(String source) {
|
||||||
this(source, 0, (source == null ? -1 : source.length()));
|
this(source, 0, source != null ? source.length() : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringSequence(String source, int start, int end) {
|
StringSequence(String source, int start, int end) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class PropertiesMergingResourceTransformer implements ResourceTransformer
|
||||||
|
|
||||||
private void process(String name, String value) {
|
private void process(String name, String value) {
|
||||||
String existing = this.data.getProperty(name);
|
String existing = this.data.getProperty(name);
|
||||||
this.data.setProperty(name, (existing == null ? value : existing + "," + value));
|
this.data.setProperty(name, (existing != null ? existing + "," + value : value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -161,9 +161,9 @@ public class ImageBanner implements Banner {
|
||||||
IIOMetadataNode root = (IIOMetadataNode) metadata
|
IIOMetadataNode root = (IIOMetadataNode) metadata
|
||||||
.getAsTree(metadata.getNativeMetadataFormatName());
|
.getAsTree(metadata.getNativeMetadataFormatName());
|
||||||
IIOMetadataNode extension = findNode(root, "GraphicControlExtension");
|
IIOMetadataNode extension = findNode(root, "GraphicControlExtension");
|
||||||
String attribute = (extension == null ? null
|
String attribute = (extension != null ? extension.getAttribute("delayTime")
|
||||||
: extension.getAttribute("delayTime"));
|
: null);
|
||||||
return (attribute == null ? 0 : Integer.parseInt(attribute) * 10);
|
return (attribute != null ? Integer.parseInt(attribute) * 10 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IIOMetadataNode findNode(IIOMetadataNode rootNode, String nodeName) {
|
private static IIOMetadataNode findNode(IIOMetadataNode rootNode, String nodeName) {
|
||||||
|
|
|
@ -961,8 +961,8 @@ public class SpringApplication {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setWebEnvironment(boolean webEnvironment) {
|
public void setWebEnvironment(boolean webEnvironment) {
|
||||||
this.webApplicationType = webEnvironment ? WebApplicationType.SERVLET
|
this.webApplicationType = (webEnvironment ? WebApplicationType.SERVLET
|
||||||
: WebApplicationType.NONE;
|
: WebApplicationType.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class ContextIdApplicationContextInitializer implements
|
||||||
|
|
||||||
private String getApplicationId(ConfigurableEnvironment environment) {
|
private String getApplicationId(ConfigurableEnvironment environment) {
|
||||||
String name = environment.getProperty("spring.application.name");
|
String name = environment.getProperty("spring.application.name");
|
||||||
return StringUtils.hasText(name) ? name : "application";
|
return (StringUtils.hasText(name) ? name : "application");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -313,8 +313,8 @@ public class ConfigFileApplicationListener
|
||||||
|
|
||||||
Loader(ConfigurableEnvironment environment, ResourceLoader resourceLoader) {
|
Loader(ConfigurableEnvironment environment, ResourceLoader resourceLoader) {
|
||||||
this.environment = environment;
|
this.environment = environment;
|
||||||
this.resourceLoader = resourceLoader == null ? new DefaultResourceLoader()
|
this.resourceLoader = (resourceLoader != null ? resourceLoader
|
||||||
: resourceLoader;
|
: new DefaultResourceLoader());
|
||||||
this.propertySourceLoaders = SpringFactoriesLoader.loadFactories(
|
this.propertySourceLoaders = SpringFactoriesLoader.loadFactories(
|
||||||
PropertySourceLoader.class, getClass().getClassLoader());
|
PropertySourceLoader.class, getClass().getClassLoader());
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,8 +98,9 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc
|
||||||
private void bind(Object bean, String beanName, ConfigurationProperties annotation) {
|
private void bind(Object bean, String beanName, ConfigurationProperties annotation) {
|
||||||
ResolvableType type = getBeanType(bean, beanName);
|
ResolvableType type = getBeanType(bean, beanName);
|
||||||
Validated validated = getAnnotation(bean, beanName, Validated.class);
|
Validated validated = getAnnotation(bean, beanName, Validated.class);
|
||||||
Annotation[] annotations = (validated == null ? new Annotation[] { annotation }
|
Annotation[] annotations = (validated != null
|
||||||
: new Annotation[] { annotation, validated });
|
? new Annotation[] { annotation, validated }
|
||||||
|
: new Annotation[] { annotation });
|
||||||
Bindable<?> target = Bindable.of(type).withExistingValue(bean)
|
Bindable<?> target = Bindable.of(type).withExistingValue(bean)
|
||||||
.withAnnotations(annotations);
|
.withAnnotations(annotations);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -75,8 +75,8 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector {
|
||||||
MultiValueMap<String, Object> attributes = metadata
|
MultiValueMap<String, Object> attributes = metadata
|
||||||
.getAllAnnotationAttributes(
|
.getAllAnnotationAttributes(
|
||||||
EnableConfigurationProperties.class.getName(), false);
|
EnableConfigurationProperties.class.getName(), false);
|
||||||
return collectClasses(attributes == null ? Collections.emptyList()
|
return collectClasses(attributes != null ? attributes.get("value")
|
||||||
: attributes.get("value"));
|
: Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Class<?>> collectClasses(List<?> values) {
|
private List<Class<?>> collectClasses(List<?> values) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class BindException extends RuntimeException implements OriginProvider {
|
||||||
Bindable<?> target) {
|
Bindable<?> target) {
|
||||||
StringBuilder message = new StringBuilder();
|
StringBuilder message = new StringBuilder();
|
||||||
message.append("Failed to bind properties");
|
message.append("Failed to bind properties");
|
||||||
message.append(name == null ? "" : " under '" + name + "'");
|
message.append(name != null ? " under '" + name + "'" : "");
|
||||||
message.append(" to ").append(target.getType());
|
message.append(" to ").append(target.getType());
|
||||||
return message.toString();
|
return message.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ public final class BindResult<T> {
|
||||||
*/
|
*/
|
||||||
public <U> BindResult<U> map(Function<? super T, ? extends U> mapper) {
|
public <U> BindResult<U> map(Function<? super T, ? extends U> mapper) {
|
||||||
Assert.notNull(mapper, "Mapper must not be null");
|
Assert.notNull(mapper, "Mapper must not be null");
|
||||||
return of(this.value == null ? null : mapper.apply(this.value));
|
return of(this.value != null ? mapper.apply(this.value) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -110,7 +110,7 @@ public final class Bindable<T> {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
ToStringCreator creator = new ToStringCreator(this);
|
ToStringCreator creator = new ToStringCreator(this);
|
||||||
creator.append("type", this.type);
|
creator.append("type", this.type);
|
||||||
creator.append("value", (this.value == null ? "none" : "provided"));
|
creator.append("value", (this.value != null ? "provided" : "none"));
|
||||||
creator.append("annotations", this.annotations);
|
creator.append("annotations", this.annotations);
|
||||||
return creator.toString();
|
return creator.toString();
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ public final class Bindable<T> {
|
||||||
*/
|
*/
|
||||||
public Bindable<T> withAnnotations(Annotation... annotations) {
|
public Bindable<T> withAnnotations(Annotation... annotations) {
|
||||||
return new Bindable<>(this.type, this.boxedType, this.value,
|
return new Bindable<>(this.type, this.boxedType, this.value,
|
||||||
(annotations == null ? NO_ANNOTATIONS : annotations));
|
(annotations != null ? annotations : NO_ANNOTATIONS));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,7 +163,7 @@ public final class Bindable<T> {
|
||||||
existingValue == null || this.type.isArray()
|
existingValue == null || this.type.isArray()
|
||||||
|| this.boxedType.resolve().isInstance(existingValue),
|
|| this.boxedType.resolve().isInstance(existingValue),
|
||||||
() -> "ExistingValue must be an instance of " + this.type);
|
() -> "ExistingValue must be an instance of " + this.type);
|
||||||
Supplier<T> value = (existingValue == null ? null : () -> existingValue);
|
Supplier<T> value = (existingValue != null ? () -> existingValue : null);
|
||||||
return new Bindable<>(this.type, this.boxedType, value, NO_ANNOTATIONS);
|
return new Bindable<>(this.type, this.boxedType, value, NO_ANNOTATIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@ class CollectionBinder extends IndexedElementsBinder<Collection<Object>> {
|
||||||
@Override
|
@Override
|
||||||
protected Object bindAggregate(ConfigurationPropertyName name, Bindable<?> target,
|
protected Object bindAggregate(ConfigurationPropertyName name, Bindable<?> target,
|
||||||
AggregateElementBinder elementBinder) {
|
AggregateElementBinder elementBinder) {
|
||||||
Class<?> collectionType = (target.getValue() == null
|
Class<?> collectionType = (target.getValue() != null ? List.class
|
||||||
? target.getType().resolve(Object.class) : List.class);
|
: target.getType().resolve(Object.class));
|
||||||
ResolvableType aggregateType = ResolvableType.forClassWithGenerics(List.class,
|
ResolvableType aggregateType = ResolvableType.forClassWithGenerics(List.class,
|
||||||
target.getType().asCollection().getGenerics());
|
target.getType().asCollection().getGenerics());
|
||||||
ResolvableType elementType = target.getType().asCollection().getGeneric();
|
ResolvableType elementType = target.getType().asCollection().getGeneric();
|
||||||
|
|
|
@ -100,7 +100,7 @@ abstract class IndexedElementsBinder<T> extends AggregateBinder<T> {
|
||||||
source, root);
|
source, root);
|
||||||
for (int i = 0; i < Integer.MAX_VALUE; i++) {
|
for (int i = 0; i < Integer.MAX_VALUE; i++) {
|
||||||
ConfigurationPropertyName name = root
|
ConfigurationPropertyName name = root
|
||||||
.append(i == 0 ? INDEX_ZERO : "[" + i + "]");
|
.append(i != 0 ? "[" + i + "]" : INDEX_ZERO);
|
||||||
Object value = elementBinder.bind(name, Bindable.of(elementType), source);
|
Object value = elementBinder.bind(name, Bindable.of(elementType), source);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -287,7 +287,7 @@ class JavaBeanBinder implements BeanBinder {
|
||||||
|
|
||||||
public Annotation[] getAnnotations() {
|
public Annotation[] getAnnotations() {
|
||||||
try {
|
try {
|
||||||
return (this.field == null ? null : this.field.getDeclaredAnnotations());
|
return (this.field != null ? this.field.getDeclaredAnnotations() : null);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -55,8 +55,8 @@ class MapBinder extends AggregateBinder<Map<Object, Object>> {
|
||||||
@Override
|
@Override
|
||||||
protected Object bindAggregate(ConfigurationPropertyName name, Bindable<?> target,
|
protected Object bindAggregate(ConfigurationPropertyName name, Bindable<?> target,
|
||||||
AggregateElementBinder elementBinder) {
|
AggregateElementBinder elementBinder) {
|
||||||
Map<Object, Object> map = CollectionFactory.createMap((target.getValue() == null
|
Map<Object, Object> map = CollectionFactory.createMap((target.getValue() != null
|
||||||
? target.getType().resolve(Object.class) : Map.class), 0);
|
? Map.class : target.getType().resolve(Object.class)), 0);
|
||||||
Bindable<?> resolvedTarget = resolveTarget(target);
|
Bindable<?> resolvedTarget = resolveTarget(target);
|
||||||
boolean hasDescendants = getContext().streamSources().anyMatch((source) -> source
|
boolean hasDescendants = getContext().streamSources().anyMatch((source) -> source
|
||||||
.containsDescendantOf(name) == ConfigurationPropertyState.PRESENT);
|
.containsDescendantOf(name) == ConfigurationPropertyState.PRESENT);
|
||||||
|
@ -197,7 +197,7 @@ class MapBinder extends AggregateBinder<Map<Object, Object>> {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
for (int i = this.root.getNumberOfElements(); i < name
|
for (int i = this.root.getNumberOfElements(); i < name
|
||||||
.getNumberOfElements(); i++) {
|
.getNumberOfElements(); i++) {
|
||||||
result.append(result.length() == 0 ? "" : ".");
|
result.append(result.length() != 0 ? "." : "");
|
||||||
result.append(name.getElement(i, Form.ORIGINAL));
|
result.append(name.getElement(i, Form.ORIGINAL));
|
||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class IgnoreErrorsBindHandler extends AbstractBindHandler {
|
||||||
@Override
|
@Override
|
||||||
public Object onFailure(ConfigurationPropertyName name, Bindable<?> target,
|
public Object onFailure(ConfigurationPropertyName name, Bindable<?> target,
|
||||||
BindContext context, Exception error) throws Exception {
|
BindContext context, Exception error) throws Exception {
|
||||||
return (target.getValue() == null ? null : target.getValue().get());
|
return (target.getValue() != null ? target.getValue().get() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ public final class ConfigurationPropertyName
|
||||||
*/
|
*/
|
||||||
public String getLastElement(Form form) {
|
public String getLastElement(Form form) {
|
||||||
int size = getNumberOfElements();
|
int size = getNumberOfElements();
|
||||||
return (size == 0 ? EMPTY_STRING : getElement(size - 1, form));
|
return (size != 0 ? getElement(size - 1, form) : EMPTY_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -316,7 +316,7 @@ public final class ConfigurationPropertyName
|
||||||
else {
|
else {
|
||||||
for (int i = 0; i < element.length(); i++) {
|
for (int i = 0; i < element.length(); i++) {
|
||||||
char ch = Character.toLowerCase(element.charAt(i));
|
char ch = Character.toLowerCase(element.charAt(i));
|
||||||
result.append(ch == '_' ? "" : ch);
|
result.append(ch != '_' ? ch : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ConfigurationPropertySourcesPropertySource
|
||||||
@Override
|
@Override
|
||||||
public Object getProperty(String name) {
|
public Object getProperty(String name) {
|
||||||
ConfigurationProperty configurationProperty = findConfigurationProperty(name);
|
ConfigurationProperty configurationProperty = findConfigurationProperty(name);
|
||||||
return (configurationProperty == null ? null : configurationProperty.getValue());
|
return (configurationProperty != null ? configurationProperty.getValue() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class MapConfigurationPropertySource
|
||||||
* @param value the value
|
* @param value the value
|
||||||
*/
|
*/
|
||||||
public void put(Object name, Object value) {
|
public void put(Object name, Object value) {
|
||||||
this.source.put((name == null ? null : name.toString()), value);
|
this.source.put((name != null ? name.toString() : null), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -74,7 +74,7 @@ final class CollectionToDelimitedStringConverter implements ConditionalGenericCo
|
||||||
Delimiter delimiter = sourceType.getAnnotation(Delimiter.class);
|
Delimiter delimiter = sourceType.getAnnotation(Delimiter.class);
|
||||||
return source.stream()
|
return source.stream()
|
||||||
.map((element) -> convertElement(element, sourceType, targetType))
|
.map((element) -> convertElement(element, sourceType, targetType))
|
||||||
.collect(Collectors.joining(delimiter == null ? "," : delimiter.value()));
|
.collect(Collectors.joining(delimiter != null ? delimiter.value() : ","));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String convertElement(Object element, TypeDescriptor sourceType,
|
private String convertElement(Object element, TypeDescriptor sourceType,
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue