Upgrade to spring-javaformat 0.0.6
This commit is contained in:
@@ -232,7 +232,7 @@ public class AutoConfigurationImportSelector
|
||||
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(getEnvironment(),
|
||||
"spring.autoconfigure.");
|
||||
String[] exclude = resolver.getProperty("exclude", String[].class);
|
||||
return (Arrays.asList(exclude != null ? exclude : new String[0]));
|
||||
return Arrays.asList((exclude != null) ? exclude : new String[0]);
|
||||
}
|
||||
|
||||
private List<String> sort(List<String> configurations,
|
||||
@@ -298,7 +298,7 @@ public class AutoConfigurationImportSelector
|
||||
|
||||
protected final List<String> asList(AnnotationAttributes attributes, String name) {
|
||||
String[] value = attributes.getStringArray(name);
|
||||
return Arrays.asList(value != null ? value : new String[0]);
|
||||
return Arrays.asList((value != null) ? value : new String[0]);
|
||||
}
|
||||
|
||||
private void fireAutoConfigurationImportEvents(List<String> configurations,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,8 +45,8 @@ final class AutoConfigurationMetadataLoader {
|
||||
|
||||
static AutoConfigurationMetadata loadMetadata(ClassLoader classLoader, String path) {
|
||||
try {
|
||||
Enumeration<URL> urls = (classLoader != null ? classLoader.getResources(path)
|
||||
: ClassLoader.getSystemResources(path));
|
||||
Enumeration<URL> urls = (classLoader != null) ? classLoader.getResources(path)
|
||||
: ClassLoader.getSystemResources(path);
|
||||
Properties properties = new Properties();
|
||||
while (urls.hasMoreElements()) {
|
||||
properties.putAll(PropertiesLoaderUtils
|
||||
@@ -89,7 +89,7 @@ final class AutoConfigurationMetadataLoader {
|
||||
@Override
|
||||
public Integer getInteger(String className, String key, Integer defaultValue) {
|
||||
String value = get(className, key);
|
||||
return (value != null ? Integer.valueOf(value) : defaultValue);
|
||||
return (value != null) ? Integer.valueOf(value) : defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,8 +101,8 @@ final class AutoConfigurationMetadataLoader {
|
||||
public Set<String> getSet(String className, String key,
|
||||
Set<String> defaultValue) {
|
||||
String value = get(className, key);
|
||||
return (value != null ? StringUtils.commaDelimitedListToSet(value)
|
||||
: defaultValue);
|
||||
return (value != null) ? StringUtils.commaDelimitedListToSet(value)
|
||||
: defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,7 +113,7 @@ final class AutoConfigurationMetadataLoader {
|
||||
@Override
|
||||
public String get(String className, String key, String defaultValue) {
|
||||
String value = this.properties.getProperty(className + "." + key);
|
||||
return (value != null ? value : defaultValue);
|
||||
return (value != null) ? value : defaultValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -150,9 +150,8 @@ public abstract class AutoConfigurationPackages {
|
||||
this.packageName = ClassUtils.getPackageName(metadata.getClassName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.packageName.hashCode();
|
||||
public String getPackageName() {
|
||||
return this.packageName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,8 +162,9 @@ public abstract class AutoConfigurationPackages {
|
||||
return this.packageName.equals(((PackageImport) obj).packageName);
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return this.packageName;
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.packageName.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -66,7 +66,7 @@ class AutoConfigurationSorter {
|
||||
public int compare(String o1, String o2) {
|
||||
int i1 = classes.get(o1).getOrder();
|
||||
int i2 = classes.get(o2).getOrder();
|
||||
return (i1 < i2 ? -1 : (i1 > i2 ? 1 : 0));
|
||||
return (i1 < i2) ? -1 : (i1 > i2) ? 1 : 0;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -174,8 +174,8 @@ class AutoConfigurationSorter {
|
||||
}
|
||||
Map<String, Object> attributes = getAnnotationMetadata()
|
||||
.getAnnotationAttributes(AutoConfigureOrder.class.getName());
|
||||
return (attributes != null ? (Integer) attributes.get("value")
|
||||
: Ordered.LOWEST_PRECEDENCE);
|
||||
return (attributes != null) ? (Integer) attributes.get("value")
|
||||
: Ordered.LOWEST_PRECEDENCE;
|
||||
}
|
||||
|
||||
private Set<String> readBefore() {
|
||||
|
||||
@@ -111,8 +111,8 @@ class ImportAutoConfigurationImportSelector extends AutoConfigurationImportSelec
|
||||
for (String annotationName : ANNOTATION_NAMES) {
|
||||
AnnotationAttributes merged = AnnotatedElementUtils
|
||||
.getMergedAnnotationAttributes(source, annotationName);
|
||||
Class<?>[] exclude = (merged != null ? merged.getClassArray("exclude")
|
||||
: null);
|
||||
Class<?>[] exclude = (merged != null) ? merged.getClassArray("exclude")
|
||||
: null;
|
||||
if (exclude != null) {
|
||||
for (Class<?> excludeClass : exclude) {
|
||||
exclusions.add(excludeClass.getName());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -189,7 +189,7 @@ public class RabbitAutoConfiguration {
|
||||
|
||||
private boolean determineMandatoryFlag() {
|
||||
Boolean mandatory = this.properties.getTemplate().getMandatory();
|
||||
return (mandatory != null ? mandatory : this.properties.isPublisherReturns());
|
||||
return (mandatory != null) ? mandatory : this.properties.isPublisherReturns();
|
||||
}
|
||||
|
||||
private RetryTemplate createRetryTemplate(RabbitProperties.Retry properties) {
|
||||
|
||||
@@ -203,7 +203,7 @@ public class RabbitProperties {
|
||||
return this.username;
|
||||
}
|
||||
Address address = this.parsedAddresses.get(0);
|
||||
return (address.username != null ? address.username : this.username);
|
||||
return (address.username != null) ? address.username : this.username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
@@ -226,7 +226,7 @@ public class RabbitProperties {
|
||||
return getPassword();
|
||||
}
|
||||
Address address = this.parsedAddresses.get(0);
|
||||
return (address.password != null ? address.password : getPassword());
|
||||
return (address.password != null) ? address.password : getPassword();
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
@@ -253,7 +253,7 @@ public class RabbitProperties {
|
||||
return getVirtualHost();
|
||||
}
|
||||
Address address = this.parsedAddresses.get(0);
|
||||
return (address.virtualHost != null ? address.virtualHost : getVirtualHost());
|
||||
return (address.virtualHost != null) ? address.virtualHost : getVirtualHost();
|
||||
}
|
||||
|
||||
public void setVirtualHost(String virtualHost) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -113,8 +113,8 @@ public final class SimpleRabbitListenerContainerFactoryConfigurer {
|
||||
builder.maxAttempts(retryConfig.getMaxAttempts());
|
||||
builder.backOffOptions(retryConfig.getInitialInterval(),
|
||||
retryConfig.getMultiplier(), retryConfig.getMaxInterval());
|
||||
MessageRecoverer recoverer = (this.messageRecoverer != null
|
||||
? this.messageRecoverer : new RejectAndDontRequeueRecoverer());
|
||||
MessageRecoverer recoverer = (this.messageRecoverer != null)
|
||||
? this.messageRecoverer : new RejectAndDontRequeueRecoverer();
|
||||
builder.recoverer(recoverer);
|
||||
factory.setAdviceChain(builder.build());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,9 +41,9 @@ public class CacheManagerCustomizers {
|
||||
|
||||
public CacheManagerCustomizers(
|
||||
List<? extends CacheManagerCustomizer<?>> customizers) {
|
||||
this.customizers = (customizers != null
|
||||
this.customizers = (customizers != null)
|
||||
? new ArrayList<CacheManagerCustomizer<?>>(customizers)
|
||||
: Collections.<CacheManagerCustomizer<?>>emptyList());
|
||||
: Collections.<CacheManagerCustomizer<?>>emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -146,8 +146,8 @@ abstract class AbstractNestedCondition extends SpringBootCondition
|
||||
private List<String[]> getConditionClasses(AnnotatedTypeMetadata metadata) {
|
||||
MultiValueMap<String, Object> attributes = metadata
|
||||
.getAllAnnotationAttributes(Conditional.class.getName(), true);
|
||||
Object values = (attributes != null ? attributes.get("value") : null);
|
||||
return (List<String[]>) (values != null ? values : Collections.emptyList());
|
||||
Object values = (attributes != null) ? attributes.get("value") : null;
|
||||
return (List<String[]>) ((values != null) ? values : Collections.emptyList());
|
||||
}
|
||||
|
||||
private Condition getCondition(String conditionClassName) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -46,8 +46,8 @@ class ConditionEvaluationReportAutoConfigurationImportListener
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
this.beanFactory = (beanFactory instanceof ConfigurableListableBeanFactory
|
||||
? (ConfigurableListableBeanFactory) beanFactory : null);
|
||||
this.beanFactory = (beanFactory instanceof ConfigurableListableBeanFactory)
|
||||
? (ConfigurableListableBeanFactory) beanFactory : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,16 +59,6 @@ public final class ConditionMessage {
|
||||
return !StringUtils.hasLength(this.message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (this.message != null ? this.message : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(this.message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null || !ConditionMessage.class.isInstance(obj)) {
|
||||
@@ -80,6 +70,16 @@ public final class ConditionMessage {
|
||||
return ObjectUtils.nullSafeEquals(((ConditionMessage) obj).message, this.message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(this.message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (this.message != null) ? this.message : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new {@link ConditionMessage} based on the instance and an appended
|
||||
* message.
|
||||
@@ -359,7 +359,7 @@ public final class ConditionMessage {
|
||||
*/
|
||||
public ConditionMessage items(Style style, Object... items) {
|
||||
return items(style,
|
||||
items != null ? Arrays.asList(items) : (Collection<?>) null);
|
||||
(items != null) ? Arrays.asList(items) : (Collection<?>) null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -416,7 +416,7 @@ public final class ConditionMessage {
|
||||
QUOTE {
|
||||
@Override
|
||||
protected String applyToItem(Object item) {
|
||||
return (item != null ? "'" + item + "'" : null);
|
||||
return (item != null) ? "'" + item + "'" : null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -122,12 +122,6 @@ public class ConditionOutcome {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtils.hashCode(this.match) * 31
|
||||
+ ObjectUtils.nullSafeHashCode(this.message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
@@ -144,9 +138,15 @@ public class ConditionOutcome {
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return ObjectUtils.hashCode(this.match) * 31
|
||||
+ ObjectUtils.nullSafeHashCode(this.message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (this.message != null ? this.message.toString() : "");
|
||||
return (this.message != null) ? this.message.toString() : "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -365,7 +365,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
|
||||
}
|
||||
|
||||
public SearchStrategy getStrategy() {
|
||||
return (this.strategy != null ? this.strategy : SearchStrategy.ALL);
|
||||
return (this.strategy != null) ? this.strategy : SearchStrategy.ALL;
|
||||
}
|
||||
|
||||
public List<String> getNames() {
|
||||
|
||||
@@ -53,7 +53,7 @@ class OnJavaCondition extends SpringBootCondition {
|
||||
JavaVersion version) {
|
||||
boolean match = runningVersion.isWithin(range, version);
|
||||
String expected = String.format(
|
||||
range != Range.EQUAL_OR_NEWER ? "(older than %s)" : "(%s or newer)",
|
||||
(range != Range.EQUAL_OR_NEWER) ? "(older than %s)" : "(%s or newer)",
|
||||
version);
|
||||
ConditionMessage message = ConditionMessage
|
||||
.forCondition(ConditionalOnJava.class, expected)
|
||||
|
||||
@@ -145,7 +145,7 @@ class OnPropertyCondition extends SpringBootCondition {
|
||||
"The name or value attribute of @ConditionalOnProperty must be specified");
|
||||
Assert.state(value.length == 0 || name.length == 0,
|
||||
"The name and value attributes of @ConditionalOnProperty are exclusive");
|
||||
return (value.length > 0 ? value : name);
|
||||
return (value.length > 0) ? value : name;
|
||||
}
|
||||
|
||||
private void collectProperties(PropertyResolver resolver, List<String> missing,
|
||||
|
||||
@@ -46,8 +46,8 @@ class OnResourceCondition extends SpringBootCondition {
|
||||
AnnotatedTypeMetadata metadata) {
|
||||
MultiValueMap<String, Object> attributes = metadata
|
||||
.getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true);
|
||||
ResourceLoader loader = (context.getResourceLoader() != null
|
||||
? context.getResourceLoader() : this.defaultResourceLoader);
|
||||
ResourceLoader loader = (context.getResourceLoader() != null)
|
||||
? context.getResourceLoader() : this.defaultResourceLoader;
|
||||
List<String> locations = new ArrayList<String>();
|
||||
collectValues(locations, attributes.get("resources"));
|
||||
Assert.isTrue(!locations.isEmpty(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -174,8 +174,8 @@ public class CouchbaseProperties {
|
||||
private String keyStorePassword;
|
||||
|
||||
public Boolean getEnabled() {
|
||||
return (this.enabled != null ? this.enabled
|
||||
: StringUtils.hasText(this.keyStore));
|
||||
return (this.enabled != null) ? this.enabled
|
||||
: StringUtils.hasText(this.keyStore);
|
||||
}
|
||||
|
||||
public void setEnabled(Boolean enabled) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,7 +50,7 @@ public class PersistenceExceptionTranslationAutoConfiguration {
|
||||
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment,
|
||||
"spring.aop.");
|
||||
Boolean value = resolver.getProperty("proxyTargetClass", Boolean.class);
|
||||
return (value != null ? value : true);
|
||||
return (value != null) ? value : true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -195,9 +195,8 @@ public class RedisAutoConfiguration {
|
||||
}
|
||||
|
||||
private JedisConnectionFactory createJedisConnectionFactory() {
|
||||
JedisPoolConfig poolConfig = (this.properties.getPool() != null
|
||||
? jedisPoolConfig() : new JedisPoolConfig());
|
||||
|
||||
JedisPoolConfig poolConfig = (this.properties.getPool() != null)
|
||||
? jedisPoolConfig() : new JedisPoolConfig();
|
||||
if (getSentinelConfig() != null) {
|
||||
return new JedisConnectionFactory(getSentinelConfig(), poolConfig);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class NoSuchBeanDefinitionFailureAnalyzer
|
||||
cause);
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append(String.format("%s required %s that could not be found.%n",
|
||||
(description != null ? description : "A component"),
|
||||
(description != null) ? description : "A component",
|
||||
getBeanDescription(cause)));
|
||||
if (!autoConfigurationResults.isEmpty()) {
|
||||
for (AutoConfigurationResult provider : autoConfigurationResults) {
|
||||
@@ -164,8 +164,8 @@ class NoSuchBeanDefinitionFailureAnalyzer
|
||||
|
||||
Source(String source) {
|
||||
String[] tokens = source.split("#");
|
||||
this.className = (tokens.length > 1 ? tokens[0] : source);
|
||||
this.methodName = (tokens.length != 2 ? null : tokens[1]);
|
||||
this.className = (tokens.length > 1) ? tokens[0] : source;
|
||||
this.methodName = (tokens.length != 2) ? null : tokens[1];
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
@@ -225,8 +225,8 @@ class NoSuchBeanDefinitionFailureAnalyzer
|
||||
private boolean hasName(MethodMetadata methodMetadata, String name) {
|
||||
Map<String, Object> attributes = methodMetadata
|
||||
.getAnnotationAttributes(Bean.class.getName());
|
||||
String[] candidates = (attributes != null ? (String[]) attributes.get("name")
|
||||
: null);
|
||||
String[] candidates = (attributes != null) ? (String[]) attributes.get("name")
|
||||
: null;
|
||||
if (candidates != null) {
|
||||
for (String candidate : candidates) {
|
||||
if (candidate.equals(name)) {
|
||||
|
||||
@@ -108,7 +108,7 @@ public class FlywayProperties {
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return (this.password != null ? this.password : "");
|
||||
return (this.password != null) ? this.password : "";
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
|
||||
@@ -184,7 +184,7 @@ public class DataSourceAutoConfiguration {
|
||||
private ClassLoader getDataSourceClassLoader(ConditionContext context) {
|
||||
Class<?> dataSourceClass = new DataSourceBuilder(context.getClassLoader())
|
||||
.findType();
|
||||
return (dataSourceClass != null ? dataSourceClass.getClassLoader() : null);
|
||||
return (dataSourceClass != null) ? dataSourceClass.getClassLoader() : null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public enum EmbeddedDatabaseConnection {
|
||||
*/
|
||||
public String getUrl(String databaseName) {
|
||||
Assert.hasText(databaseName, "DatabaseName must not be null.");
|
||||
return (this.url != null ? String.format(this.url, databaseName) : null);
|
||||
return (this.url != null) ? String.format(this.url, databaseName) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,9 +41,9 @@ public class DataSourcePoolMetadataProviders implements DataSourcePoolMetadataPr
|
||||
*/
|
||||
public DataSourcePoolMetadataProviders(
|
||||
Collection<? extends DataSourcePoolMetadataProvider> providers) {
|
||||
this.providers = (providers != null
|
||||
this.providers = (providers != null)
|
||||
? new ArrayList<DataSourcePoolMetadataProvider>(providers)
|
||||
: Collections.<DataSourcePoolMetadataProvider>emptyList());
|
||||
: Collections.<DataSourcePoolMetadataProvider>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,7 +34,7 @@ public class TomcatDataSourcePoolMetadata
|
||||
@Override
|
||||
public Integer getActive() {
|
||||
ConnectionPool pool = getDataSource().getPool();
|
||||
return (pool != null ? pool.getActive() : 0);
|
||||
return (pool != null) ? pool.getActive() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -124,11 +124,11 @@ public class JmsProperties {
|
||||
|
||||
public String formatConcurrency() {
|
||||
if (this.concurrency == null) {
|
||||
return (this.maxConcurrency != null ? "1-" + this.maxConcurrency : null);
|
||||
return (this.maxConcurrency != null) ? "1-" + this.maxConcurrency : null;
|
||||
}
|
||||
return (this.maxConcurrency != null
|
||||
return (this.maxConcurrency != null)
|
||||
? this.concurrency + "-" + this.maxConcurrency
|
||||
: String.valueOf(this.concurrency));
|
||||
: String.valueOf(this.concurrency);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ class ActiveMQConnectionFactoryFactory {
|
||||
List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
|
||||
Assert.notNull(properties, "Properties must not be null");
|
||||
this.properties = properties;
|
||||
this.factoryCustomizers = (factoryCustomizers != null ? factoryCustomizers
|
||||
: Collections.<ActiveMQConnectionFactoryCustomizer>emptyList());
|
||||
this.factoryCustomizers = (factoryCustomizers != null) ? factoryCustomizers
|
||||
: Collections.<ActiveMQConnectionFactoryCustomizer>emptyList();
|
||||
}
|
||||
|
||||
public <T extends ActiveMQConnectionFactory> T createConnectionFactory(
|
||||
|
||||
@@ -159,7 +159,7 @@ public class MongoProperties {
|
||||
}
|
||||
|
||||
public String determineUri() {
|
||||
return (this.uri != null ? this.uri : DEFAULT_URI);
|
||||
return (this.uri != null) ? this.uri : DEFAULT_URI;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
@@ -226,7 +226,7 @@ public class MongoProperties {
|
||||
if (options == null) {
|
||||
options = MongoClientOptions.builder().build();
|
||||
}
|
||||
String host = (this.host != null ? this.host : "localhost");
|
||||
String host = (this.host != null) ? this.host : "localhost";
|
||||
return new MongoClient(Collections.singletonList(new ServerAddress(host, port)),
|
||||
Collections.<MongoCredential>emptyList(), options);
|
||||
}
|
||||
@@ -242,13 +242,13 @@ public class MongoProperties {
|
||||
}
|
||||
List<MongoCredential> credentials = new ArrayList<MongoCredential>();
|
||||
if (hasCustomCredentials()) {
|
||||
String database = (this.authenticationDatabase != null
|
||||
? this.authenticationDatabase : getMongoClientDatabase());
|
||||
String database = (this.authenticationDatabase != null)
|
||||
? this.authenticationDatabase : getMongoClientDatabase();
|
||||
credentials.add(MongoCredential.createCredential(this.username, database,
|
||||
this.password));
|
||||
}
|
||||
String host = (this.host != null ? this.host : "localhost");
|
||||
int port = (this.port != null ? this.port : DEFAULT_PORT);
|
||||
String host = (this.host != null) ? this.host : "localhost";
|
||||
int port = (this.port != null) ? this.port : DEFAULT_PORT;
|
||||
return new MongoClient(
|
||||
Collections.singletonList(new ServerAddress(host, port)), credentials,
|
||||
options);
|
||||
|
||||
@@ -128,13 +128,13 @@ public class EmbeddedMongoAutoConfiguration {
|
||||
this.embeddedProperties.getFeatures());
|
||||
MongodConfigBuilder builder = new MongodConfigBuilder()
|
||||
.version(featureAwareVersion);
|
||||
if (this.embeddedProperties.getStorage() != null) {
|
||||
builder.replication(
|
||||
new Storage(this.embeddedProperties.getStorage().getDatabaseDir(),
|
||||
this.embeddedProperties.getStorage().getReplSetName(),
|
||||
this.embeddedProperties.getStorage().getOplogSize() != null
|
||||
? this.embeddedProperties.getStorage().getOplogSize()
|
||||
: 0));
|
||||
org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoProperties.Storage storage = this.embeddedProperties
|
||||
.getStorage();
|
||||
if (storage != null) {
|
||||
String databaseDir = storage.getDatabaseDir();
|
||||
String replSetName = storage.getReplSetName();
|
||||
int oplogSize = (storage.getOplogSize() != null) ? storage.getOplogSize() : 0;
|
||||
builder.replication(new Storage(databaseDir, replSetName, oplogSize));
|
||||
}
|
||||
Integer configuredPort = this.properties.getPort();
|
||||
if (configuredPort != null && configuredPort > 0) {
|
||||
@@ -239,8 +239,8 @@ public class EmbeddedMongoAutoConfiguration {
|
||||
Set<Feature> features) {
|
||||
Assert.notNull(version, "version must not be null");
|
||||
this.version = version;
|
||||
this.features = (features != null ? features
|
||||
: Collections.<Feature>emptySet());
|
||||
this.features = (features != null) ? features
|
||||
: Collections.<Feature>emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -253,20 +253,6 @@ public class EmbeddedMongoAutoConfiguration {
|
||||
return this.features.contains(feature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + this.features.hashCode();
|
||||
result = prime * result + this.version.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
@@ -285,6 +271,20 @@ public class EmbeddedMongoAutoConfiguration {
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + this.features.hashCode();
|
||||
result = prime * result + this.version.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -81,8 +81,8 @@ class DataSourceInitializedPublisher implements BeanPostProcessor {
|
||||
private DataSource findDataSource(EntityManagerFactory entityManagerFactory) {
|
||||
Object dataSource = entityManagerFactory.getProperties()
|
||||
.get("javax.persistence.nonJtaDataSource");
|
||||
return (dataSource != null && dataSource instanceof DataSource
|
||||
? (DataSource) dataSource : this.dataSource);
|
||||
return (dataSource != null && dataSource instanceof DataSource)
|
||||
? (DataSource) dataSource : this.dataSource;
|
||||
}
|
||||
|
||||
private boolean isInitializingDatabase(DataSource dataSource) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -210,8 +210,8 @@ public class JpaProperties {
|
||||
|
||||
private String getOrDeduceDdlAuto(Map<String, String> existing,
|
||||
DataSource dataSource) {
|
||||
String ddlAuto = (this.ddlAuto != null ? this.ddlAuto
|
||||
: getDefaultDdlAuto(dataSource));
|
||||
String ddlAuto = (this.ddlAuto != null) ? this.ddlAuto
|
||||
: getDefaultDdlAuto(dataSource);
|
||||
if (!existing.containsKey("hibernate." + "hbm2ddl.auto")
|
||||
&& !"none".equals(ddlAuto)) {
|
||||
return ddlAuto;
|
||||
|
||||
@@ -283,7 +283,7 @@ public class SpringBootWebSecurityConfiguration {
|
||||
private String[] getSecureApplicationPaths() {
|
||||
List<String> list = new ArrayList<String>();
|
||||
for (String path : this.security.getBasic().getPath()) {
|
||||
path = (path != null ? path.trim() : "");
|
||||
path = (path != null) ? path.trim() : "";
|
||||
if (path.equals("/**")) {
|
||||
return new String[] { path };
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class DefaultUserInfoRestTemplateFactory implements UserInfoRestTemplateF
|
||||
public OAuth2RestTemplate getUserInfoRestTemplate() {
|
||||
if (this.oauth2RestTemplate == null) {
|
||||
this.oauth2RestTemplate = createOAuth2RestTemplate(
|
||||
this.details != null ? this.details : DEFAULT_RESOURCE_DETAILS);
|
||||
(this.details != null) ? this.details : DEFAULT_RESOURCE_DETAILS);
|
||||
this.oauth2RestTemplate.getInterceptors()
|
||||
.add(new AcceptJsonRequestInterceptor());
|
||||
AuthorizationCodeAccessTokenProvider accessTokenProvider = new AuthorizationCodeAccessTokenProvider();
|
||||
|
||||
@@ -115,7 +115,7 @@ public class UserInfoTokenServices implements ResourceServerTokenServices {
|
||||
*/
|
||||
protected Object getPrincipal(Map<String, Object> map) {
|
||||
Object principal = this.principalExtractor.extractPrincipal(map);
|
||||
return (principal != null ? principal : "unknown");
|
||||
return (principal != null) ? principal : "unknown";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,7 +50,7 @@ public class SessionProperties {
|
||||
|
||||
public SessionProperties(ObjectProvider<ServerProperties> serverProperties) {
|
||||
ServerProperties properties = serverProperties.getIfUnique();
|
||||
this.timeout = (properties != null ? properties.getSession().getTimeout() : null);
|
||||
this.timeout = (properties != null) ? properties.getSession().getTimeout() : null;
|
||||
}
|
||||
|
||||
public StoreType getStoreType() {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class FacebookAutoConfiguration {
|
||||
public Facebook facebook(ConnectionRepository repository) {
|
||||
Connection<Facebook> connection = repository
|
||||
.findPrimaryConnection(Facebook.class);
|
||||
return (connection != null ? connection.getApi() : null);
|
||||
return (connection != null) ? connection.getApi() : null;
|
||||
}
|
||||
|
||||
@Bean(name = { "connect/facebookConnect", "connect/facebookConnected" })
|
||||
|
||||
@@ -70,7 +70,7 @@ public class LinkedInAutoConfiguration {
|
||||
public LinkedIn linkedin(ConnectionRepository repository) {
|
||||
Connection<LinkedIn> connection = repository
|
||||
.findPrimaryConnection(LinkedIn.class);
|
||||
return (connection != null ? connection.getApi() : null);
|
||||
return (connection != null) ? connection.getApi() : null;
|
||||
}
|
||||
|
||||
@Bean(name = { "connect/linkedinConnect", "connect/linkedinConnected" })
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -119,7 +119,7 @@ public abstract class AbstractViewResolverProperties {
|
||||
}
|
||||
|
||||
public String getCharsetName() {
|
||||
return (this.charset != null ? this.charset.name() : null);
|
||||
return (this.charset != null) ? this.charset.name() : null;
|
||||
}
|
||||
|
||||
public void setCharset(Charset charset) {
|
||||
|
||||
@@ -76,7 +76,7 @@ public class TemplateAvailabilityProviders {
|
||||
* @param applicationContext the source application context
|
||||
*/
|
||||
public TemplateAvailabilityProviders(ApplicationContext applicationContext) {
|
||||
this(applicationContext != null ? applicationContext.getClassLoader() : null);
|
||||
this((applicationContext != null) ? applicationContext.getClassLoader() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,12 +144,12 @@ public class TemplateAvailabilityProviders {
|
||||
if (provider == null) {
|
||||
synchronized (this.cache) {
|
||||
provider = findProvider(view, environment, classLoader, resourceLoader);
|
||||
provider = (provider != null ? provider : NONE);
|
||||
provider = (provider != null) ? provider : NONE;
|
||||
this.resolved.put(view, provider);
|
||||
this.cache.put(view, provider);
|
||||
}
|
||||
}
|
||||
return (provider != NONE ? provider : null);
|
||||
return (provider != NONE) ? provider : null;
|
||||
}
|
||||
|
||||
private TemplateAvailabilityProvider findProvider(String view,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,7 +23,7 @@ import org.springframework.transaction.PlatformTransactionManager;
|
||||
* {@link PlatformTransactionManager PlatformTransactionManagers} whilst retaining default
|
||||
* auto-configuration.
|
||||
*
|
||||
* @param <T> The transaction manager type
|
||||
* @param <T> the transaction manager type
|
||||
* @author Phillip Webb
|
||||
* @since 1.5.0
|
||||
*/
|
||||
|
||||
@@ -41,9 +41,9 @@ public class TransactionManagerCustomizers {
|
||||
|
||||
public TransactionManagerCustomizers(
|
||||
Collection<? extends PlatformTransactionManagerCustomizer<?>> customizers) {
|
||||
this.customizers = (customizers != null
|
||||
this.customizers = (customizers != null)
|
||||
? new ArrayList<PlatformTransactionManagerCustomizer<?>>(customizers)
|
||||
: null);
|
||||
: null;
|
||||
}
|
||||
|
||||
public void customize(PlatformTransactionManager transactionManager) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -72,7 +72,7 @@ public class ValidationAutoConfiguration {
|
||||
RelaxedPropertyResolver resolver = new RelaxedPropertyResolver(environment,
|
||||
"spring.aop.");
|
||||
Boolean value = resolver.getProperty("proxyTargetClass", Boolean.class);
|
||||
return (value != null ? value : true);
|
||||
return (value != null) ? value : true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class BasicErrorController extends AbstractErrorController {
|
||||
request, isIncludeStackTrace(request, MediaType.TEXT_HTML)));
|
||||
response.setStatus(status.value());
|
||||
ModelAndView modelAndView = resolveErrorView(request, response, status, model);
|
||||
return (modelAndView != null ? modelAndView : new ModelAndView("error", model));
|
||||
return (modelAndView != null) ? modelAndView : new ModelAndView("error", model);
|
||||
}
|
||||
|
||||
@RequestMapping
|
||||
|
||||
@@ -283,11 +283,12 @@ public class ErrorMvcAutoConfiguration {
|
||||
@Override
|
||||
public String resolvePlaceholder(String placeholderName) {
|
||||
Expression expression = this.expressions.get(placeholderName);
|
||||
return escape(expression != null ? expression.getValue(this.context) : null);
|
||||
return escape(
|
||||
(expression != null) ? expression.getValue(this.context) : null);
|
||||
}
|
||||
|
||||
private String escape(Object value) {
|
||||
return HtmlUtils.htmlEscape(value != null ? value.toString() : null);
|
||||
return HtmlUtils.htmlEscape((value != null) ? value.toString() : null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class HttpEncodingProperties {
|
||||
}
|
||||
|
||||
boolean shouldForce(Type type) {
|
||||
Boolean force = (type != Type.REQUEST ? this.forceResponse : this.forceRequest);
|
||||
Boolean force = (type != Type.REQUEST) ? this.forceResponse : this.forceRequest;
|
||||
if (force == null) {
|
||||
force = this.force;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class HttpMessageConvertersAutoConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public HttpMessageConverters messageConverters() {
|
||||
return new HttpMessageConverters(this.converters != null ? this.converters
|
||||
return new HttpMessageConverters((this.converters != null) ? this.converters
|
||||
: Collections.<HttpMessageConverter<?>>emptyList());
|
||||
}
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ public class ResourceProperties implements ResourceLoaderAware, InitializingBean
|
||||
|
||||
static Boolean getEnabled(boolean fixedEnabled, boolean contentEnabled,
|
||||
Boolean chainEnabled) {
|
||||
return (fixedEnabled || contentEnabled ? Boolean.TRUE : chainEnabled);
|
||||
return (fixedEnabled || contentEnabled) ? Boolean.TRUE : chainEnabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ public class ServerProperties
|
||||
return this.useForwardHeaders;
|
||||
}
|
||||
CloudPlatform platform = CloudPlatform.getActive(this.environment);
|
||||
return (platform != null ? platform.isUsingForwardHeaders() : false);
|
||||
return (platform != null) ? platform.isUsingForwardHeaders() : false;
|
||||
}
|
||||
|
||||
public Integer getConnectionTimeout() {
|
||||
@@ -830,8 +830,8 @@ public class ServerProperties
|
||||
if (this.minSpareThreads > 0) {
|
||||
customizeMinThreads(factory);
|
||||
}
|
||||
int maxHttpHeaderSize = (serverProperties.getMaxHttpHeaderSize() > 0
|
||||
? serverProperties.getMaxHttpHeaderSize() : this.maxHttpHeaderSize);
|
||||
int maxHttpHeaderSize = (serverProperties.getMaxHttpHeaderSize() > 0)
|
||||
? serverProperties.getMaxHttpHeaderSize() : this.maxHttpHeaderSize;
|
||||
if (maxHttpHeaderSize > 0) {
|
||||
customizeMaxHttpHeaderSize(factory, maxHttpHeaderSize);
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ public class WebMvcAutoConfiguration {
|
||||
@Override
|
||||
public RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
|
||||
RequestMappingHandlerAdapter adapter = super.requestMappingHandlerAdapter();
|
||||
adapter.setIgnoreDefaultModelOnRedirect(this.mvcProperties != null
|
||||
adapter.setIgnoreDefaultModelOnRedirect((this.mvcProperties != null)
|
||||
? this.mvcProperties.isIgnoreDefaultModelOnRedirect() : true);
|
||||
return adapter;
|
||||
}
|
||||
|
||||
@@ -96,8 +96,8 @@ public class HazelcastJpaDependencyAutoConfigurationTests {
|
||||
private List<String> getEntityManagerFactoryDependencies() {
|
||||
String[] dependsOn = this.context.getBeanDefinition("entityManagerFactory")
|
||||
.getDependsOn();
|
||||
return (dependsOn != null ? Arrays.asList(dependsOn)
|
||||
: Collections.<String>emptyList());
|
||||
return (dependsOn != null) ? Arrays.asList(dependsOn)
|
||||
: Collections.<String>emptyList();
|
||||
}
|
||||
|
||||
public void load(Class<?> config) {
|
||||
|
||||
Reference in New Issue
Block a user