Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -68,7 +68,7 @@ public class AnnotationCacheOperationSource extends AbstractFallbackCacheOperati
|
||||
*/
|
||||
public AnnotationCacheOperationSource(boolean publicMethodsOnly) {
|
||||
this.publicMethodsOnly = publicMethodsOnly;
|
||||
this.annotationParsers = new LinkedHashSet<CacheAnnotationParser>(1);
|
||||
this.annotationParsers = new LinkedHashSet<>(1);
|
||||
this.annotationParsers.add(new SpringCacheAnnotationParser());
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class AnnotationCacheOperationSource extends AbstractFallbackCacheOperati
|
||||
public AnnotationCacheOperationSource(CacheAnnotationParser... annotationParsers) {
|
||||
this.publicMethodsOnly = true;
|
||||
Assert.notEmpty(annotationParsers, "At least one CacheAnnotationParser needs to be specified");
|
||||
Set<CacheAnnotationParser> parsers = new LinkedHashSet<CacheAnnotationParser>(annotationParsers.length);
|
||||
Set<CacheAnnotationParser> parsers = new LinkedHashSet<>(annotationParsers.length);
|
||||
Collections.addAll(parsers, annotationParsers);
|
||||
this.annotationParsers = parsers;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class AnnotationCacheOperationSource extends AbstractFallbackCacheOperati
|
||||
Collection<CacheOperation> annOps = provider.getCacheOperations(annotationParser);
|
||||
if (annOps != null) {
|
||||
if (ops == null) {
|
||||
ops = new ArrayList<CacheOperation>();
|
||||
ops = new ArrayList<>();
|
||||
}
|
||||
ops.addAll(annOps);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class CachingConfigurationSelector extends AdviceModeImportSelector<Enabl
|
||||
* <p>Take care of adding the necessary JSR-107 import if it is available.
|
||||
*/
|
||||
private String[] getProxyImports() {
|
||||
List<String> result = new ArrayList<String>();
|
||||
List<String> result = new ArrayList<>();
|
||||
result.add(AutoProxyRegistrar.class.getName());
|
||||
result.add(ProxyCachingConfiguration.class.getName());
|
||||
if (jsr107Present && jcacheImplPresent) {
|
||||
@@ -92,7 +92,7 @@ public class CachingConfigurationSelector extends AdviceModeImportSelector<Enabl
|
||||
* <p>Take care of adding the necessary JSR-107 import if it is available.
|
||||
*/
|
||||
private String[] getAspectJImports() {
|
||||
List<String> result = new ArrayList<String>();
|
||||
List<String> result = new ArrayList<>();
|
||||
result.add(CACHE_ASPECT_CONFIGURATION_CLASS_NAME);
|
||||
if (jsr107Present && jcacheImplPresent) {
|
||||
result.add(JCACHE_ASPECT_CONFIGURATION_CLASS_NAME);
|
||||
|
||||
@@ -98,7 +98,7 @@ public class SpringCacheAnnotationParser implements CacheAnnotationParser, Seria
|
||||
}
|
||||
|
||||
private <T extends Annotation> Collection<CacheOperation> lazyInit(Collection<CacheOperation> ops) {
|
||||
return (ops != null ? ops : new ArrayList<CacheOperation>(1));
|
||||
return (ops != null ? ops : new ArrayList<>(1));
|
||||
}
|
||||
|
||||
CacheableOperation parseCacheableAnnotation(AnnotatedElement ae, DefaultCacheConfig defaultConfig, Cacheable cacheable) {
|
||||
|
||||
@@ -48,7 +48,7 @@ import org.springframework.core.serializer.support.SerializationDelegate;
|
||||
*/
|
||||
public class ConcurrentMapCacheManager implements CacheManager, BeanClassLoaderAware {
|
||||
|
||||
private final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap<String, Cache>(16);
|
||||
private final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap<>(16);
|
||||
|
||||
private boolean dynamic = true;
|
||||
|
||||
@@ -188,7 +188,7 @@ public class ConcurrentMapCacheManager implements CacheManager, BeanClassLoaderA
|
||||
*/
|
||||
protected Cache createConcurrentMapCache(String name) {
|
||||
SerializationDelegate actualSerialization = (isStoreByValue() ? this.serialization : null);
|
||||
return new ConcurrentMapCache(name, new ConcurrentHashMap<Object, Object>(256),
|
||||
return new ConcurrentMapCache(name, new ConcurrentHashMap<>(256),
|
||||
isAllowNullValues(), actualSerialization);
|
||||
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class CacheAdviceParser extends AbstractSingleBeanDefinitionParser {
|
||||
}
|
||||
|
||||
private List<RootBeanDefinition> parseDefinitionsSources(List<Element> definitions, ParserContext parserContext) {
|
||||
ManagedList<RootBeanDefinition> defs = new ManagedList<RootBeanDefinition>(definitions.size());
|
||||
ManagedList<RootBeanDefinition> defs = new ManagedList<>(definitions.size());
|
||||
|
||||
// extract default param for the definition
|
||||
for (Element element : definitions) {
|
||||
@@ -98,7 +98,7 @@ class CacheAdviceParser extends AbstractSingleBeanDefinitionParser {
|
||||
Props prop = new Props(definition);
|
||||
// add cacheable first
|
||||
|
||||
ManagedMap<TypedStringValue, Collection<CacheOperation>> cacheOpMap = new ManagedMap<TypedStringValue, Collection<CacheOperation>>();
|
||||
ManagedMap<TypedStringValue, Collection<CacheOperation>> cacheOpMap = new ManagedMap<>();
|
||||
cacheOpMap.setSource(parserContext.extractSource(definition));
|
||||
|
||||
List<Element> cacheableCacheMethods = DomUtils.getChildElementsByTagName(definition, CACHEABLE_ELEMENT);
|
||||
@@ -114,7 +114,7 @@ class CacheAdviceParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
Collection<CacheOperation> col = cacheOpMap.get(nameHolder);
|
||||
if (col == null) {
|
||||
col = new ArrayList<CacheOperation>(2);
|
||||
col = new ArrayList<>(2);
|
||||
cacheOpMap.put(nameHolder, col);
|
||||
}
|
||||
col.add(builder.build());
|
||||
@@ -141,7 +141,7 @@ class CacheAdviceParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
Collection<CacheOperation> col = cacheOpMap.get(nameHolder);
|
||||
if (col == null) {
|
||||
col = new ArrayList<CacheOperation>(2);
|
||||
col = new ArrayList<>(2);
|
||||
cacheOpMap.put(nameHolder, col);
|
||||
}
|
||||
col.add(builder.build());
|
||||
@@ -159,7 +159,7 @@ class CacheAdviceParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
Collection<CacheOperation> col = cacheOpMap.get(nameHolder);
|
||||
if (col == null) {
|
||||
col = new ArrayList<CacheOperation>(2);
|
||||
col = new ArrayList<>(2);
|
||||
cacheOpMap.put(nameHolder, col);
|
||||
}
|
||||
col.add(builder.build());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -73,7 +73,7 @@ public abstract class AbstractCacheResolver implements CacheResolver, Initializi
|
||||
return Collections.emptyList();
|
||||
}
|
||||
else {
|
||||
Collection<Cache> result = new ArrayList<Cache>();
|
||||
Collection<Cache> result = new ArrayList<>();
|
||||
for (String cacheName : cacheNames) {
|
||||
Cache cache = this.cacheManager.getCache(cacheName);
|
||||
if (cache == null) {
|
||||
|
||||
@@ -71,7 +71,7 @@ public abstract class AbstractFallbackCacheOperationSource implements CacheOpera
|
||||
* after serialization - provided that the concrete subclass is Serializable.
|
||||
*/
|
||||
private final Map<Object, Collection<CacheOperation>> attributeCache =
|
||||
new ConcurrentHashMap<Object, Collection<CacheOperation>>(1024);
|
||||
new ConcurrentHashMap<>(1024);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,7 +83,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final Map<CacheOperationCacheKey, CacheOperationMetadata> metadataCache =
|
||||
new ConcurrentHashMap<CacheOperationCacheKey, CacheOperationMetadata>(1024);
|
||||
new ConcurrentHashMap<>(1024);
|
||||
|
||||
private final CacheOperationExpressionEvaluator evaluator = new CacheOperationExpressionEvaluator();
|
||||
|
||||
@@ -368,7 +368,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
|
||||
Cache.ValueWrapper cacheHit = findCachedItem(contexts.get(CacheableOperation.class));
|
||||
|
||||
// Collect puts from any @Cacheable miss, if no cached item is found
|
||||
List<CachePutRequest> cachePutRequests = new LinkedList<CachePutRequest>();
|
||||
List<CachePutRequest> cachePutRequests = new LinkedList<>();
|
||||
if (cacheHit == null) {
|
||||
collectPutRequests(contexts.get(CacheableOperation.class),
|
||||
CacheOperationExpressionEvaluator.NO_RESULT, cachePutRequests);
|
||||
@@ -411,7 +411,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
|
||||
private boolean hasCachePut(CacheOperationContexts contexts) {
|
||||
// Evaluate the conditions *without* the result object because we don't have it yet...
|
||||
Collection<CacheOperationContext> cachePutContexts = contexts.get(CachePutOperation.class);
|
||||
Collection<CacheOperationContext> excluded = new ArrayList<CacheOperationContext>();
|
||||
Collection<CacheOperationContext> excluded = new ArrayList<>();
|
||||
for (CacheOperationContext context : cachePutContexts) {
|
||||
try {
|
||||
if (!context.isConditionPassing(CacheOperationExpressionEvaluator.RESULT_UNAVAILABLE)) {
|
||||
@@ -540,7 +540,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
|
||||
private class CacheOperationContexts {
|
||||
|
||||
private final MultiValueMap<Class<? extends CacheOperation>, CacheOperationContext> contexts =
|
||||
new LinkedMultiValueMap<Class<? extends CacheOperation>, CacheOperationContext>();
|
||||
new LinkedMultiValueMap<>();
|
||||
|
||||
private final boolean sync;
|
||||
|
||||
@@ -728,7 +728,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
|
||||
}
|
||||
|
||||
private Collection<String> createCacheNames(Collection<? extends Cache> caches) {
|
||||
Collection<String> names = new ArrayList<String>();
|
||||
Collection<String> names = new ArrayList<>();
|
||||
for (Cache cache : caches) {
|
||||
names.add(cache.getName());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -48,7 +48,7 @@ class CacheEvaluationContext extends MethodBasedEvaluationContext {
|
||||
ParameterNameDiscoverer paramDiscoverer) {
|
||||
|
||||
super(rootObject, method, args, paramDiscoverer);
|
||||
this.unavailableVariables = new ArrayList<String>();
|
||||
this.unavailableVariables = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -155,7 +155,7 @@ public abstract class CacheOperation implements BasicOperation {
|
||||
}
|
||||
|
||||
public void setCacheNames(String... cacheNames) {
|
||||
this.cacheNames = new LinkedHashSet<String>(cacheNames.length);
|
||||
this.cacheNames = new LinkedHashSet<>(cacheNames.length);
|
||||
for (String cacheName : cacheNames) {
|
||||
Assert.hasText(cacheName, "Cache name must be non-null if specified");
|
||||
this.cacheNames.add(cacheName);
|
||||
|
||||
@@ -61,14 +61,14 @@ class CacheOperationExpressionEvaluator extends CachedExpressionEvaluator {
|
||||
public static final String RESULT_VARIABLE = "result";
|
||||
|
||||
|
||||
private final Map<ExpressionKey, Expression> keyCache = new ConcurrentHashMap<ExpressionKey, Expression>(64);
|
||||
private final Map<ExpressionKey, Expression> keyCache = new ConcurrentHashMap<>(64);
|
||||
|
||||
private final Map<ExpressionKey, Expression> conditionCache = new ConcurrentHashMap<ExpressionKey, Expression>(64);
|
||||
private final Map<ExpressionKey, Expression> conditionCache = new ConcurrentHashMap<>(64);
|
||||
|
||||
private final Map<ExpressionKey, Expression> unlessCache = new ConcurrentHashMap<ExpressionKey, Expression>(64);
|
||||
private final Map<ExpressionKey, Expression> unlessCache = new ConcurrentHashMap<>(64);
|
||||
|
||||
private final Map<AnnotatedElementKey, Method> targetMethodCache =
|
||||
new ConcurrentHashMap<AnnotatedElementKey, Method>(64);
|
||||
new ConcurrentHashMap<>(64);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -61,7 +61,7 @@ public class CompositeCacheOperationSource implements CacheOperationSource, Seri
|
||||
Collection<CacheOperation> cacheOperations = source.getCacheOperations(method, targetClass);
|
||||
if (cacheOperations != null) {
|
||||
if (ops == null) {
|
||||
ops = new ArrayList<CacheOperation>();
|
||||
ops = new ArrayList<>();
|
||||
}
|
||||
|
||||
ops.addAll(cacheOperations);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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,7 +46,7 @@ public class NameMatchCacheOperationSource implements CacheOperationSource, Seri
|
||||
|
||||
|
||||
/** Keys are method names; values are TransactionAttributes */
|
||||
private Map<String, Collection<CacheOperation>> nameMap = new LinkedHashMap<String, Collection<CacheOperation>>();
|
||||
private Map<String, Collection<CacheOperation>> nameMap = new LinkedHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ public class NamedCacheResolver extends AbstractCacheResolver {
|
||||
|
||||
public NamedCacheResolver(CacheManager cacheManager, String... cacheNames) {
|
||||
super(cacheManager);
|
||||
this.cacheNames = new ArrayList<String>(Arrays.asList(cacheNames));
|
||||
this.cacheNames = new ArrayList<>(Arrays.asList(cacheNames));
|
||||
}
|
||||
|
||||
public NamedCacheResolver() {
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.springframework.cache.CacheManager;
|
||||
*/
|
||||
public abstract class AbstractCacheManager implements CacheManager, InitializingBean {
|
||||
|
||||
private final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap<String, Cache>(16);
|
||||
private final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap<>(16);
|
||||
|
||||
private volatile Set<String> cacheNames = Collections.emptySet();
|
||||
|
||||
@@ -63,7 +63,7 @@ public abstract class AbstractCacheManager implements CacheManager, Initializing
|
||||
synchronized (this.cacheMap) {
|
||||
this.cacheNames = Collections.emptySet();
|
||||
this.cacheMap.clear();
|
||||
Set<String> cacheNames = new LinkedHashSet<String>(caches.size());
|
||||
Set<String> cacheNames = new LinkedHashSet<>(caches.size());
|
||||
for (Cache cache : caches) {
|
||||
String name = cache.getName();
|
||||
this.cacheMap.put(name, decorateCache(cache));
|
||||
@@ -136,7 +136,7 @@ public abstract class AbstractCacheManager implements CacheManager, Initializing
|
||||
* @param name the name of the cache to be added
|
||||
*/
|
||||
private void updateCacheNames(String name) {
|
||||
Set<String> cacheNames = new LinkedHashSet<String>(this.cacheNames.size() + 1);
|
||||
Set<String> cacheNames = new LinkedHashSet<>(this.cacheNames.size() + 1);
|
||||
cacheNames.addAll(this.cacheNames);
|
||||
cacheNames.add(name);
|
||||
this.cacheNames = Collections.unmodifiableSet(cacheNames);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -52,7 +52,7 @@ import org.springframework.cache.CacheManager;
|
||||
*/
|
||||
public class CompositeCacheManager implements CacheManager, InitializingBean {
|
||||
|
||||
private final List<CacheManager> cacheManagers = new ArrayList<CacheManager>();
|
||||
private final List<CacheManager> cacheManagers = new ArrayList<>();
|
||||
|
||||
private boolean fallbackToNoOpCache = false;
|
||||
|
||||
@@ -110,7 +110,7 @@ public class CompositeCacheManager implements CacheManager, InitializingBean {
|
||||
|
||||
@Override
|
||||
public Collection<String> getCacheNames() {
|
||||
Set<String> names = new LinkedHashSet<String>();
|
||||
Set<String> names = new LinkedHashSet<>();
|
||||
for (CacheManager manager : this.cacheManagers) {
|
||||
names.addAll(manager.getCacheNames());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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 @@ import org.springframework.cache.CacheManager;
|
||||
*/
|
||||
public class NoOpCacheManager implements CacheManager {
|
||||
|
||||
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<String, Cache>(16);
|
||||
private final ConcurrentMap<String, Cache> caches = new ConcurrentHashMap<>(16);
|
||||
|
||||
private final Set<String> cacheNames = new LinkedHashSet<String>(16);
|
||||
private final Set<String> cacheNames = new LinkedHashSet<>(16);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -54,7 +54,7 @@ public class ContextSingletonBeanFactoryLocator extends SingletonBeanFactoryLoca
|
||||
private static final String DEFAULT_RESOURCE_LOCATION = "classpath*:beanRefContext.xml";
|
||||
|
||||
/** The keyed singleton instances */
|
||||
private static final Map<String, BeanFactoryLocator> instances = new HashMap<String, BeanFactoryLocator>();
|
||||
private static final Map<String, BeanFactoryLocator> instances = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -155,7 +155,7 @@ public class AnnotationConfigUtils {
|
||||
}
|
||||
}
|
||||
|
||||
Set<BeanDefinitionHolder> beanDefs = new LinkedHashSet<BeanDefinitionHolder>(4);
|
||||
Set<BeanDefinitionHolder> beanDefs = new LinkedHashSet<>(4);
|
||||
|
||||
if (!registry.containsBeanDefinition(CONFIGURATION_ANNOTATION_PROCESSOR_BEAN_NAME)) {
|
||||
RootBeanDefinition def = new RootBeanDefinition(ConfigurationClassPostProcessor.class);
|
||||
@@ -290,7 +290,7 @@ public class AnnotationConfigUtils {
|
||||
static Set<AnnotationAttributes> attributesForRepeatable(AnnotationMetadata metadata,
|
||||
String containerClassName, String annotationClassName) {
|
||||
|
||||
Set<AnnotationAttributes> result = new LinkedHashSet<AnnotationAttributes>();
|
||||
Set<AnnotationAttributes> result = new LinkedHashSet<>();
|
||||
addAttributesIfNotNull(result, metadata.getAnnotationAttributes(annotationClassName, false));
|
||||
|
||||
Map<String, Object> container = metadata.getAnnotationAttributes(containerClassName, false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -243,7 +243,7 @@ public class ClassPathBeanDefinitionScanner extends ClassPathScanningCandidateCo
|
||||
*/
|
||||
protected Set<BeanDefinitionHolder> doScan(String... basePackages) {
|
||||
Assert.notEmpty(basePackages, "At least one base package must be specified");
|
||||
Set<BeanDefinitionHolder> beanDefinitions = new LinkedHashSet<BeanDefinitionHolder>();
|
||||
Set<BeanDefinitionHolder> beanDefinitions = new LinkedHashSet<>();
|
||||
for (String basePackage : basePackages) {
|
||||
Set<BeanDefinition> candidates = findCandidateComponents(basePackage);
|
||||
for (BeanDefinition candidate : candidates) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -83,9 +83,9 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
|
||||
|
||||
private String resourcePattern = DEFAULT_RESOURCE_PATTERN;
|
||||
|
||||
private final List<TypeFilter> includeFilters = new LinkedList<TypeFilter>();
|
||||
private final List<TypeFilter> includeFilters = new LinkedList<>();
|
||||
|
||||
private final List<TypeFilter> excludeFilters = new LinkedList<TypeFilter>();
|
||||
private final List<TypeFilter> excludeFilters = new LinkedList<>();
|
||||
|
||||
private ConditionEvaluator conditionEvaluator;
|
||||
|
||||
@@ -263,7 +263,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
|
||||
* @return a corresponding Set of autodetected bean definitions
|
||||
*/
|
||||
public Set<BeanDefinition> findCandidateComponents(String basePackage) {
|
||||
Set<BeanDefinition> candidates = new LinkedHashSet<BeanDefinition>();
|
||||
Set<BeanDefinition> candidates = new LinkedHashSet<>();
|
||||
try {
|
||||
String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX +
|
||||
resolveBasePackage(basePackage) + "/" + this.resourcePattern;
|
||||
|
||||
@@ -171,7 +171,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
||||
}
|
||||
|
||||
|
||||
private final Set<String> ignoredResourceTypes = new HashSet<String>(1);
|
||||
private final Set<String> ignoredResourceTypes = new HashSet<>(1);
|
||||
|
||||
private boolean fallbackToDefaultTypeMatch = true;
|
||||
|
||||
@@ -186,7 +186,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
||||
private transient StringValueResolver embeddedValueResolver;
|
||||
|
||||
private transient final Map<String, InjectionMetadata> injectionMetadataCache =
|
||||
new ConcurrentHashMap<String, InjectionMetadata>(256);
|
||||
new ConcurrentHashMap<>(256);
|
||||
|
||||
|
||||
/**
|
||||
@@ -351,12 +351,12 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
||||
}
|
||||
|
||||
private InjectionMetadata buildResourceMetadata(final Class<?> clazz) {
|
||||
LinkedList<InjectionMetadata.InjectedElement> elements = new LinkedList<InjectionMetadata.InjectedElement>();
|
||||
LinkedList<InjectionMetadata.InjectedElement> elements = new LinkedList<>();
|
||||
Class<?> targetClass = clazz;
|
||||
|
||||
do {
|
||||
final LinkedList<InjectionMetadata.InjectedElement> currElements =
|
||||
new LinkedList<InjectionMetadata.InjectedElement>();
|
||||
new LinkedList<>();
|
||||
|
||||
ReflectionUtils.doWithLocalFields(targetClass, new ReflectionUtils.FieldCallback() {
|
||||
@Override
|
||||
@@ -514,7 +514,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
||||
|
||||
if (this.fallbackToDefaultTypeMatch && element.isDefaultName &&
|
||||
factory instanceof AutowireCapableBeanFactory && !factory.containsBean(name)) {
|
||||
autowiredBeanNames = new LinkedHashSet<String>();
|
||||
autowiredBeanNames = new LinkedHashSet<>();
|
||||
resource = ((AutowireCapableBeanFactory) factory).resolveDependency(
|
||||
element.getDependencyDescriptor(), requestingBeanName, autowiredBeanNames, null);
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ class ComponentScanAnnotationParser {
|
||||
scanner.getBeanDefinitionDefaults().setLazyInit(true);
|
||||
}
|
||||
|
||||
Set<String> basePackages = new LinkedHashSet<String>();
|
||||
Set<String> basePackages = new LinkedHashSet<>();
|
||||
String[] basePackagesArray = componentScan.getAliasedStringArray("basePackages", ComponentScan.class, declaringClass);
|
||||
for (String pkg : basePackagesArray) {
|
||||
String[] tokenized = StringUtils.tokenizeToStringArray(this.environment.resolvePlaceholders(pkg),
|
||||
@@ -145,7 +145,7 @@ class ComponentScanAnnotationParser {
|
||||
}
|
||||
|
||||
private List<TypeFilter> typeFiltersFor(AnnotationAttributes filterAttributes) {
|
||||
List<TypeFilter> typeFilters = new ArrayList<TypeFilter>();
|
||||
List<TypeFilter> typeFilters = new ArrayList<>();
|
||||
FilterType filterType = filterAttributes.getEnum("type");
|
||||
|
||||
for (Class<?> filterClass : filterAttributes.getAliasedClassArray("classes", ComponentScan.Filter.class, null)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -83,7 +83,7 @@ class ConditionEvaluator {
|
||||
return shouldSkip(metadata, ConfigurationPhase.REGISTER_BEAN);
|
||||
}
|
||||
|
||||
List<Condition> conditions = new ArrayList<Condition>();
|
||||
List<Condition> conditions = new ArrayList<>();
|
||||
for (String[] conditionClasses : getConditionClasses(metadata)) {
|
||||
for (String conditionClass : conditionClasses) {
|
||||
Condition condition = getCondition(conditionClass, this.context.getClassLoader());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -54,17 +54,17 @@ final class ConfigurationClass {
|
||||
|
||||
private String beanName;
|
||||
|
||||
private final Set<ConfigurationClass> importedBy = new LinkedHashSet<ConfigurationClass>(1);
|
||||
private final Set<ConfigurationClass> importedBy = new LinkedHashSet<>(1);
|
||||
|
||||
private final Set<BeanMethod> beanMethods = new LinkedHashSet<BeanMethod>();
|
||||
private final Set<BeanMethod> beanMethods = new LinkedHashSet<>();
|
||||
|
||||
private final Map<String, Class<? extends BeanDefinitionReader>> importedResources =
|
||||
new LinkedHashMap<String, Class<? extends BeanDefinitionReader>>();
|
||||
new LinkedHashMap<>();
|
||||
|
||||
private final Map<ImportBeanDefinitionRegistrar, AnnotationMetadata> importBeanDefinitionRegistrars =
|
||||
new LinkedHashMap<ImportBeanDefinitionRegistrar, AnnotationMetadata>();
|
||||
new LinkedHashMap<>();
|
||||
|
||||
final Set<String> skippedBeanMethods = new HashSet<String>();
|
||||
final Set<String> skippedBeanMethods = new HashSet<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -185,7 +185,7 @@ class ConfigurationClassBeanDefinitionReader {
|
||||
|
||||
// Consider name and any aliases
|
||||
AnnotationAttributes bean = AnnotationConfigUtils.attributesFor(metadata, Bean.class);
|
||||
List<String> names = new ArrayList<String>(Arrays.asList(bean.getStringArray("name")));
|
||||
List<String> names = new ArrayList<>(Arrays.asList(bean.getStringArray("name")));
|
||||
String beanName = (names.size() > 0 ? names.remove(0) : methodName);
|
||||
|
||||
// Register aliases even when overridden
|
||||
@@ -305,7 +305,7 @@ class ConfigurationClassBeanDefinitionReader {
|
||||
private void loadBeanDefinitionsFromImportedResources(
|
||||
Map<String, Class<? extends BeanDefinitionReader>> importedResources) {
|
||||
|
||||
Map<Class<?>, BeanDefinitionReader> readerInstanceCache = new HashMap<Class<?>, BeanDefinitionReader>();
|
||||
Map<Class<?>, BeanDefinitionReader> readerInstanceCache = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, Class<? extends BeanDefinitionReader>> entry : importedResources.entrySet()) {
|
||||
String resource = entry.getKey();
|
||||
@@ -414,7 +414,7 @@ class ConfigurationClassBeanDefinitionReader {
|
||||
*/
|
||||
private class TrackedConditionEvaluator {
|
||||
|
||||
private final Map<ConfigurationClass, Boolean> skipped = new HashMap<ConfigurationClass, Boolean>();
|
||||
private final Map<ConfigurationClass, Boolean> skipped = new HashMap<>();
|
||||
|
||||
public boolean shouldSkip(ConfigurationClass configClass) {
|
||||
Boolean skip = this.skipped.get(configClass);
|
||||
|
||||
@@ -133,11 +133,11 @@ class ConfigurationClassParser {
|
||||
private final ConditionEvaluator conditionEvaluator;
|
||||
|
||||
private final Map<ConfigurationClass, ConfigurationClass> configurationClasses =
|
||||
new LinkedHashMap<ConfigurationClass, ConfigurationClass>();
|
||||
new LinkedHashMap<>();
|
||||
|
||||
private final Map<String, ConfigurationClass> knownSuperclasses = new HashMap<String, ConfigurationClass>();
|
||||
private final Map<String, ConfigurationClass> knownSuperclasses = new HashMap<>();
|
||||
|
||||
private final List<String> propertySourceNames = new ArrayList<String>();
|
||||
private final List<String> propertySourceNames = new ArrayList<>();
|
||||
|
||||
private final ImportStack importStack = new ImportStack();
|
||||
|
||||
@@ -164,7 +164,7 @@ class ConfigurationClassParser {
|
||||
|
||||
|
||||
public void parse(Set<BeanDefinitionHolder> configCandidates) {
|
||||
this.deferredImportSelectors = new LinkedList<DeferredImportSelectorHolder>();
|
||||
this.deferredImportSelectors = new LinkedList<>();
|
||||
|
||||
for (BeanDefinitionHolder holder : configCandidates) {
|
||||
BeanDefinition bd = holder.getBeanDefinition();
|
||||
@@ -438,8 +438,8 @@ class ConfigurationClassParser {
|
||||
* Returns {@code @Import} class, considering all meta-annotations.
|
||||
*/
|
||||
private Set<SourceClass> getImports(SourceClass sourceClass) throws IOException {
|
||||
Set<SourceClass> imports = new LinkedHashSet<SourceClass>();
|
||||
Set<SourceClass> visited = new LinkedHashSet<SourceClass>();
|
||||
Set<SourceClass> imports = new LinkedHashSet<>();
|
||||
Set<SourceClass> visited = new LinkedHashSet<>();
|
||||
collectImports(sourceClass, imports, visited);
|
||||
return imports;
|
||||
}
|
||||
@@ -624,7 +624,7 @@ class ConfigurationClassParser {
|
||||
* Factory method to obtain {@link SourceClass}s from class names.
|
||||
*/
|
||||
public Collection<SourceClass> asSourceClasses(String[] classNames) throws IOException {
|
||||
List<SourceClass> annotatedClasses = new ArrayList<SourceClass>();
|
||||
List<SourceClass> annotatedClasses = new ArrayList<>();
|
||||
for (String className : classNames) {
|
||||
annotatedClasses.add(asSourceClass(className));
|
||||
}
|
||||
@@ -651,7 +651,7 @@ class ConfigurationClassParser {
|
||||
@SuppressWarnings("serial")
|
||||
private static class ImportStack extends ArrayDeque<ConfigurationClass> implements ImportRegistry {
|
||||
|
||||
private final MultiValueMap<String, AnnotationMetadata> imports = new LinkedMultiValueMap<String, AnnotationMetadata>();
|
||||
private final MultiValueMap<String, AnnotationMetadata> imports = new LinkedMultiValueMap<>();
|
||||
|
||||
public void registerImport(AnnotationMetadata importingClass, String importedClass) {
|
||||
this.imports.add(importedClass, importingClass);
|
||||
@@ -771,7 +771,7 @@ class ConfigurationClassParser {
|
||||
Class<?> sourceClass = (Class<?>) sourceToProcess;
|
||||
try {
|
||||
Class<?>[] declaredClasses = sourceClass.getDeclaredClasses();
|
||||
List<SourceClass> members = new ArrayList<SourceClass>(declaredClasses.length);
|
||||
List<SourceClass> members = new ArrayList<>(declaredClasses.length);
|
||||
for (Class<?> declaredClass : declaredClasses) {
|
||||
members.add(asSourceClass(declaredClass));
|
||||
}
|
||||
@@ -787,7 +787,7 @@ class ConfigurationClassParser {
|
||||
// ASM-based resolution - safe for non-resolvable classes as well
|
||||
MetadataReader sourceReader = (MetadataReader) sourceToProcess;
|
||||
String[] memberClassNames = sourceReader.getClassMetadata().getMemberClassNames();
|
||||
List<SourceClass> members = new ArrayList<SourceClass>(memberClassNames.length);
|
||||
List<SourceClass> members = new ArrayList<>(memberClassNames.length);
|
||||
for (String memberClassName : memberClassNames) {
|
||||
try {
|
||||
members.add(asSourceClass(memberClassName));
|
||||
@@ -811,7 +811,7 @@ class ConfigurationClassParser {
|
||||
}
|
||||
|
||||
public Set<SourceClass> getInterfaces() throws IOException {
|
||||
Set<SourceClass> result = new LinkedHashSet<SourceClass>();
|
||||
Set<SourceClass> result = new LinkedHashSet<>();
|
||||
if (this.source instanceof Class<?>) {
|
||||
Class<?> sourceClass = (Class<?>) this.source;
|
||||
for (Class<?> ifcClass : sourceClass.getInterfaces()) {
|
||||
@@ -827,7 +827,7 @@ class ConfigurationClassParser {
|
||||
}
|
||||
|
||||
public Set<SourceClass> getAnnotations() throws IOException {
|
||||
Set<SourceClass> result = new LinkedHashSet<SourceClass>();
|
||||
Set<SourceClass> result = new LinkedHashSet<>();
|
||||
for (String className : this.metadata.getAnnotationTypes()) {
|
||||
try {
|
||||
result.add(getRelated(className));
|
||||
@@ -846,7 +846,7 @@ class ConfigurationClassParser {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
String[] classNames = (String[]) annotationAttributes.get(attribute);
|
||||
Set<SourceClass> result = new LinkedHashSet<SourceClass>();
|
||||
Set<SourceClass> result = new LinkedHashSet<>();
|
||||
for (String className : classNames) {
|
||||
result.add(getRelated(className));
|
||||
}
|
||||
|
||||
@@ -117,9 +117,9 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
||||
|
||||
private boolean setMetadataReaderFactoryCalled = false;
|
||||
|
||||
private final Set<Integer> registriesPostProcessed = new HashSet<Integer>();
|
||||
private final Set<Integer> registriesPostProcessed = new HashSet<>();
|
||||
|
||||
private final Set<Integer> factoriesPostProcessed = new HashSet<Integer>();
|
||||
private final Set<Integer> factoriesPostProcessed = new HashSet<>();
|
||||
|
||||
private ConfigurationClassBeanDefinitionReader reader;
|
||||
|
||||
@@ -268,7 +268,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
||||
* {@link Configuration} classes.
|
||||
*/
|
||||
public void processConfigBeanDefinitions(BeanDefinitionRegistry registry) {
|
||||
List<BeanDefinitionHolder> configCandidates = new ArrayList<BeanDefinitionHolder>();
|
||||
List<BeanDefinitionHolder> configCandidates = new ArrayList<>();
|
||||
String[] candidateNames = registry.getBeanDefinitionNames();
|
||||
|
||||
for (String beanName : candidateNames) {
|
||||
@@ -315,13 +315,13 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
||||
this.metadataReaderFactory, this.problemReporter, this.environment,
|
||||
this.resourceLoader, this.componentScanBeanNameGenerator, registry);
|
||||
|
||||
Set<BeanDefinitionHolder> candidates = new LinkedHashSet<BeanDefinitionHolder>(configCandidates);
|
||||
Set<ConfigurationClass> alreadyParsed = new HashSet<ConfigurationClass>(configCandidates.size());
|
||||
Set<BeanDefinitionHolder> candidates = new LinkedHashSet<>(configCandidates);
|
||||
Set<ConfigurationClass> alreadyParsed = new HashSet<>(configCandidates.size());
|
||||
do {
|
||||
parser.parse(candidates);
|
||||
parser.validate();
|
||||
|
||||
Set<ConfigurationClass> configClasses = new LinkedHashSet<ConfigurationClass>(parser.getConfigurationClasses());
|
||||
Set<ConfigurationClass> configClasses = new LinkedHashSet<>(parser.getConfigurationClasses());
|
||||
configClasses.removeAll(alreadyParsed);
|
||||
|
||||
// Read the model and create bean definitions based on its content
|
||||
@@ -336,8 +336,8 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
||||
candidates.clear();
|
||||
if (registry.getBeanDefinitionCount() > candidateNames.length) {
|
||||
String[] newCandidateNames = registry.getBeanDefinitionNames();
|
||||
Set<String> oldCandidateNames = new HashSet<String>(Arrays.asList(candidateNames));
|
||||
Set<String> alreadyParsedClasses = new HashSet<String>();
|
||||
Set<String> oldCandidateNames = new HashSet<>(Arrays.asList(candidateNames));
|
||||
Set<String> alreadyParsedClasses = new HashSet<>();
|
||||
for (ConfigurationClass configurationClass : alreadyParsed) {
|
||||
alreadyParsedClasses.add(configurationClass.getMetadata().getClassName());
|
||||
}
|
||||
@@ -374,7 +374,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
|
||||
* @see ConfigurationClassEnhancer
|
||||
*/
|
||||
public void enhanceConfigurationClasses(ConfigurableListableBeanFactory beanFactory) {
|
||||
Map<String, AbstractBeanDefinition> configBeanDefs = new LinkedHashMap<String, AbstractBeanDefinition>();
|
||||
Map<String, AbstractBeanDefinition> configBeanDefs = new LinkedHashMap<>();
|
||||
for (String beanName : beanFactory.getBeanDefinitionNames()) {
|
||||
BeanDefinition beanDef = beanFactory.getBeanDefinition(beanName);
|
||||
if (ConfigurationClassUtils.isFullConfigurationClass(beanDef)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -59,7 +59,7 @@ abstract class ConfigurationClassUtils {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ConfigurationClassUtils.class);
|
||||
|
||||
private static final Set<String> candidateIndicators = new HashSet<String>(4);
|
||||
private static final Set<String> candidateIndicators = new HashSet<>(4);
|
||||
|
||||
static {
|
||||
candidateIndicators.add(Component.class.getName());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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,7 +41,7 @@ import org.springframework.beans.factory.config.BeanDefinition;
|
||||
*/
|
||||
public class Jsr330ScopeMetadataResolver implements ScopeMetadataResolver {
|
||||
|
||||
private final Map<String, String> scopeMap = new HashMap<String, String>();
|
||||
private final Map<String, String> scopeMap = new HashMap<>();
|
||||
|
||||
|
||||
public Jsr330ScopeMetadataResolver() {
|
||||
|
||||
@@ -61,7 +61,7 @@ public abstract class AbstractApplicationEventMulticaster
|
||||
private final ListenerRetriever defaultRetriever = new ListenerRetriever(false);
|
||||
|
||||
final Map<ListenerCacheKey, ListenerRetriever> retrieverCache =
|
||||
new ConcurrentHashMap<ListenerCacheKey, ListenerRetriever>(64);
|
||||
new ConcurrentHashMap<>(64);
|
||||
|
||||
private ClassLoader beanClassLoader;
|
||||
|
||||
@@ -203,12 +203,12 @@ public abstract class AbstractApplicationEventMulticaster
|
||||
private Collection<ApplicationListener<?>> retrieveApplicationListeners(
|
||||
ResolvableType eventType, Class<?> sourceType, ListenerRetriever retriever) {
|
||||
|
||||
LinkedList<ApplicationListener<?>> allListeners = new LinkedList<ApplicationListener<?>>();
|
||||
LinkedList<ApplicationListener<?>> allListeners = new LinkedList<>();
|
||||
Set<ApplicationListener<?>> listeners;
|
||||
Set<String> listenerBeans;
|
||||
synchronized (this.retrievalMutex) {
|
||||
listeners = new LinkedHashSet<ApplicationListener<?>>(this.defaultRetriever.applicationListeners);
|
||||
listenerBeans = new LinkedHashSet<String>(this.defaultRetriever.applicationListenerBeans);
|
||||
listeners = new LinkedHashSet<>(this.defaultRetriever.applicationListeners);
|
||||
listenerBeans = new LinkedHashSet<>(this.defaultRetriever.applicationListenerBeans);
|
||||
}
|
||||
for (ApplicationListener<?> listener : listeners) {
|
||||
if (supportsEvent(listener, eventType, sourceType)) {
|
||||
@@ -345,13 +345,13 @@ public abstract class AbstractApplicationEventMulticaster
|
||||
private final boolean preFiltered;
|
||||
|
||||
public ListenerRetriever(boolean preFiltered) {
|
||||
this.applicationListeners = new LinkedHashSet<ApplicationListener<?>>();
|
||||
this.applicationListenerBeans = new LinkedHashSet<String>();
|
||||
this.applicationListeners = new LinkedHashSet<>();
|
||||
this.applicationListenerBeans = new LinkedHashSet<>();
|
||||
this.preFiltered = preFiltered;
|
||||
}
|
||||
|
||||
public Collection<ApplicationListener<?>> getApplicationListeners() {
|
||||
LinkedList<ApplicationListener<?>> allListeners = new LinkedList<ApplicationListener<?>>();
|
||||
LinkedList<ApplicationListener<?>> allListeners = new LinkedList<>();
|
||||
for (ApplicationListener<?> listener : this.applicationListeners) {
|
||||
allListeners.add(listener);
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
||||
}
|
||||
EventListener ann = getEventListener();
|
||||
if (ann != null && ann.classes().length > 0) {
|
||||
List<ResolvableType> types = new ArrayList<ResolvableType>();
|
||||
List<ResolvableType> types = new ArrayList<>();
|
||||
for (Class<?> eventType : ann.classes()) {
|
||||
types.add(ResolvableType.forClass(eventType));
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ import org.springframework.expression.Expression;
|
||||
*/
|
||||
class EventExpressionEvaluator extends CachedExpressionEvaluator {
|
||||
|
||||
private final Map<ExpressionKey, Expression> conditionCache = new ConcurrentHashMap<ExpressionKey, Expression>(64);
|
||||
private final Map<ExpressionKey, Expression> conditionCache = new ConcurrentHashMap<>(64);
|
||||
|
||||
private final Map<AnnotatedElementKey, Method> targetMethodCache = new ConcurrentHashMap<AnnotatedElementKey, Method>(64);
|
||||
private final Map<AnnotatedElementKey, Method> targetMethodCache = new ConcurrentHashMap<>(64);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -119,7 +119,7 @@ public class EventListenerMethodProcessor implements SmartInitializingSingleton,
|
||||
*/
|
||||
protected List<EventListenerFactory> getEventListenerFactories() {
|
||||
Map<String, EventListenerFactory> beans = this.applicationContext.getBeansOfType(EventListenerFactory.class);
|
||||
List<EventListenerFactory> allFactories = new ArrayList<EventListenerFactory>(beans.values());
|
||||
List<EventListenerFactory> allFactories = new ArrayList<>(beans.values());
|
||||
AnnotationAwareOrderComparator.sort(allFactories);
|
||||
return allFactories;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -61,10 +61,10 @@ public class StandardBeanExpressionResolver implements BeanExpressionResolver {
|
||||
|
||||
private ExpressionParser expressionParser;
|
||||
|
||||
private final Map<String, Expression> expressionCache = new ConcurrentHashMap<String, Expression>(256);
|
||||
private final Map<String, Expression> expressionCache = new ConcurrentHashMap<>(256);
|
||||
|
||||
private final Map<BeanExpressionContext, StandardEvaluationContext> evaluationCache =
|
||||
new ConcurrentHashMap<BeanExpressionContext, StandardEvaluationContext>(8);
|
||||
new ConcurrentHashMap<>(8);
|
||||
|
||||
private final ParserContext beanExpressionParserContext = new ParserContext() {
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -44,10 +44,10 @@ import org.springframework.core.NamedThreadLocal;
|
||||
public abstract class LocaleContextHolder {
|
||||
|
||||
private static final ThreadLocal<LocaleContext> localeContextHolder =
|
||||
new NamedThreadLocal<LocaleContext>("Locale context");
|
||||
new NamedThreadLocal<>("Locale context");
|
||||
|
||||
private static final ThreadLocal<LocaleContext> inheritableLocaleContextHolder =
|
||||
new NamedInheritableThreadLocal<LocaleContext>("Locale context");
|
||||
new NamedInheritableThreadLocal<>("Locale context");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -173,7 +173,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
||||
|
||||
/** BeanFactoryPostProcessors to apply on refresh */
|
||||
private final List<BeanFactoryPostProcessor> beanFactoryPostProcessors =
|
||||
new ArrayList<BeanFactoryPostProcessor>();
|
||||
new ArrayList<>();
|
||||
|
||||
/** System time in milliseconds when this context started */
|
||||
private long startupDate;
|
||||
@@ -203,7 +203,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
||||
private ApplicationEventMulticaster applicationEventMulticaster;
|
||||
|
||||
/** Statically specified listeners */
|
||||
private final Set<ApplicationListener<?>> applicationListeners = new LinkedHashSet<ApplicationListener<?>>();
|
||||
private final Set<ApplicationListener<?>> applicationListeners = new LinkedHashSet<>();
|
||||
|
||||
/** ApplicationEvents published early */
|
||||
private Set<ApplicationEvent> earlyApplicationEvents;
|
||||
@@ -368,7 +368,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
||||
applicationEvent = (ApplicationEvent) event;
|
||||
}
|
||||
else {
|
||||
applicationEvent = new PayloadApplicationEvent<Object>(this, event);
|
||||
applicationEvent = new PayloadApplicationEvent<>(this, event);
|
||||
if (eventType == null) {
|
||||
eventType = ((PayloadApplicationEvent)applicationEvent).getResolvableType();
|
||||
}
|
||||
@@ -590,7 +590,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
||||
|
||||
// Allow for the collection of early ApplicationEvents,
|
||||
// to be published once the multicaster is available...
|
||||
this.earlyApplicationEvents = new LinkedHashSet<ApplicationEvent>();
|
||||
this.earlyApplicationEvents = new LinkedHashSet<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -305,7 +305,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
|
||||
if (args == null) {
|
||||
return new Object[0];
|
||||
}
|
||||
List<Object> resolvedArgs = new ArrayList<Object>(args.length);
|
||||
List<Object> resolvedArgs = new ArrayList<>(args.length);
|
||||
for (Object arg : args) {
|
||||
if (arg instanceof MessageSourceResolvable) {
|
||||
resolvedArgs.add(getMessage((MessageSourceResolvable) arg, locale));
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.ObjectUtils;
|
||||
*/
|
||||
public abstract class AbstractResourceBasedMessageSource extends AbstractMessageSource {
|
||||
|
||||
private final Set<String> basenameSet = new LinkedHashSet<String>(4);
|
||||
private final Set<String> basenameSet = new LinkedHashSet<>(4);
|
||||
|
||||
private String defaultEncoding;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart
|
||||
|
||||
|
||||
/** Cache for byte array per class name */
|
||||
private final Map<String, byte[]> bytesCache = new ConcurrentHashMap<String, byte[]>(256);
|
||||
private final Map<String, byte[]> bytesCache = new ConcurrentHashMap<>(256);
|
||||
|
||||
|
||||
public ContextTypeMatchClassLoader(ClassLoader parent) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -129,7 +129,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
|
||||
|
||||
private void startBeans(boolean autoStartupOnly) {
|
||||
Map<String, Lifecycle> lifecycleBeans = getLifecycleBeans();
|
||||
Map<Integer, LifecycleGroup> phases = new HashMap<Integer, LifecycleGroup>();
|
||||
Map<Integer, LifecycleGroup> phases = new HashMap<>();
|
||||
for (Map.Entry<String, ? extends Lifecycle> entry : lifecycleBeans.entrySet()) {
|
||||
Lifecycle bean = entry.getValue();
|
||||
if (!autoStartupOnly || (bean instanceof SmartLifecycle && ((SmartLifecycle) bean).isAutoStartup())) {
|
||||
@@ -143,7 +143,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
|
||||
}
|
||||
}
|
||||
if (phases.size() > 0) {
|
||||
List<Integer> keys = new ArrayList<Integer>(phases.keySet());
|
||||
List<Integer> keys = new ArrayList<>(phases.keySet());
|
||||
Collections.sort(keys);
|
||||
for (Integer key : keys) {
|
||||
phases.get(key).start();
|
||||
@@ -184,7 +184,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
|
||||
|
||||
private void stopBeans() {
|
||||
Map<String, Lifecycle> lifecycleBeans = getLifecycleBeans();
|
||||
Map<Integer, LifecycleGroup> phases = new HashMap<Integer, LifecycleGroup>();
|
||||
Map<Integer, LifecycleGroup> phases = new HashMap<>();
|
||||
for (Map.Entry<String, Lifecycle> entry : lifecycleBeans.entrySet()) {
|
||||
Lifecycle bean = entry.getValue();
|
||||
int shutdownOrder = getPhase(bean);
|
||||
@@ -196,7 +196,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
|
||||
group.add(entry.getKey(), bean);
|
||||
}
|
||||
if (phases.size() > 0) {
|
||||
List<Integer> keys = new ArrayList<Integer>(phases.keySet());
|
||||
List<Integer> keys = new ArrayList<>(phases.keySet());
|
||||
Collections.sort(keys, Collections.reverseOrder());
|
||||
for (Integer key : keys) {
|
||||
phases.get(key).stop();
|
||||
@@ -269,7 +269,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
|
||||
* @return the Map of applicable beans, with bean names as keys and bean instances as values
|
||||
*/
|
||||
protected Map<String, Lifecycle> getLifecycleBeans() {
|
||||
Map<String, Lifecycle> beans = new LinkedHashMap<String, Lifecycle>();
|
||||
Map<String, Lifecycle> beans = new LinkedHashMap<>();
|
||||
String[] beanNames = this.beanFactory.getBeanNamesForType(Lifecycle.class, false, false);
|
||||
for (String beanName : beanNames) {
|
||||
String beanNameToRegister = BeanFactoryUtils.transformedBeanName(beanName);
|
||||
@@ -307,7 +307,7 @@ public class DefaultLifecycleProcessor implements LifecycleProcessor, BeanFactor
|
||||
*/
|
||||
private class LifecycleGroup {
|
||||
|
||||
private final List<LifecycleGroupMember> members = new ArrayList<LifecycleGroupMember>();
|
||||
private final List<LifecycleGroupMember> members = new ArrayList<>();
|
||||
|
||||
private final int phase;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -55,7 +55,7 @@ public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAwar
|
||||
public static final String MBEAN_APPLICATION_KEY = "application";
|
||||
|
||||
private static final Set<ConfigurableApplicationContext> applicationContexts =
|
||||
new LinkedHashSet<ConfigurableApplicationContext>();
|
||||
new LinkedHashSet<>();
|
||||
|
||||
|
||||
static void registerApplicationContext(ConfigurableApplicationContext applicationContext) {
|
||||
@@ -128,7 +128,7 @@ public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAwar
|
||||
*/
|
||||
protected Set<ConfigurableApplicationContext> findApplicationContexts() {
|
||||
synchronized (applicationContexts) {
|
||||
return new LinkedHashSet<ConfigurableApplicationContext>(applicationContexts);
|
||||
return new LinkedHashSet<>(applicationContexts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -53,7 +53,7 @@ public abstract class MessageSourceSupport {
|
||||
* codes are cached on a specific basis in subclasses.
|
||||
*/
|
||||
private final Map<String, Map<Locale, MessageFormat>> messageFormatsPerMessage =
|
||||
new HashMap<String, Map<Locale, MessageFormat>>();
|
||||
new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -122,7 +122,7 @@ public abstract class MessageSourceSupport {
|
||||
messageFormat = messageFormatsPerLocale.get(locale);
|
||||
}
|
||||
else {
|
||||
messageFormatsPerLocale = new HashMap<Locale, MessageFormat>();
|
||||
messageFormatsPerLocale = new HashMap<>();
|
||||
this.messageFormatsPerMessage.put(msg, messageFormatsPerLocale);
|
||||
}
|
||||
if (messageFormat == null) {
|
||||
|
||||
@@ -58,13 +58,13 @@ class PostProcessorRegistrationDelegate {
|
||||
ConfigurableListableBeanFactory beanFactory, List<BeanFactoryPostProcessor> beanFactoryPostProcessors) {
|
||||
|
||||
// Invoke BeanDefinitionRegistryPostProcessors first, if any.
|
||||
Set<String> processedBeans = new HashSet<String>();
|
||||
Set<String> processedBeans = new HashSet<>();
|
||||
|
||||
if (beanFactory instanceof BeanDefinitionRegistry) {
|
||||
BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory;
|
||||
List<BeanFactoryPostProcessor> regularPostProcessors = new LinkedList<BeanFactoryPostProcessor>();
|
||||
List<BeanFactoryPostProcessor> regularPostProcessors = new LinkedList<>();
|
||||
List<BeanDefinitionRegistryPostProcessor> registryPostProcessors =
|
||||
new LinkedList<BeanDefinitionRegistryPostProcessor>();
|
||||
new LinkedList<>();
|
||||
|
||||
for (BeanFactoryPostProcessor postProcessor : beanFactoryPostProcessors) {
|
||||
if (postProcessor instanceof BeanDefinitionRegistryPostProcessor) {
|
||||
@@ -86,7 +86,7 @@ class PostProcessorRegistrationDelegate {
|
||||
beanFactory.getBeanNamesForType(BeanDefinitionRegistryPostProcessor.class, true, false);
|
||||
|
||||
// First, invoke the BeanDefinitionRegistryPostProcessors that implement PriorityOrdered.
|
||||
List<BeanDefinitionRegistryPostProcessor> priorityOrderedPostProcessors = new ArrayList<BeanDefinitionRegistryPostProcessor>();
|
||||
List<BeanDefinitionRegistryPostProcessor> priorityOrderedPostProcessors = new ArrayList<>();
|
||||
for (String ppName : postProcessorNames) {
|
||||
if (beanFactory.isTypeMatch(ppName, PriorityOrdered.class)) {
|
||||
priorityOrderedPostProcessors.add(beanFactory.getBean(ppName, BeanDefinitionRegistryPostProcessor.class));
|
||||
@@ -99,7 +99,7 @@ class PostProcessorRegistrationDelegate {
|
||||
|
||||
// Next, invoke the BeanDefinitionRegistryPostProcessors that implement Ordered.
|
||||
postProcessorNames = beanFactory.getBeanNamesForType(BeanDefinitionRegistryPostProcessor.class, true, false);
|
||||
List<BeanDefinitionRegistryPostProcessor> orderedPostProcessors = new ArrayList<BeanDefinitionRegistryPostProcessor>();
|
||||
List<BeanDefinitionRegistryPostProcessor> orderedPostProcessors = new ArrayList<>();
|
||||
for (String ppName : postProcessorNames) {
|
||||
if (!processedBeans.contains(ppName) && beanFactory.isTypeMatch(ppName, Ordered.class)) {
|
||||
orderedPostProcessors.add(beanFactory.getBean(ppName, BeanDefinitionRegistryPostProcessor.class));
|
||||
@@ -143,9 +143,9 @@ class PostProcessorRegistrationDelegate {
|
||||
|
||||
// Separate between BeanFactoryPostProcessors that implement PriorityOrdered,
|
||||
// Ordered, and the rest.
|
||||
List<BeanFactoryPostProcessor> priorityOrderedPostProcessors = new ArrayList<BeanFactoryPostProcessor>();
|
||||
List<String> orderedPostProcessorNames = new ArrayList<String>();
|
||||
List<String> nonOrderedPostProcessorNames = new ArrayList<String>();
|
||||
List<BeanFactoryPostProcessor> priorityOrderedPostProcessors = new ArrayList<>();
|
||||
List<String> orderedPostProcessorNames = new ArrayList<>();
|
||||
List<String> nonOrderedPostProcessorNames = new ArrayList<>();
|
||||
for (String ppName : postProcessorNames) {
|
||||
if (processedBeans.contains(ppName)) {
|
||||
// skip - already processed in first phase above
|
||||
@@ -166,7 +166,7 @@ class PostProcessorRegistrationDelegate {
|
||||
invokeBeanFactoryPostProcessors(priorityOrderedPostProcessors, beanFactory);
|
||||
|
||||
// Next, invoke the BeanFactoryPostProcessors that implement Ordered.
|
||||
List<BeanFactoryPostProcessor> orderedPostProcessors = new ArrayList<BeanFactoryPostProcessor>();
|
||||
List<BeanFactoryPostProcessor> orderedPostProcessors = new ArrayList<>();
|
||||
for (String postProcessorName : orderedPostProcessorNames) {
|
||||
orderedPostProcessors.add(beanFactory.getBean(postProcessorName, BeanFactoryPostProcessor.class));
|
||||
}
|
||||
@@ -174,7 +174,7 @@ class PostProcessorRegistrationDelegate {
|
||||
invokeBeanFactoryPostProcessors(orderedPostProcessors, beanFactory);
|
||||
|
||||
// Finally, invoke all other BeanFactoryPostProcessors.
|
||||
List<BeanFactoryPostProcessor> nonOrderedPostProcessors = new ArrayList<BeanFactoryPostProcessor>();
|
||||
List<BeanFactoryPostProcessor> nonOrderedPostProcessors = new ArrayList<>();
|
||||
for (String postProcessorName : nonOrderedPostProcessorNames) {
|
||||
nonOrderedPostProcessors.add(beanFactory.getBean(postProcessorName, BeanFactoryPostProcessor.class));
|
||||
}
|
||||
@@ -198,10 +198,10 @@ class PostProcessorRegistrationDelegate {
|
||||
|
||||
// Separate between BeanPostProcessors that implement PriorityOrdered,
|
||||
// Ordered, and the rest.
|
||||
List<BeanPostProcessor> priorityOrderedPostProcessors = new ArrayList<BeanPostProcessor>();
|
||||
List<BeanPostProcessor> internalPostProcessors = new ArrayList<BeanPostProcessor>();
|
||||
List<String> orderedPostProcessorNames = new ArrayList<String>();
|
||||
List<String> nonOrderedPostProcessorNames = new ArrayList<String>();
|
||||
List<BeanPostProcessor> priorityOrderedPostProcessors = new ArrayList<>();
|
||||
List<BeanPostProcessor> internalPostProcessors = new ArrayList<>();
|
||||
List<String> orderedPostProcessorNames = new ArrayList<>();
|
||||
List<String> nonOrderedPostProcessorNames = new ArrayList<>();
|
||||
for (String ppName : postProcessorNames) {
|
||||
if (beanFactory.isTypeMatch(ppName, PriorityOrdered.class)) {
|
||||
BeanPostProcessor pp = beanFactory.getBean(ppName, BeanPostProcessor.class);
|
||||
@@ -223,7 +223,7 @@ class PostProcessorRegistrationDelegate {
|
||||
registerBeanPostProcessors(beanFactory, priorityOrderedPostProcessors);
|
||||
|
||||
// Next, register the BeanPostProcessors that implement Ordered.
|
||||
List<BeanPostProcessor> orderedPostProcessors = new ArrayList<BeanPostProcessor>();
|
||||
List<BeanPostProcessor> orderedPostProcessors = new ArrayList<>();
|
||||
for (String ppName : orderedPostProcessorNames) {
|
||||
BeanPostProcessor pp = beanFactory.getBean(ppName, BeanPostProcessor.class);
|
||||
orderedPostProcessors.add(pp);
|
||||
@@ -235,7 +235,7 @@ class PostProcessorRegistrationDelegate {
|
||||
registerBeanPostProcessors(beanFactory, orderedPostProcessors);
|
||||
|
||||
// Now, register all regular BeanPostProcessors.
|
||||
List<BeanPostProcessor> nonOrderedPostProcessors = new ArrayList<BeanPostProcessor>();
|
||||
List<BeanPostProcessor> nonOrderedPostProcessors = new ArrayList<>();
|
||||
for (String ppName : nonOrderedPostProcessorNames) {
|
||||
BeanPostProcessor pp = beanFactory.getBean(ppName, BeanPostProcessor.class);
|
||||
nonOrderedPostProcessors.add(pp);
|
||||
@@ -360,7 +360,7 @@ class PostProcessorRegistrationDelegate {
|
||||
|
||||
private transient final AbstractApplicationContext applicationContext;
|
||||
|
||||
private transient final Map<String, Boolean> singletonNames = new ConcurrentHashMap<String, Boolean>(256);
|
||||
private transient final Map<String, Boolean> singletonNames = new ConcurrentHashMap<>(256);
|
||||
|
||||
public ApplicationListenerDetector(AbstractApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
|
||||
@@ -101,15 +101,15 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
|
||||
|
||||
/** Cache to hold filename lists per Locale */
|
||||
private final ConcurrentMap<String, Map<Locale, List<String>>> cachedFilenames =
|
||||
new ConcurrentHashMap<String, Map<Locale, List<String>>>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
/** Cache to hold already loaded properties per filename */
|
||||
private final ConcurrentMap<String, PropertiesHolder> cachedProperties =
|
||||
new ConcurrentHashMap<String, PropertiesHolder>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
/** Cache to hold merged loaded properties per locale */
|
||||
private final ConcurrentMap<Locale, PropertiesHolder> cachedMergedProperties =
|
||||
new ConcurrentHashMap<Locale, PropertiesHolder>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -274,7 +274,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
|
||||
return filenames;
|
||||
}
|
||||
}
|
||||
List<String> filenames = new ArrayList<String>(7);
|
||||
List<String> filenames = new ArrayList<>(7);
|
||||
filenames.addAll(calculateFilenamesForLocale(basename, locale));
|
||||
if (isFallbackToSystemLocale() && !locale.equals(Locale.getDefault())) {
|
||||
List<String> fallbackFilenames = calculateFilenamesForLocale(basename, Locale.getDefault());
|
||||
@@ -287,7 +287,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
|
||||
}
|
||||
filenames.add(basename);
|
||||
if (localeMap == null) {
|
||||
localeMap = new ConcurrentHashMap<Locale, List<String>>();
|
||||
localeMap = new ConcurrentHashMap<>();
|
||||
Map<Locale, List<String>> existing = this.cachedFilenames.putIfAbsent(basename, localeMap);
|
||||
if (existing != null) {
|
||||
localeMap = existing;
|
||||
@@ -308,7 +308,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
|
||||
* @return the List of filenames to check
|
||||
*/
|
||||
protected List<String> calculateFilenamesForLocale(String basename, Locale locale) {
|
||||
List<String> result = new ArrayList<String>(3);
|
||||
List<String> result = new ArrayList<>(3);
|
||||
String language = locale.getLanguage();
|
||||
String country = locale.getCountry();
|
||||
String variant = locale.getVariant();
|
||||
@@ -553,7 +553,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
|
||||
|
||||
/** Cache to hold already generated MessageFormats per message code */
|
||||
private final ConcurrentMap<String, Map<Locale, MessageFormat>> cachedMessageFormats =
|
||||
new ConcurrentHashMap<String, Map<Locale, MessageFormat>>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
public PropertiesHolder() {
|
||||
this.properties = null;
|
||||
@@ -602,7 +602,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
|
||||
String msg = this.properties.getProperty(code);
|
||||
if (msg != null) {
|
||||
if (localeMap == null) {
|
||||
localeMap = new ConcurrentHashMap<Locale, MessageFormat>();
|
||||
localeMap = new ConcurrentHashMap<>();
|
||||
Map<Locale, MessageFormat> existing = this.cachedMessageFormats.putIfAbsent(code, localeMap);
|
||||
if (existing != null) {
|
||||
localeMap = existing;
|
||||
|
||||
@@ -77,7 +77,7 @@ public class ResourceBundleMessageSource extends AbstractResourceBasedMessageSou
|
||||
* than the ResourceBundle class's own cache.
|
||||
*/
|
||||
private final Map<String, Map<Locale, ResourceBundle>> cachedResourceBundles =
|
||||
new HashMap<String, Map<Locale, ResourceBundle>>();
|
||||
new HashMap<>();
|
||||
|
||||
/**
|
||||
* Cache to hold already generated MessageFormats.
|
||||
@@ -88,7 +88,7 @@ public class ResourceBundleMessageSource extends AbstractResourceBasedMessageSou
|
||||
* @see #getMessageFormat
|
||||
*/
|
||||
private final Map<ResourceBundle, Map<String, Map<Locale, MessageFormat>>> cachedBundleMessageFormats =
|
||||
new HashMap<ResourceBundle, Map<String, Map<Locale, MessageFormat>>>();
|
||||
new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -184,7 +184,7 @@ public class ResourceBundleMessageSource extends AbstractResourceBasedMessageSou
|
||||
try {
|
||||
ResourceBundle bundle = doGetBundle(basename, locale);
|
||||
if (localeMap == null) {
|
||||
localeMap = new HashMap<Locale, ResourceBundle>();
|
||||
localeMap = new HashMap<>();
|
||||
this.cachedResourceBundles.put(basename, localeMap);
|
||||
}
|
||||
localeMap.put(locale, bundle);
|
||||
@@ -257,11 +257,11 @@ public class ResourceBundleMessageSource extends AbstractResourceBasedMessageSou
|
||||
String msg = getStringOrNull(bundle, code);
|
||||
if (msg != null) {
|
||||
if (codeMap == null) {
|
||||
codeMap = new HashMap<String, Map<Locale, MessageFormat>>();
|
||||
codeMap = new HashMap<>();
|
||||
this.cachedBundleMessageFormats.put(bundle, codeMap);
|
||||
}
|
||||
if (localeMap == null) {
|
||||
localeMap = new HashMap<Locale, MessageFormat>();
|
||||
localeMap = new HashMap<>();
|
||||
codeMap.put(code, localeMap);
|
||||
}
|
||||
MessageFormat result = createMessageFormat(msg, locale);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -59,7 +59,7 @@ public class SimpleThreadScope implements Scope {
|
||||
new NamedThreadLocal<Map<String, Object>>("SimpleThreadScope") {
|
||||
@Override
|
||||
protected Map<String, Object> initialValue() {
|
||||
return new HashMap<String, Object>();
|
||||
return new HashMap<>();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -36,9 +36,9 @@ import org.springframework.util.Assert;
|
||||
public class StaticMessageSource extends AbstractMessageSource {
|
||||
|
||||
/** Map from 'code + locale' keys to message Strings */
|
||||
private final Map<String, String> messages = new HashMap<String, String>();
|
||||
private final Map<String, String> messages = new HashMap<>();
|
||||
|
||||
private final Map<String, MessageFormat> cachedMessageFormats = new HashMap<String, MessageFormat>();
|
||||
private final Map<String, MessageFormat> cachedMessageFormats = new HashMap<>();
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -82,7 +82,7 @@ public class SpringBeanAutowiringInterceptor {
|
||||
* It simply protects against future usage of the interceptor in a shared scenario.
|
||||
*/
|
||||
private final Map<Object, BeanFactoryReference> beanFactoryReferences =
|
||||
new WeakHashMap<Object, BeanFactoryReference>();
|
||||
new WeakHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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,7 +46,7 @@ public class DateFormatter implements Formatter<Date> {
|
||||
private static final Map<ISO, String> ISO_PATTERNS;
|
||||
|
||||
static {
|
||||
Map<ISO, String> formats = new HashMap<DateTimeFormat.ISO, String>(4);
|
||||
Map<ISO, String> formats = new HashMap<>(4);
|
||||
formats.put(ISO.DATE, "yyyy-MM-dd");
|
||||
formats.put(ISO.TIME, "HH:mm:ss.SSSZ");
|
||||
formats.put(ISO.DATE_TIME, "yyyy-MM-dd'T'HH:mm:ss.SSSZ");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -44,7 +44,7 @@ public class DateTimeFormatAnnotationFormatterFactory extends EmbeddedValueReso
|
||||
private static final Set<Class<?>> FIELD_TYPES;
|
||||
|
||||
static {
|
||||
Set<Class<?>> fieldTypes = new HashSet<Class<?>>(4);
|
||||
Set<Class<?>> fieldTypes = new HashSet<>(4);
|
||||
fieldTypes.add(Date.class);
|
||||
fieldTypes.add(Calendar.class);
|
||||
fieldTypes.add(Long.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -57,7 +57,7 @@ public class JodaDateTimeFormatAnnotationFormatterFactory extends EmbeddedValueR
|
||||
// (if we did not do this, the default byType rules for LocalDate, LocalTime,
|
||||
// and LocalDateTime would take precedence over the annotation rule, which
|
||||
// is not what we want)
|
||||
Set<Class<?>> fieldTypes = new HashSet<Class<?>>(8);
|
||||
Set<Class<?>> fieldTypes = new HashSet<>(8);
|
||||
fieldTypes.add(ReadableInstant.class);
|
||||
fieldTypes.add(LocalDate.class);
|
||||
fieldTypes.add(LocalTime.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -33,7 +33,7 @@ import org.springframework.core.NamedThreadLocal;
|
||||
public final class JodaTimeContextHolder {
|
||||
|
||||
private static final ThreadLocal<JodaTimeContext> jodaTimeContextHolder =
|
||||
new NamedThreadLocal<JodaTimeContext>("JodaTime Context");
|
||||
new NamedThreadLocal<>("JodaTime Context");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -73,7 +73,7 @@ public class JodaTimeFormatterRegistrar implements FormatterRegistrar {
|
||||
/**
|
||||
* User defined formatters.
|
||||
*/
|
||||
private final Map<Type, DateTimeFormatter> formatters = new HashMap<Type, DateTimeFormatter>();
|
||||
private final Map<Type, DateTimeFormatter> formatters = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Factories used when specific formatters have not been specified.
|
||||
@@ -82,7 +82,7 @@ public class JodaTimeFormatterRegistrar implements FormatterRegistrar {
|
||||
|
||||
|
||||
public JodaTimeFormatterRegistrar() {
|
||||
this.factories = new HashMap<Type, DateTimeFormatterFactory>();
|
||||
this.factories = new HashMap<>();
|
||||
for (Type type : Type.values()) {
|
||||
this.factories.put(type, new DateTimeFormatterFactory());
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.core.NamedThreadLocal;
|
||||
public final class DateTimeContextHolder {
|
||||
|
||||
private static final ThreadLocal<DateTimeContext> dateTimeContextHolder =
|
||||
new NamedThreadLocal<DateTimeContext>("DateTime Context");
|
||||
new NamedThreadLocal<>("DateTime Context");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,7 +58,7 @@ public class DateTimeFormatterRegistrar implements FormatterRegistrar {
|
||||
/**
|
||||
* User defined formatters.
|
||||
*/
|
||||
private final Map<Type, DateTimeFormatter> formatters = new HashMap<Type, DateTimeFormatter>();
|
||||
private final Map<Type, DateTimeFormatter> formatters = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Factories used when specific formatters have not been specified.
|
||||
@@ -67,7 +67,7 @@ public class DateTimeFormatterRegistrar implements FormatterRegistrar {
|
||||
|
||||
|
||||
public DateTimeFormatterRegistrar() {
|
||||
this.factories = new HashMap<Type, DateTimeFormatterFactory>();
|
||||
this.factories = new HashMap<>();
|
||||
for (Type type : Type.values()) {
|
||||
this.factories.put(type, new DateTimeFormatterFactory());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -49,7 +49,7 @@ public class Jsr310DateTimeFormatAnnotationFormatterFactory extends EmbeddedValu
|
||||
|
||||
static {
|
||||
// Create the set of field types that may be annotated with @DateTimeFormat.
|
||||
Set<Class<?>> fieldTypes = new HashSet<Class<?>>(8);
|
||||
Set<Class<?>> fieldTypes = new HashSet<>(8);
|
||||
fieldTypes.add(LocalDate.class);
|
||||
fieldTypes.add(LocalTime.class);
|
||||
fieldTypes.add(LocalDateTime.class);
|
||||
|
||||
@@ -53,10 +53,10 @@ public class FormattingConversionService extends GenericConversionService
|
||||
private StringValueResolver embeddedValueResolver;
|
||||
|
||||
private final Map<AnnotationConverterKey, GenericConverter> cachedPrinters =
|
||||
new ConcurrentHashMap<AnnotationConverterKey, GenericConverter>(64);
|
||||
new ConcurrentHashMap<>(64);
|
||||
|
||||
private final Map<AnnotationConverterKey, GenericConverter> cachedParsers =
|
||||
new ConcurrentHashMap<AnnotationConverterKey, GenericConverter>(64);
|
||||
new ConcurrentHashMap<>(64);
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -57,7 +57,7 @@ public class InstrumentationLoadTimeWeaver implements LoadTimeWeaver {
|
||||
|
||||
private final Instrumentation instrumentation;
|
||||
|
||||
private final List<ClassFileTransformer> transformers = new ArrayList<ClassFileTransformer>(4);
|
||||
private final List<ClassFileTransformer> transformers = new ArrayList<>(4);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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 ResourceOverridingShadowingClassLoader extends ShadowingClassLoader
|
||||
/**
|
||||
* Key is asked for value: value is actual value
|
||||
*/
|
||||
private Map<String, String> overrides = new HashMap<String, String>();
|
||||
private Map<String, String> overrides = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -54,9 +54,9 @@ public class ShadowingClassLoader extends DecoratingClassLoader {
|
||||
|
||||
private final ClassLoader enclosingClassLoader;
|
||||
|
||||
private final List<ClassFileTransformer> classFileTransformers = new LinkedList<ClassFileTransformer>();
|
||||
private final List<ClassFileTransformer> classFileTransformers = new LinkedList<>();
|
||||
|
||||
private final Map<String, Class<?>> classCache = new HashMap<String, Class<?>>();
|
||||
private final Map<String, Class<?>> classCache = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -38,7 +38,7 @@ public class WeavingTransformer {
|
||||
|
||||
private final ClassLoader classLoader;
|
||||
|
||||
private final List<ClassFileTransformer> transformers = new ArrayList<ClassFileTransformer>();
|
||||
private final List<ClassFileTransformer> transformers = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -122,7 +122,7 @@ public class MBeanClientInterceptor
|
||||
|
||||
private Map<MethodCacheKey, MBeanOperationInfo> allowedOperations;
|
||||
|
||||
private final Map<Method, String[]> signatureCache = new HashMap<Method, String[]>();
|
||||
private final Map<Method, String[]> signatureCache = new HashMap<>();
|
||||
|
||||
private final Object preparationMonitor = new Object();
|
||||
|
||||
@@ -285,13 +285,13 @@ public class MBeanClientInterceptor
|
||||
MBeanInfo info = this.serverToUse.getMBeanInfo(this.objectName);
|
||||
|
||||
MBeanAttributeInfo[] attributeInfo = info.getAttributes();
|
||||
this.allowedAttributes = new HashMap<String, MBeanAttributeInfo>(attributeInfo.length);
|
||||
this.allowedAttributes = new HashMap<>(attributeInfo.length);
|
||||
for (MBeanAttributeInfo infoEle : attributeInfo) {
|
||||
this.allowedAttributes.put(infoEle.getName(), infoEle);
|
||||
}
|
||||
|
||||
MBeanOperationInfo[] operationInfo = info.getOperations();
|
||||
this.allowedOperations = new HashMap<MethodCacheKey, MBeanOperationInfo>(operationInfo.length);
|
||||
this.allowedOperations = new HashMap<>(operationInfo.length);
|
||||
for (MBeanOperationInfo infoEle : operationInfo) {
|
||||
Class<?>[] paramTypes = JmxUtils.parameterInfoToTypes(infoEle.getSignature(), this.beanClassLoader);
|
||||
this.allowedOperations.put(new MethodCacheKey(infoEle.getName(), paramTypes), infoEle);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -161,7 +161,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
|
||||
private boolean exposeManagedResourceClassLoader = true;
|
||||
|
||||
/** A set of bean names that should be excluded from autodetection */
|
||||
private Set<String> excludedBeans = new HashSet<String>();
|
||||
private Set<String> excludedBeans = new HashSet<>();
|
||||
|
||||
/** The MBeanExporterListeners registered with this exporter. */
|
||||
private MBeanExporterListener[] listeners;
|
||||
@@ -171,7 +171,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
|
||||
|
||||
/** Map of actually registered NotificationListeners */
|
||||
private final Map<NotificationListenerBean, ObjectName[]> registeredNotificationListeners =
|
||||
new LinkedHashMap<NotificationListenerBean, ObjectName[]>();
|
||||
new LinkedHashMap<>();
|
||||
|
||||
/** Stores the ClassLoader to use for generating lazy-init proxies */
|
||||
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
@@ -366,7 +366,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
|
||||
public void setNotificationListenerMappings(Map<?, ? extends NotificationListener> listeners) {
|
||||
Assert.notNull(listeners, "'listeners' must not be null");
|
||||
List<NotificationListenerBean> notificationListeners =
|
||||
new ArrayList<NotificationListenerBean>(listeners.size());
|
||||
new ArrayList<>(listeners.size());
|
||||
|
||||
for (Map.Entry<?, ? extends NotificationListener> entry : listeners.entrySet()) {
|
||||
// Get the listener from the map value.
|
||||
@@ -520,7 +520,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
|
||||
protected void registerBeans() {
|
||||
// The beans property may be null, for example if we are relying solely on autodetection.
|
||||
if (this.beans == null) {
|
||||
this.beans = new HashMap<String, Object>();
|
||||
this.beans = new HashMap<>();
|
||||
// Use AUTODETECT_ALL as default in no beans specified explicitly.
|
||||
if (this.autodetectMode == null) {
|
||||
this.autodetectMode = AUTODETECT_ALL;
|
||||
@@ -891,7 +891,7 @@ public class MBeanExporter extends MBeanRegistrationSupport implements MBeanExpo
|
||||
* whether to include a bean or not
|
||||
*/
|
||||
private void autodetect(AutodetectCallback callback) {
|
||||
Set<String> beanNames = new LinkedHashSet<String>(this.beanFactory.getBeanDefinitionCount());
|
||||
Set<String> beanNames = new LinkedHashSet<>(this.beanFactory.getBeanDefinitionCount());
|
||||
beanNames.addAll(Arrays.asList(this.beanFactory.getBeanDefinitionNames()));
|
||||
if (this.beanFactory instanceof ConfigurableBeanFactory) {
|
||||
beanNames.addAll(Arrays.asList(((ConfigurableBeanFactory) this.beanFactory).getSingletonNames()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -40,7 +40,7 @@ public abstract class AbstractConfigurableMBeanInfoAssembler extends AbstractRef
|
||||
private ModelMBeanNotificationInfo[] notificationInfos;
|
||||
|
||||
private final Map<String, ModelMBeanNotificationInfo[]> notificationInfoMappings =
|
||||
new HashMap<String, ModelMBeanNotificationInfo[]>();
|
||||
new HashMap<>();
|
||||
|
||||
|
||||
public void setNotificationInfos(ManagedNotification[] notificationInfos) {
|
||||
@@ -78,7 +78,7 @@ public abstract class AbstractConfigurableMBeanInfoAssembler extends AbstractRef
|
||||
}
|
||||
else if (mapValue instanceof Collection) {
|
||||
Collection<?> col = (Collection<?>) mapValue;
|
||||
List<ModelMBeanNotificationInfo> result = new ArrayList<ModelMBeanNotificationInfo>();
|
||||
List<ModelMBeanNotificationInfo> result = new ArrayList<>();
|
||||
for (Object colValue : col) {
|
||||
if (!(colValue instanceof ManagedNotification)) {
|
||||
throw new IllegalArgumentException(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -292,7 +292,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
|
||||
@Override
|
||||
protected ModelMBeanAttributeInfo[] getAttributeInfo(Object managedBean, String beanKey) throws JMException {
|
||||
PropertyDescriptor[] props = BeanUtils.getPropertyDescriptors(getClassToExpose(managedBean));
|
||||
List<ModelMBeanAttributeInfo> infos = new ArrayList<ModelMBeanAttributeInfo>();
|
||||
List<ModelMBeanAttributeInfo> infos = new ArrayList<>();
|
||||
|
||||
for (PropertyDescriptor prop : props) {
|
||||
Method getter = prop.getReadMethod();
|
||||
@@ -346,7 +346,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
|
||||
@Override
|
||||
protected ModelMBeanOperationInfo[] getOperationInfo(Object managedBean, String beanKey) {
|
||||
Method[] methods = getClassToExpose(managedBean).getMethods();
|
||||
List<ModelMBeanOperationInfo> infos = new ArrayList<ModelMBeanOperationInfo>();
|
||||
List<ModelMBeanOperationInfo> infos = new ArrayList<>();
|
||||
|
||||
for (Method method : methods) {
|
||||
if (method.isSynthetic()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -128,7 +128,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
|
||||
* @return the resolved interface mappings (with Class objects as values)
|
||||
*/
|
||||
private Map<String, Class<?>[]> resolveInterfaceMappings(Properties mappings) {
|
||||
Map<String, Class<?>[]> resolvedMappings = new HashMap<String, Class<?>[]>(mappings.size());
|
||||
Map<String, Class<?>[]> resolvedMappings = new HashMap<>(mappings.size());
|
||||
for (Enumeration<?> en = mappings.propertyNames(); en.hasMoreElements();) {
|
||||
String beanKey = (String) en.nextElement();
|
||||
String[] classNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -69,7 +69,7 @@ public class MethodExclusionMBeanInfoAssembler extends AbstractConfigurableMBean
|
||||
* @see #setIgnoredMethodMappings(java.util.Properties)
|
||||
*/
|
||||
public void setIgnoredMethods(String... ignoredMethodNames) {
|
||||
this.ignoredMethods = new HashSet<String>(Arrays.asList(ignoredMethodNames));
|
||||
this.ignoredMethods = new HashSet<>(Arrays.asList(ignoredMethodNames));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,11 +80,11 @@ public class MethodExclusionMBeanInfoAssembler extends AbstractConfigurableMBean
|
||||
* Spring will check these mappings first.
|
||||
*/
|
||||
public void setIgnoredMethodMappings(Properties mappings) {
|
||||
this.ignoredMethodMappings = new HashMap<String, Set<String>>();
|
||||
this.ignoredMethodMappings = new HashMap<>();
|
||||
for (Enumeration<?> en = mappings.keys(); en.hasMoreElements();) {
|
||||
String beanKey = (String) en.nextElement();
|
||||
String[] methodNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey));
|
||||
this.ignoredMethodMappings.put(beanKey, new HashSet<String>(Arrays.asList(methodNames)));
|
||||
this.ignoredMethodMappings.put(beanKey, new HashSet<>(Arrays.asList(methodNames)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -73,7 +73,7 @@ public class MethodNameBasedMBeanInfoAssembler extends AbstractConfigurableMBean
|
||||
* @see #setMethodMappings
|
||||
*/
|
||||
public void setManagedMethods(String[] methodNames) {
|
||||
this.managedMethods = new HashSet<String>(Arrays.asList(methodNames));
|
||||
this.managedMethods = new HashSet<>(Arrays.asList(methodNames));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,11 +84,11 @@ public class MethodNameBasedMBeanInfoAssembler extends AbstractConfigurableMBean
|
||||
* @param mappings the mappins of bean keys to method names
|
||||
*/
|
||||
public void setMethodMappings(Properties mappings) {
|
||||
this.methodMappings = new HashMap<String, Set<String>>();
|
||||
this.methodMappings = new HashMap<>();
|
||||
for (Enumeration<?> en = mappings.keys(); en.hasMoreElements();) {
|
||||
String beanKey = (String) en.nextElement();
|
||||
String[] methodNames = StringUtils.commaDelimitedListToStringArray(mappings.getProperty(beanKey));
|
||||
this.methodMappings.put(beanKey, new HashSet<String>(Arrays.asList(methodNames)));
|
||||
this.methodMappings.put(beanKey, new HashSet<>(Arrays.asList(methodNames)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -49,7 +49,7 @@ public class IdentityNamingStrategy implements ObjectNamingStrategy {
|
||||
@Override
|
||||
public ObjectName getObjectName(Object managedBean, String beanKey) throws MalformedObjectNameException {
|
||||
String domain = ClassUtils.getPackageName(managedBean.getClass());
|
||||
Hashtable<String, String> keys = new Hashtable<String, String>();
|
||||
Hashtable<String, String> keys = new Hashtable<>();
|
||||
keys.put(TYPE_KEY, ClassUtils.getShortName(managedBean.getClass()));
|
||||
keys.put(HASH_CODE_KEY, ObjectUtils.getIdentityHexString(managedBean));
|
||||
return ObjectNameManager.getInstance(domain, keys);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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,7 +124,7 @@ public class MetadataNamingStrategy implements ObjectNamingStrategy, Initializin
|
||||
if (domain == null) {
|
||||
domain = ClassUtils.getPackageName(managedClass);
|
||||
}
|
||||
Hashtable<String, String> properties = new Hashtable<String, String>();
|
||||
Hashtable<String, String> properties = new Hashtable<>();
|
||||
properties.put("type", ClassUtils.getShortName(managedClass));
|
||||
properties.put("name", beanKey);
|
||||
return ObjectNameManager.getInstance(domain, properties);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -62,7 +62,7 @@ public class ConnectorServerFactoryBean extends MBeanRegistrationSupport
|
||||
|
||||
private String serviceUrl = DEFAULT_SERVICE_URL;
|
||||
|
||||
private Map<String, Object> environment = new HashMap<String, Object>();
|
||||
private Map<String, Object> environment = new HashMap<>();
|
||||
|
||||
private MBeanServerForwarder forwarder;
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class MBeanRegistrationSupport {
|
||||
/**
|
||||
* The beans that have been registered by this exporter.
|
||||
*/
|
||||
private final Set<ObjectName> registeredBeans = new LinkedHashSet<ObjectName>();
|
||||
private final Set<ObjectName> registeredBeans = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* The policy used when registering an MBean and finding that it already exists.
|
||||
@@ -174,7 +174,7 @@ public class MBeanRegistrationSupport {
|
||||
protected void unregisterBeans() {
|
||||
Set<ObjectName> snapshot;
|
||||
synchronized (this.registeredBeans) {
|
||||
snapshot = new LinkedHashSet<ObjectName>(this.registeredBeans);
|
||||
snapshot = new LinkedHashSet<>(this.registeredBeans);
|
||||
}
|
||||
if (!snapshot.isEmpty()) {
|
||||
logger.info("Unregistering JMX-exposed beans");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -54,7 +54,7 @@ public class MBeanServerConnectionFactoryBean
|
||||
|
||||
private JMXServiceURL serviceUrl;
|
||||
|
||||
private Map<String, Object> environment = new HashMap<String, Object>();
|
||||
private Map<String, Object> environment = new HashMap<>();
|
||||
|
||||
private boolean connectOnStartup = true;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -122,7 +122,7 @@ public class NotificationListenerHolder {
|
||||
*/
|
||||
public void setMappedObjectNames(Object[] mappedObjectNames) {
|
||||
this.mappedObjectNames = (mappedObjectNames != null ?
|
||||
new LinkedHashSet<Object>(Arrays.asList(mappedObjectNames)) : null);
|
||||
new LinkedHashSet<>(Arrays.asList(mappedObjectNames)) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -130,7 +130,7 @@ public class JndiTemplate {
|
||||
Hashtable<?, ?> icEnv = null;
|
||||
Properties env = getEnvironment();
|
||||
if (env != null) {
|
||||
icEnv = new Hashtable<Object, Object>(env.size());
|
||||
icEnv = new Hashtable<>(env.size());
|
||||
CollectionUtils.mergePropertiesIntoMap(env, icEnv);
|
||||
}
|
||||
return new InitialContext(icEnv);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -60,13 +60,13 @@ import org.springframework.jndi.TypeMismatchNamingException;
|
||||
public class SimpleJndiBeanFactory extends JndiLocatorSupport implements BeanFactory {
|
||||
|
||||
/** JNDI names of resources that are known to be shareable, i.e. can be cached */
|
||||
private final Set<String> shareableResources = new HashSet<String>();
|
||||
private final Set<String> shareableResources = new HashSet<>();
|
||||
|
||||
/** Cache of shareable singleton objects: bean name --> bean instance */
|
||||
private final Map<String, Object> singletonObjects = new HashMap<String, Object>();
|
||||
private final Map<String, Object> singletonObjects = new HashMap<>();
|
||||
|
||||
/** Cache of the types of nonshareable resources: bean name --> bean type */
|
||||
private final Map<String, Class<?>> resourceTypes = new HashMap<String, Class<?>>();
|
||||
private final Map<String, Class<?>> resourceTypes = new HashMap<>();
|
||||
|
||||
|
||||
public SimpleJndiBeanFactory() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -150,7 +150,7 @@ public class RemoteInvocation implements Serializable {
|
||||
*/
|
||||
public void addAttribute(String key, Serializable value) throws IllegalStateException {
|
||||
if (this.attributes == null) {
|
||||
this.attributes = new HashMap<String, Serializable>();
|
||||
this.attributes = new HashMap<>();
|
||||
}
|
||||
if (this.attributes.containsKey(key)) {
|
||||
throw new IllegalStateException("There is already an attribute with key '" + key + "' bound");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -43,7 +43,7 @@ public abstract class RemoteInvocationUtils {
|
||||
public static void fillInClientStackTraceIfPossible(Throwable ex) {
|
||||
if (ex != null) {
|
||||
StackTraceElement[] clientStack = new Throwable().getStackTrace();
|
||||
Set<Throwable> visitedExceptions = new HashSet<Throwable>();
|
||||
Set<Throwable> visitedExceptions = new HashSet<>();
|
||||
Throwable exToUpdate = ex;
|
||||
while (exToUpdate != null && !visitedExceptions.contains(exToUpdate)) {
|
||||
StackTraceElement[] serverStack = exToUpdate.getStackTrace();
|
||||
|
||||
@@ -79,7 +79,7 @@ public class AsyncAnnotationAdvisor extends AbstractPointcutAdvisor implements B
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public AsyncAnnotationAdvisor(Executor executor, AsyncUncaughtExceptionHandler exceptionHandler) {
|
||||
Set<Class<? extends Annotation>> asyncAnnotationTypes = new LinkedHashSet<Class<? extends Annotation>>(2);
|
||||
Set<Class<? extends Annotation>> asyncAnnotationTypes = new LinkedHashSet<>(2);
|
||||
asyncAnnotationTypes.add(Async.class);
|
||||
try {
|
||||
asyncAnnotationTypes.add((Class<? extends Annotation>)
|
||||
@@ -117,7 +117,7 @@ public class AsyncAnnotationAdvisor extends AbstractPointcutAdvisor implements B
|
||||
*/
|
||||
public void setAsyncAnnotationType(Class<? extends Annotation> asyncAnnotationType) {
|
||||
Assert.notNull(asyncAnnotationType, "'asyncAnnotationType' must not be null");
|
||||
Set<Class<? extends Annotation>> asyncAnnotationTypes = new HashSet<Class<? extends Annotation>>();
|
||||
Set<Class<? extends Annotation>> asyncAnnotationTypes = new HashSet<>();
|
||||
asyncAnnotationTypes.add(asyncAnnotationType);
|
||||
this.pointcut = buildPointcut(asyncAnnotationTypes);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class AsyncResult<V> implements ListenableFuture<V> {
|
||||
* @see Future#get()
|
||||
*/
|
||||
public static <V> ListenableFuture<V> forValue(V value) {
|
||||
return new AsyncResult<V>(value, null);
|
||||
return new AsyncResult<>(value, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +137,7 @@ public class AsyncResult<V> implements ListenableFuture<V> {
|
||||
* @see ExecutionException
|
||||
*/
|
||||
public static <V> ListenableFuture<V> forExecutionException(Throwable ex) {
|
||||
return new AsyncResult<V>(null,
|
||||
return new AsyncResult<>(null,
|
||||
(ex instanceof ExecutionException ? (ExecutionException) ex : new ExecutionException(ex)));
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ public class ScheduledAnnotationBeanPostProcessor implements DestructionAwareBea
|
||||
Collections.newSetFromMap(new ConcurrentHashMap<Class<?>, Boolean>(64));
|
||||
|
||||
private final Map<Object, Set<ScheduledTask>> scheduledTasks =
|
||||
new ConcurrentHashMap<Object, Set<ScheduledTask>>(16);
|
||||
new ConcurrentHashMap<>(16);
|
||||
|
||||
|
||||
@Override
|
||||
@@ -304,7 +304,7 @@ public class ScheduledAnnotationBeanPostProcessor implements DestructionAwareBea
|
||||
|
||||
Set<ScheduledTask> tasks = this.scheduledTasks.get(bean);
|
||||
if (tasks == null) {
|
||||
tasks = new LinkedHashSet<ScheduledTask>(4);
|
||||
tasks = new LinkedHashSet<>(4);
|
||||
this.scheduledTasks.put(bean, tasks);
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ public class ConcurrentTaskExecutor implements AsyncListenableTaskExecutor, Sche
|
||||
protected static class ManagedTaskBuilder {
|
||||
|
||||
public static Runnable buildManagedTask(Runnable task, String identityName) {
|
||||
Map<String, String> properties = new HashMap<String, String>(2);
|
||||
Map<String, String> properties = new HashMap<>(2);
|
||||
if (task instanceof SchedulingAwareRunnable) {
|
||||
properties.put(ManagedTask.LONGRUNNING_HINT,
|
||||
Boolean.toString(((SchedulingAwareRunnable) task).isLongLived()));
|
||||
@@ -239,7 +239,7 @@ public class ConcurrentTaskExecutor implements AsyncListenableTaskExecutor, Sche
|
||||
}
|
||||
|
||||
public static <T> Callable<T> buildManagedTask(Callable<T> task, String identityName) {
|
||||
Map<String, String> properties = new HashMap<String, String>(1);
|
||||
Map<String, String> properties = new HashMap<>(1);
|
||||
properties.put(ManagedTask.IDENTITY_NAME, identityName);
|
||||
return ManagedExecutors.managedTask(task, properties, null);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -181,10 +181,10 @@ public class ThreadPoolExecutorFactoryBean extends ExecutorConfigurationSupport
|
||||
*/
|
||||
protected BlockingQueue<Runnable> createQueue(int queueCapacity) {
|
||||
if (queueCapacity > 0) {
|
||||
return new LinkedBlockingQueue<Runnable>(queueCapacity);
|
||||
return new LinkedBlockingQueue<>(queueCapacity);
|
||||
}
|
||||
else {
|
||||
return new SynchronousQueue<Runnable>();
|
||||
return new SynchronousQueue<>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -244,10 +244,10 @@ public class ThreadPoolTaskExecutor extends ExecutorConfigurationSupport
|
||||
*/
|
||||
protected BlockingQueue<Runnable> createQueue(int queueCapacity) {
|
||||
if (queueCapacity > 0) {
|
||||
return new LinkedBlockingQueue<Runnable>(queueCapacity);
|
||||
return new LinkedBlockingQueue<>(queueCapacity);
|
||||
}
|
||||
else {
|
||||
return new SynchronousQueue<Runnable>();
|
||||
return new SynchronousQueue<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ public class ThreadPoolTaskExecutor extends ExecutorConfigurationSupport
|
||||
public ListenableFuture<?> submitListenable(Runnable task) {
|
||||
ExecutorService executor = getThreadPoolExecutor();
|
||||
try {
|
||||
ListenableFutureTask<Object> future = new ListenableFutureTask<Object>(task, null);
|
||||
ListenableFutureTask<Object> future = new ListenableFutureTask<>(task, null);
|
||||
executor.execute(future);
|
||||
return future;
|
||||
}
|
||||
@@ -341,7 +341,7 @@ public class ThreadPoolTaskExecutor extends ExecutorConfigurationSupport
|
||||
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
|
||||
ExecutorService executor = getThreadPoolExecutor();
|
||||
try {
|
||||
ListenableFutureTask<T> future = new ListenableFutureTask<T>(task);
|
||||
ListenableFutureTask<T> future = new ListenableFutureTask<>(task);
|
||||
executor.execute(future);
|
||||
return future;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
|
||||
try {
|
||||
Callable<T> taskToUse = task;
|
||||
if (this.errorHandler != null) {
|
||||
taskToUse = new DelegatingErrorHandlingCallable<T>(task, this.errorHandler);
|
||||
taskToUse = new DelegatingErrorHandlingCallable<>(task, this.errorHandler);
|
||||
}
|
||||
return executor.submit(taskToUse);
|
||||
}
|
||||
@@ -249,7 +249,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
|
||||
public ListenableFuture<?> submitListenable(Runnable task) {
|
||||
ExecutorService executor = getScheduledExecutor();
|
||||
try {
|
||||
ListenableFutureTask<Object> future = new ListenableFutureTask<Object>(task, null);
|
||||
ListenableFutureTask<Object> future = new ListenableFutureTask<>(task, null);
|
||||
executor.execute(errorHandlingTask(future, false));
|
||||
return future;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
|
||||
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
|
||||
ExecutorService executor = getScheduledExecutor();
|
||||
try {
|
||||
ListenableFutureTask<T> future = new ListenableFutureTask<T>(task);
|
||||
ListenableFutureTask<T> future = new ListenableFutureTask<>(task);
|
||||
executor.execute(errorHandlingTask(future, false));
|
||||
return future;
|
||||
}
|
||||
|
||||
@@ -67,9 +67,9 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||
|
||||
private List<IntervalTask> fixedDelayTasks;
|
||||
|
||||
private final Map<Task, ScheduledTask> unresolvedTasks = new HashMap<Task, ScheduledTask>(16);
|
||||
private final Map<Task, ScheduledTask> unresolvedTasks = new HashMap<>(16);
|
||||
|
||||
private final Set<ScheduledTask> scheduledTasks = new LinkedHashSet<ScheduledTask>(16);
|
||||
private final Set<ScheduledTask> scheduledTasks = new LinkedHashSet<>(16);
|
||||
|
||||
|
||||
/**
|
||||
@@ -111,7 +111,7 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||
* (typically custom implementations of the {@link Trigger} interface).
|
||||
*/
|
||||
public void setTriggerTasks(Map<Runnable, Trigger> triggerTasks) {
|
||||
this.triggerTasks = new ArrayList<TriggerTask>();
|
||||
this.triggerTasks = new ArrayList<>();
|
||||
for (Map.Entry<Runnable, Trigger> task : triggerTasks.entrySet()) {
|
||||
addTriggerTask(new TriggerTask(task.getKey(), task.getValue()));
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||
* @see CronTrigger
|
||||
*/
|
||||
public void setCronTasks(Map<Runnable, String> cronTasks) {
|
||||
this.cronTasks = new ArrayList<CronTask>();
|
||||
this.cronTasks = new ArrayList<>();
|
||||
for (Map.Entry<Runnable, String> task : cronTasks.entrySet()) {
|
||||
addCronTask(task.getKey(), task.getValue());
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||
* @see TaskScheduler#scheduleAtFixedRate(Runnable, long)
|
||||
*/
|
||||
public void setFixedRateTasks(Map<Runnable, Long> fixedRateTasks) {
|
||||
this.fixedRateTasks = new ArrayList<IntervalTask>();
|
||||
this.fixedRateTasks = new ArrayList<>();
|
||||
for (Map.Entry<Runnable, Long> task : fixedRateTasks.entrySet()) {
|
||||
addFixedRateTask(task.getKey(), task.getValue());
|
||||
}
|
||||
@@ -204,7 +204,7 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||
* @see TaskScheduler#scheduleWithFixedDelay(Runnable, long)
|
||||
*/
|
||||
public void setFixedDelayTasks(Map<Runnable, Long> fixedDelayTasks) {
|
||||
this.fixedDelayTasks = new ArrayList<IntervalTask>();
|
||||
this.fixedDelayTasks = new ArrayList<>();
|
||||
for (Map.Entry<Runnable, Long> task : fixedDelayTasks.entrySet()) {
|
||||
addFixedDelayTask(task.getKey(), task.getValue());
|
||||
}
|
||||
@@ -246,7 +246,7 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||
*/
|
||||
public void addTriggerTask(TriggerTask task) {
|
||||
if (this.triggerTasks == null) {
|
||||
this.triggerTasks = new ArrayList<TriggerTask>();
|
||||
this.triggerTasks = new ArrayList<>();
|
||||
}
|
||||
this.triggerTasks.add(task);
|
||||
}
|
||||
@@ -264,7 +264,7 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||
*/
|
||||
public void addCronTask(CronTask task) {
|
||||
if (this.cronTasks == null) {
|
||||
this.cronTasks = new ArrayList<CronTask>();
|
||||
this.cronTasks = new ArrayList<>();
|
||||
}
|
||||
this.cronTasks.add(task);
|
||||
}
|
||||
@@ -284,7 +284,7 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||
*/
|
||||
public void addFixedRateTask(IntervalTask task) {
|
||||
if (this.fixedRateTasks == null) {
|
||||
this.fixedRateTasks = new ArrayList<IntervalTask>();
|
||||
this.fixedRateTasks = new ArrayList<>();
|
||||
}
|
||||
this.fixedRateTasks.add(task);
|
||||
}
|
||||
@@ -304,7 +304,7 @@ public class ScheduledTaskRegistrar implements InitializingBean, DisposableBean
|
||||
*/
|
||||
public void addFixedDelayTask(IntervalTask task) {
|
||||
if (this.fixedDelayTasks == null) {
|
||||
this.fixedDelayTasks = new ArrayList<IntervalTask>();
|
||||
this.fixedDelayTasks = new ArrayList<>();
|
||||
}
|
||||
this.fixedDelayTasks.add(task);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -55,10 +55,10 @@ public class ScheduledTasksBeanDefinitionParser extends AbstractSingleBeanDefini
|
||||
@Override
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
builder.setLazyInit(false); // lazy scheduled tasks are a contradiction in terms -> force to false
|
||||
ManagedList<RuntimeBeanReference> cronTaskList = new ManagedList<RuntimeBeanReference>();
|
||||
ManagedList<RuntimeBeanReference> fixedDelayTaskList = new ManagedList<RuntimeBeanReference>();
|
||||
ManagedList<RuntimeBeanReference> fixedRateTaskList = new ManagedList<RuntimeBeanReference>();
|
||||
ManagedList<RuntimeBeanReference> triggerTaskList = new ManagedList<RuntimeBeanReference>();
|
||||
ManagedList<RuntimeBeanReference> cronTaskList = new ManagedList<>();
|
||||
ManagedList<RuntimeBeanReference> fixedDelayTaskList = new ManagedList<>();
|
||||
ManagedList<RuntimeBeanReference> fixedRateTaskList = new ManagedList<>();
|
||||
ManagedList<RuntimeBeanReference> triggerTaskList = new ManagedList<>();
|
||||
NodeList childNodes = element.getChildNodes();
|
||||
for (int i = 0; i < childNodes.getLength(); i++) {
|
||||
Node child = childNodes.item(i);
|
||||
|
||||
@@ -149,7 +149,7 @@ public class CronSequenceGenerator {
|
||||
}
|
||||
|
||||
private void doNext(Calendar calendar, int dot) {
|
||||
List<Integer> resets = new ArrayList<Integer>();
|
||||
List<Integer> resets = new ArrayList<>();
|
||||
|
||||
int second = calendar.get(Calendar.SECOND);
|
||||
List<Integer> emptyList = Collections.emptyList();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -176,7 +176,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
|
||||
final DefaultListableBeanFactory scriptBeanFactory = new DefaultListableBeanFactory();
|
||||
|
||||
/** Map from bean name String to ScriptSource object */
|
||||
private final Map<String, ScriptSource> scriptSourceCache = new HashMap<String, ScriptSource>();
|
||||
private final Map<String, ScriptSource> scriptSourceCache = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Set the delay between refresh checks, in milliseconds.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -48,7 +48,7 @@ public abstract class StandardScriptUtils {
|
||||
public static ScriptEngine retrieveEngineByName(ScriptEngineManager scriptEngineManager, String engineName) {
|
||||
ScriptEngine engine = scriptEngineManager.getEngineByName(engineName);
|
||||
if (engine == null) {
|
||||
Set<String> engineNames = new LinkedHashSet<String>();
|
||||
Set<String> engineNames = new LinkedHashSet<>();
|
||||
for (ScriptEngineFactory engineFactory : scriptEngineManager.getEngineFactories()) {
|
||||
List<String> factoryNames = engineFactory.getNames();
|
||||
if (factoryNames.contains(engineName)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -57,7 +57,7 @@ public class ResourceBundleThemeSource implements HierarchicalThemeSource, BeanC
|
||||
private ClassLoader beanClassLoader;
|
||||
|
||||
/** Map from theme name to Theme instance */
|
||||
private final Map<String, Theme> themeCache = new ConcurrentHashMap<String, Theme>();
|
||||
private final Map<String, Theme> themeCache = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -48,9 +48,9 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
|
||||
|
||||
private MessageCodesResolver messageCodesResolver = new DefaultMessageCodesResolver();
|
||||
|
||||
private final List<ObjectError> errors = new LinkedList<ObjectError>();
|
||||
private final List<ObjectError> errors = new LinkedList<>();
|
||||
|
||||
private final Set<String> suppressedFields = new HashSet<String>();
|
||||
private final Set<String> suppressedFields = new HashSet<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -155,7 +155,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
|
||||
|
||||
@Override
|
||||
public List<ObjectError> getGlobalErrors() {
|
||||
List<ObjectError> result = new LinkedList<ObjectError>();
|
||||
List<ObjectError> result = new LinkedList<>();
|
||||
for (ObjectError objectError : this.errors) {
|
||||
if (!(objectError instanceof FieldError)) {
|
||||
result.add(objectError);
|
||||
@@ -176,7 +176,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
|
||||
|
||||
@Override
|
||||
public List<FieldError> getFieldErrors() {
|
||||
List<FieldError> result = new LinkedList<FieldError>();
|
||||
List<FieldError> result = new LinkedList<>();
|
||||
for (ObjectError objectError : this.errors) {
|
||||
if (objectError instanceof FieldError) {
|
||||
result.add((FieldError) objectError);
|
||||
@@ -197,7 +197,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
|
||||
|
||||
@Override
|
||||
public List<FieldError> getFieldErrors(String field) {
|
||||
List<FieldError> result = new LinkedList<FieldError>();
|
||||
List<FieldError> result = new LinkedList<>();
|
||||
String fixedField = fixedField(field);
|
||||
for (ObjectError objectError : this.errors) {
|
||||
if (objectError instanceof FieldError && isMatchingFieldError(fixedField, (FieldError) objectError)) {
|
||||
@@ -270,7 +270,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getModel() {
|
||||
Map<String, Object> model = new LinkedHashMap<String, Object>(2);
|
||||
Map<String, Object> model = new LinkedHashMap<>(2);
|
||||
// Mapping from name to target object.
|
||||
model.put(getObjectName(), getTarget());
|
||||
// Errors instance, even if no errors.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -39,7 +39,7 @@ public abstract class AbstractErrors implements Errors, Serializable {
|
||||
|
||||
private String nestedPath = "";
|
||||
|
||||
private final Stack<String> nestedPathStack = new Stack<String>();
|
||||
private final Stack<String> nestedPathStack = new Stack<>();
|
||||
|
||||
|
||||
@Override
|
||||
@@ -144,7 +144,7 @@ public abstract class AbstractErrors implements Errors, Serializable {
|
||||
|
||||
@Override
|
||||
public List<ObjectError> getAllErrors() {
|
||||
List<ObjectError> result = new LinkedList<ObjectError>();
|
||||
List<ObjectError> result = new LinkedList<>();
|
||||
result.addAll(getGlobalErrors());
|
||||
result.addAll(getFieldErrors());
|
||||
return Collections.unmodifiableList(result);
|
||||
@@ -195,7 +195,7 @@ public abstract class AbstractErrors implements Errors, Serializable {
|
||||
@Override
|
||||
public List<FieldError> getFieldErrors(String field) {
|
||||
List<FieldError> fieldErrors = getFieldErrors();
|
||||
List<FieldError> result = new LinkedList<FieldError>();
|
||||
List<FieldError> result = new LinkedList<>();
|
||||
String fixedField = fixedField(field);
|
||||
for (FieldError error : fieldErrors) {
|
||||
if (isMatchingFieldError(fixedField, error)) {
|
||||
|
||||
@@ -145,7 +145,7 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
||||
|
||||
private BindingErrorProcessor bindingErrorProcessor = new DefaultBindingErrorProcessor();
|
||||
|
||||
private final List<Validator> validators = new ArrayList<Validator>();
|
||||
private final List<Validator> validators = new ArrayList<>();
|
||||
|
||||
private ConversionService conversionService;
|
||||
|
||||
@@ -762,7 +762,7 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
|
||||
protected void checkRequiredFields(MutablePropertyValues mpvs) {
|
||||
String[] requiredFields = getRequiredFields();
|
||||
if (!ObjectUtils.isEmpty(requiredFields)) {
|
||||
Map<String, PropertyValue> propertyValues = new HashMap<String, PropertyValue>();
|
||||
Map<String, PropertyValue> propertyValues = new HashMap<>();
|
||||
PropertyValue[] pvs = mpvs.getPropertyValues();
|
||||
for (PropertyValue pv : pvs) {
|
||||
String canonicalName = PropertyAccessorUtils.canonicalPropertyName(pv.getName());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -147,8 +147,8 @@ public class DefaultMessageCodesResolver implements MessageCodesResolver, Serial
|
||||
*/
|
||||
@Override
|
||||
public String[] resolveMessageCodes(String errorCode, String objectName, String field, Class<?> fieldType) {
|
||||
Set<String> codeList = new LinkedHashSet<String>();
|
||||
List<String> fieldList = new ArrayList<String>();
|
||||
Set<String> codeList = new LinkedHashSet<>();
|
||||
List<String> fieldList = new ArrayList<>();
|
||||
buildFieldList(field, fieldList);
|
||||
addCodes(codeList, errorCode, objectName, fieldList);
|
||||
int dotIndex = field.lastIndexOf('.');
|
||||
|
||||
@@ -99,7 +99,7 @@ public class LocalValidatorFactoryBean extends SpringValidatorAdapter
|
||||
|
||||
private Resource[] mappingLocations;
|
||||
|
||||
private final Map<String, String> validationPropertyMap = new HashMap<String, String>();
|
||||
private final Map<String, String> validationPropertyMap = new HashMap<>();
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ import org.springframework.validation.SmartValidator;
|
||||
*/
|
||||
public class SpringValidatorAdapter implements SmartValidator, javax.validation.Validator {
|
||||
|
||||
private static final Set<String> internalAnnotationAttributes = new HashSet<String>(3);
|
||||
private static final Set<String> internalAnnotationAttributes = new HashSet<>(3);
|
||||
|
||||
static {
|
||||
internalAnnotationAttributes.add("message");
|
||||
@@ -98,7 +98,7 @@ public class SpringValidatorAdapter implements SmartValidator, javax.validation.
|
||||
@Override
|
||||
public void validate(Object target, Errors errors, Object... validationHints) {
|
||||
if (this.targetValidator != null) {
|
||||
Set<Class<?>> groups = new LinkedHashSet<Class<?>>();
|
||||
Set<Class<?>> groups = new LinkedHashSet<>();
|
||||
if (validationHints != null) {
|
||||
for (Object hint : validationHints) {
|
||||
if (hint instanceof Class) {
|
||||
@@ -205,10 +205,10 @@ public class SpringValidatorAdapter implements SmartValidator, javax.validation.
|
||||
* @see org.springframework.validation.DefaultBindingErrorProcessor#getArgumentsForBindError
|
||||
*/
|
||||
protected Object[] getArgumentsForConstraint(String objectName, String field, ConstraintDescriptor<?> descriptor) {
|
||||
List<Object> arguments = new LinkedList<Object>();
|
||||
List<Object> arguments = new LinkedList<>();
|
||||
arguments.add(getResolvableField(objectName, field));
|
||||
// Using a TreeMap for alphabetical ordering of attribute names
|
||||
Map<String, Object> attributesToExpose = new TreeMap<String, Object>();
|
||||
Map<String, Object> attributesToExpose = new TreeMap<>();
|
||||
for (Map.Entry<String, Object> entry : descriptor.getAttributes().entrySet()) {
|
||||
String attributeName = entry.getKey();
|
||||
Object attributeValue = entry.getValue();
|
||||
|
||||
Reference in New Issue
Block a user