Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -808,7 +808,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
|
||||
*/
|
||||
private AbstractNestablePropertyAccessor getNestedPropertyAccessor(String nestedProperty) {
|
||||
if (this.nestedPropertyAccessors == null) {
|
||||
this.nestedPropertyAccessors = new HashMap<String, AbstractNestablePropertyAccessor>();
|
||||
this.nestedPropertyAccessors = new HashMap<>();
|
||||
}
|
||||
// Get value of bean property.
|
||||
PropertyTokenHolder tokens = getPropertyNameTokens(nestedProperty);
|
||||
@@ -909,7 +909,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
|
||||
private PropertyTokenHolder getPropertyNameTokens(String propertyName) {
|
||||
PropertyTokenHolder tokens = new PropertyTokenHolder();
|
||||
String actualName = null;
|
||||
List<String> keys = new ArrayList<String>(2);
|
||||
List<String> keys = new ArrayList<>(2);
|
||||
int searchIndex = 0;
|
||||
while (searchIndex != -1) {
|
||||
int keyStart = propertyName.indexOf(PROPERTY_KEY_PREFIX, searchIndex);
|
||||
|
||||
@@ -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.
|
||||
@@ -108,7 +108,7 @@ public abstract class AbstractPropertyAccessor extends TypeConverterSupport impl
|
||||
}
|
||||
catch (PropertyAccessException ex) {
|
||||
if (propertyAccessExceptions == null) {
|
||||
propertyAccessExceptions = new LinkedList<PropertyAccessException>();
|
||||
propertyAccessExceptions = new LinkedList<>();
|
||||
}
|
||||
propertyAccessExceptions.add(ex);
|
||||
}
|
||||
|
||||
@@ -114,14 +114,14 @@ public class CachedIntrospectionResults {
|
||||
* This variant is being used for cache-safe bean classes.
|
||||
*/
|
||||
static final ConcurrentMap<Class<?>, CachedIntrospectionResults> strongClassCache =
|
||||
new ConcurrentHashMap<Class<?>, CachedIntrospectionResults>(64);
|
||||
new ConcurrentHashMap<>(64);
|
||||
|
||||
/**
|
||||
* Map keyed by Class containing CachedIntrospectionResults, softly held.
|
||||
* This variant is being used for non-cache-safe bean classes.
|
||||
*/
|
||||
static final ConcurrentMap<Class<?>, CachedIntrospectionResults> softClassCache =
|
||||
new ConcurrentReferenceHashMap<Class<?>, CachedIntrospectionResults>(64);
|
||||
new ConcurrentReferenceHashMap<>(64);
|
||||
|
||||
|
||||
/**
|
||||
@@ -283,7 +283,7 @@ public class CachedIntrospectionResults {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Caching PropertyDescriptors for class [" + beanClass.getName() + "]");
|
||||
}
|
||||
this.propertyDescriptorCache = new LinkedHashMap<String, PropertyDescriptor>();
|
||||
this.propertyDescriptorCache = new LinkedHashMap<>();
|
||||
|
||||
// This call is slow so we do it once.
|
||||
PropertyDescriptor[] pds = this.beanInfo.getPropertyDescriptors();
|
||||
@@ -321,7 +321,7 @@ public class CachedIntrospectionResults {
|
||||
clazz = clazz.getSuperclass();
|
||||
}
|
||||
|
||||
this.typeDescriptorCache = new ConcurrentReferenceHashMap<PropertyDescriptor, TypeDescriptor>();
|
||||
this.typeDescriptorCache = new ConcurrentReferenceHashMap<>();
|
||||
}
|
||||
catch (IntrospectionException ex) {
|
||||
throw new FatalBeanException("Failed to obtain BeanInfo for class [" + beanClass.getName() + "]", ex);
|
||||
|
||||
@@ -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.
|
||||
@@ -46,7 +46,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
*/
|
||||
public class DirectFieldAccessor extends AbstractNestablePropertyAccessor {
|
||||
|
||||
private final Map<String, FieldPropertyHandler> fieldMap = new HashMap<String, FieldPropertyHandler>();
|
||||
private final Map<String, FieldPropertyHandler> fieldMap = 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.
|
||||
@@ -80,7 +80,7 @@ class ExtendedBeanInfo implements BeanInfo {
|
||||
private final BeanInfo delegate;
|
||||
|
||||
private final Set<PropertyDescriptor> propertyDescriptors =
|
||||
new TreeSet<PropertyDescriptor>(new PropertyDescriptorComparator());
|
||||
new TreeSet<>(new PropertyDescriptorComparator());
|
||||
|
||||
|
||||
/**
|
||||
@@ -128,7 +128,7 @@ class ExtendedBeanInfo implements BeanInfo {
|
||||
|
||||
|
||||
private List<Method> findCandidateWriteMethods(MethodDescriptor[] methodDescriptors) {
|
||||
List<Method> matches = new ArrayList<Method>();
|
||||
List<Method> matches = new ArrayList<>();
|
||||
for (MethodDescriptor methodDescriptor : methodDescriptors) {
|
||||
Method method = methodDescriptor.getMethod();
|
||||
if (isCandidateWriteMethod(method)) {
|
||||
|
||||
@@ -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.
|
||||
@@ -87,7 +87,7 @@ final class GenericTypeAwarePropertyDescriptor extends PropertyDescriptor {
|
||||
// Write method not matched against read method: potentially ambiguous through
|
||||
// several overloaded variants, in which case an arbitrary winner has been chosen
|
||||
// by the JDK's JavaBeans Introspector...
|
||||
Set<Method> ambiguousCandidates = new HashSet<Method>();
|
||||
Set<Method> ambiguousCandidates = new HashSet<>();
|
||||
for (Method method : beanClass.getMethods()) {
|
||||
if (method.getName().equals(writeMethodToUse.getName()) &&
|
||||
!method.equals(writeMethodToUse) && !method.isBridge() &&
|
||||
|
||||
@@ -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.
|
||||
@@ -51,7 +51,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
* @see #add(String, Object)
|
||||
*/
|
||||
public MutablePropertyValues() {
|
||||
this.propertyValueList = new ArrayList<PropertyValue>(0);
|
||||
this.propertyValueList = new ArrayList<>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,13 +66,13 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
// There is no replacement of existing property values.
|
||||
if (original != null) {
|
||||
PropertyValue[] pvs = original.getPropertyValues();
|
||||
this.propertyValueList = new ArrayList<PropertyValue>(pvs.length);
|
||||
this.propertyValueList = new ArrayList<>(pvs.length);
|
||||
for (PropertyValue pv : pvs) {
|
||||
this.propertyValueList.add(new PropertyValue(pv));
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.propertyValueList = new ArrayList<PropertyValue>(0);
|
||||
this.propertyValueList = new ArrayList<>(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,13 +85,13 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
// We can optimize this because it's all new:
|
||||
// There is no replacement of existing property values.
|
||||
if (original != null) {
|
||||
this.propertyValueList = new ArrayList<PropertyValue>(original.size());
|
||||
this.propertyValueList = new ArrayList<>(original.size());
|
||||
for (Map.Entry<?, ?> entry : original.entrySet()) {
|
||||
this.propertyValueList.add(new PropertyValue(entry.getKey().toString(), entry.getValue()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.propertyValueList = new ArrayList<PropertyValue>(0);
|
||||
this.propertyValueList = new ArrayList<>(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
*/
|
||||
public MutablePropertyValues(List<PropertyValue> propertyValueList) {
|
||||
this.propertyValueList =
|
||||
(propertyValueList != null ? propertyValueList : new ArrayList<PropertyValue>());
|
||||
(propertyValueList != null ? propertyValueList : new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ public class MutablePropertyValues implements PropertyValues, Serializable {
|
||||
*/
|
||||
public void registerProcessedProperty(String propertyName) {
|
||||
if (this.processedProperties == null) {
|
||||
this.processedProperties = new HashSet<String>();
|
||||
this.processedProperties = new HashSet<>();
|
||||
}
|
||||
this.processedProperties.add(propertyName);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -167,7 +167,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
||||
*/
|
||||
public void overrideDefaultEditor(Class<?> requiredType, PropertyEditor propertyEditor) {
|
||||
if (this.overriddenDefaultEditors == null) {
|
||||
this.overriddenDefaultEditors = new HashMap<Class<?>, PropertyEditor>();
|
||||
this.overriddenDefaultEditors = new HashMap<>();
|
||||
}
|
||||
this.overriddenDefaultEditors.put(requiredType, propertyEditor);
|
||||
}
|
||||
@@ -199,7 +199,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
||||
* Actually register the default editors for this registry instance.
|
||||
*/
|
||||
private void createDefaultEditors() {
|
||||
this.defaultEditors = new HashMap<Class<?>, PropertyEditor>(64);
|
||||
this.defaultEditors = new HashMap<>(64);
|
||||
|
||||
// Simple editors, without parameterization capabilities.
|
||||
// The JDK does not contain a default editor for any of these target types.
|
||||
@@ -298,13 +298,13 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
||||
}
|
||||
if (propertyPath != null) {
|
||||
if (this.customEditorsForPath == null) {
|
||||
this.customEditorsForPath = new LinkedHashMap<String, CustomEditorHolder>(16);
|
||||
this.customEditorsForPath = new LinkedHashMap<>(16);
|
||||
}
|
||||
this.customEditorsForPath.put(propertyPath, new CustomEditorHolder(propertyEditor, requiredType));
|
||||
}
|
||||
else {
|
||||
if (this.customEditors == null) {
|
||||
this.customEditors = new LinkedHashMap<Class<?>, PropertyEditor>(16);
|
||||
this.customEditors = new LinkedHashMap<>(16);
|
||||
}
|
||||
this.customEditors.put(requiredType, propertyEditor);
|
||||
this.customEditorCache = null;
|
||||
@@ -319,7 +319,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
||||
// Check property-specific editor first.
|
||||
PropertyEditor editor = getCustomEditor(propertyPath, requiredType);
|
||||
if (editor == null) {
|
||||
List<String> strippedPaths = new LinkedList<String>();
|
||||
List<String> strippedPaths = new LinkedList<>();
|
||||
addStrippedPropertyPaths(strippedPaths, "", propertyPath);
|
||||
for (Iterator<String> it = strippedPaths.iterator(); it.hasNext() && editor == null;) {
|
||||
String strippedPath = it.next();
|
||||
@@ -415,7 +415,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
||||
// Cache editor for search type, to avoid the overhead
|
||||
// of repeated assignable-from checks.
|
||||
if (this.customEditorCache == null) {
|
||||
this.customEditorCache = new HashMap<Class<?>, PropertyEditor>();
|
||||
this.customEditorCache = new HashMap<>();
|
||||
}
|
||||
this.customEditorCache.put(requiredType, editor);
|
||||
}
|
||||
@@ -435,7 +435,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
||||
if (this.customEditorsForPath != null) {
|
||||
CustomEditorHolder editorHolder = this.customEditorsForPath.get(propertyName);
|
||||
if (editorHolder == null) {
|
||||
List<String> strippedPaths = new LinkedList<String>();
|
||||
List<String> strippedPaths = new LinkedList<>();
|
||||
addStrippedPropertyPaths(strippedPaths, "", propertyName);
|
||||
for (Iterator<String> it = strippedPaths.iterator(); it.hasNext() && editorHolder == null;) {
|
||||
String strippedName = it.next();
|
||||
|
||||
@@ -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.
|
||||
@@ -200,7 +200,7 @@ public abstract class PropertyMatches {
|
||||
* @param maxDistance the maximum distance to accept
|
||||
*/
|
||||
private static String[] calculateMatches(String propertyName, PropertyDescriptor[] propertyDescriptors, int maxDistance) {
|
||||
List<String> candidates = new ArrayList<String>();
|
||||
List<String> candidates = new ArrayList<>();
|
||||
for (PropertyDescriptor pd : propertyDescriptors) {
|
||||
if (pd.getWriteMethod() != null) {
|
||||
String possibleAlternative = pd.getName();
|
||||
@@ -241,7 +241,7 @@ public abstract class PropertyMatches {
|
||||
}
|
||||
|
||||
private static String[] calculateMatches(final String propertyName, Class<?> beanClass, final int maxDistance) {
|
||||
final List<String> candidates = new ArrayList<String>();
|
||||
final List<String> candidates = new ArrayList<>();
|
||||
ReflectionUtils.doWithFields(beanClass, new ReflectionUtils.FieldCallback() {
|
||||
@Override
|
||||
public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
|
||||
|
||||
@@ -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 abstract class AnnotationBeanUtils {
|
||||
* @see org.springframework.beans.BeanWrapper
|
||||
*/
|
||||
public static void copyPropertiesToBean(Annotation ann, Object bean, StringValueResolver valueResolver, String... excludedProperties) {
|
||||
Set<String> excluded = new HashSet<String>(Arrays.asList(excludedProperties));
|
||||
Set<String> excluded = new HashSet<>(Arrays.asList(excludedProperties));
|
||||
Method[] annotationProperties = ann.annotationType().getDeclaredMethods();
|
||||
BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(bean);
|
||||
for (Method annotationProperty : annotationProperties) {
|
||||
|
||||
@@ -129,7 +129,7 @@ public class BeanCreationException extends FatalBeanException {
|
||||
*/
|
||||
public void addRelatedCause(Throwable ex) {
|
||||
if (this.relatedCauses == null) {
|
||||
this.relatedCauses = new LinkedList<Throwable>();
|
||||
this.relatedCauses = new LinkedList<>();
|
||||
}
|
||||
this.relatedCauses.add(ex);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -147,7 +147,7 @@ public abstract class BeanFactoryUtils {
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
String[] parentResult = beanNamesForTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type);
|
||||
List<String> resultList = new ArrayList<String>();
|
||||
List<String> resultList = new ArrayList<>();
|
||||
resultList.addAll(Arrays.asList(result));
|
||||
for (String beanName : parentResult) {
|
||||
if (!resultList.contains(beanName) && !hbf.containsLocalBean(beanName)) {
|
||||
@@ -180,7 +180,7 @@ public abstract class BeanFactoryUtils {
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
String[] parentResult = beanNamesForTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type);
|
||||
List<String> resultList = new ArrayList<String>();
|
||||
List<String> resultList = new ArrayList<>();
|
||||
resultList.addAll(Arrays.asList(result));
|
||||
for (String beanName : parentResult) {
|
||||
if (!resultList.contains(beanName) && !hbf.containsLocalBean(beanName)) {
|
||||
@@ -223,7 +223,7 @@ public abstract class BeanFactoryUtils {
|
||||
if (hbf.getParentBeanFactory() instanceof ListableBeanFactory) {
|
||||
String[] parentResult = beanNamesForTypeIncludingAncestors(
|
||||
(ListableBeanFactory) hbf.getParentBeanFactory(), type, includeNonSingletons, allowEagerInit);
|
||||
List<String> resultList = new ArrayList<String>();
|
||||
List<String> resultList = new ArrayList<>();
|
||||
resultList.addAll(Arrays.asList(result));
|
||||
for (String beanName : parentResult) {
|
||||
if (!resultList.contains(beanName) && !hbf.containsLocalBean(beanName)) {
|
||||
@@ -257,7 +257,7 @@ public abstract class BeanFactoryUtils {
|
||||
throws BeansException {
|
||||
|
||||
Assert.notNull(lbf, "ListableBeanFactory must not be null");
|
||||
Map<String, T> result = new LinkedHashMap<String, T>(4);
|
||||
Map<String, T> result = new LinkedHashMap<>(4);
|
||||
result.putAll(lbf.getBeansOfType(type));
|
||||
if (lbf instanceof HierarchicalBeanFactory) {
|
||||
HierarchicalBeanFactory hbf = (HierarchicalBeanFactory) lbf;
|
||||
@@ -306,7 +306,7 @@ public abstract class BeanFactoryUtils {
|
||||
throws BeansException {
|
||||
|
||||
Assert.notNull(lbf, "ListableBeanFactory must not be null");
|
||||
Map<String, T> result = new LinkedHashMap<String, T>(4);
|
||||
Map<String, T> result = new LinkedHashMap<>(4);
|
||||
result.putAll(lbf.getBeansOfType(type, includeNonSingletons, allowEagerInit));
|
||||
if (lbf instanceof HierarchicalBeanFactory) {
|
||||
HierarchicalBeanFactory hbf = (HierarchicalBeanFactory) lbf;
|
||||
|
||||
@@ -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.
|
||||
@@ -275,7 +275,7 @@ public class SingletonBeanFactoryLocator implements BeanFactoryLocator {
|
||||
protected static final Log logger = LogFactory.getLog(SingletonBeanFactoryLocator.class);
|
||||
|
||||
/** The keyed BeanFactory instances */
|
||||
private static final Map<String, BeanFactoryLocator> instances = new HashMap<String, BeanFactoryLocator>();
|
||||
private static final Map<String, BeanFactoryLocator> instances = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -333,9 +333,9 @@ public class SingletonBeanFactoryLocator implements BeanFactoryLocator {
|
||||
|
||||
|
||||
// We map BeanFactoryGroup objects by String keys, and by the definition object.
|
||||
private final Map<String, BeanFactoryGroup> bfgInstancesByKey = new HashMap<String, BeanFactoryGroup>();
|
||||
private final Map<String, BeanFactoryGroup> bfgInstancesByKey = new HashMap<>();
|
||||
|
||||
private final Map<BeanFactory, BeanFactoryGroup> bfgInstancesByObj = new HashMap<BeanFactory, BeanFactoryGroup>();
|
||||
private final Map<BeanFactory, BeanFactoryGroup> bfgInstancesByObj = new HashMap<>();
|
||||
|
||||
private final String resourceLocation;
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final Set<Class<? extends Annotation>> autowiredAnnotationTypes =
|
||||
new LinkedHashSet<Class<? extends Annotation>>();
|
||||
new LinkedHashSet<>();
|
||||
|
||||
private String requiredParameterName = "required";
|
||||
|
||||
@@ -134,10 +134,10 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>(256));
|
||||
|
||||
private final Map<Class<?>, Constructor<?>[]> candidateConstructorsCache =
|
||||
new ConcurrentHashMap<Class<?>, Constructor<?>[]>(256);
|
||||
new ConcurrentHashMap<>(256);
|
||||
|
||||
private final Map<String, InjectionMetadata> injectionMetadataCache =
|
||||
new ConcurrentHashMap<String, InjectionMetadata>(256);
|
||||
new ConcurrentHashMap<>(256);
|
||||
|
||||
|
||||
/**
|
||||
@@ -267,7 +267,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
candidateConstructors = this.candidateConstructorsCache.get(beanClass);
|
||||
if (candidateConstructors == null) {
|
||||
Constructor<?>[] rawCandidates = beanClass.getDeclaredConstructors();
|
||||
List<Constructor<?>> candidates = new ArrayList<Constructor<?>>(rawCandidates.length);
|
||||
List<Constructor<?>> candidates = new ArrayList<>(rawCandidates.length);
|
||||
Constructor<?> requiredConstructor = null;
|
||||
Constructor<?> defaultConstructor = null;
|
||||
for (Constructor<?> candidate : rawCandidates) {
|
||||
@@ -405,12 +405,12 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
}
|
||||
|
||||
private InjectionMetadata buildAutowiringMetadata(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
|
||||
@@ -560,7 +560,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
else {
|
||||
DependencyDescriptor desc = new DependencyDescriptor(field, this.required);
|
||||
desc.setContainingClass(bean.getClass());
|
||||
Set<String> autowiredBeanNames = new LinkedHashSet<String>(1);
|
||||
Set<String> autowiredBeanNames = new LinkedHashSet<>(1);
|
||||
TypeConverter typeConverter = beanFactory.getTypeConverter();
|
||||
try {
|
||||
value = beanFactory.resolveDependency(desc, beanName, autowiredBeanNames, typeConverter);
|
||||
@@ -628,7 +628,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
Class<?>[] paramTypes = method.getParameterTypes();
|
||||
arguments = new Object[paramTypes.length];
|
||||
DependencyDescriptor[] descriptors = new DependencyDescriptor[paramTypes.length];
|
||||
Set<String> autowiredBeanNames = new LinkedHashSet<String>(paramTypes.length);
|
||||
Set<String> autowiredBeanNames = new LinkedHashSet<>(paramTypes.length);
|
||||
TypeConverter typeConverter = beanFactory.getTypeConverter();
|
||||
for (int i = 0; i < arguments.length; i++) {
|
||||
MethodParameter methodParam = new MethodParameter(method, i);
|
||||
|
||||
@@ -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.
|
||||
@@ -83,7 +83,7 @@ public class InitDestroyAnnotationBeanPostProcessor
|
||||
private int order = Ordered.LOWEST_PRECEDENCE;
|
||||
|
||||
private transient final Map<Class<?>, LifecycleMetadata> lifecycleMetadataCache =
|
||||
new ConcurrentHashMap<Class<?>, LifecycleMetadata>(256);
|
||||
new ConcurrentHashMap<>(256);
|
||||
|
||||
|
||||
/**
|
||||
@@ -194,13 +194,13 @@ public class InitDestroyAnnotationBeanPostProcessor
|
||||
|
||||
private LifecycleMetadata buildLifecycleMetadata(final Class<?> clazz) {
|
||||
final boolean debug = logger.isDebugEnabled();
|
||||
LinkedList<LifecycleElement> initMethods = new LinkedList<LifecycleElement>();
|
||||
LinkedList<LifecycleElement> destroyMethods = new LinkedList<LifecycleElement>();
|
||||
LinkedList<LifecycleElement> initMethods = new LinkedList<>();
|
||||
LinkedList<LifecycleElement> destroyMethods = new LinkedList<>();
|
||||
Class<?> targetClass = clazz;
|
||||
|
||||
do {
|
||||
final LinkedList<LifecycleElement> currInitMethods = new LinkedList<LifecycleElement>();
|
||||
final LinkedList<LifecycleElement> currDestroyMethods = new LinkedList<LifecycleElement>();
|
||||
final LinkedList<LifecycleElement> currInitMethods = new LinkedList<>();
|
||||
final LinkedList<LifecycleElement> currDestroyMethods = new LinkedList<>();
|
||||
|
||||
ReflectionUtils.doWithLocalMethods(targetClass, new ReflectionUtils.MethodCallback() {
|
||||
@Override
|
||||
@@ -272,7 +272,7 @@ public class InitDestroyAnnotationBeanPostProcessor
|
||||
}
|
||||
|
||||
public void checkConfigMembers(RootBeanDefinition beanDefinition) {
|
||||
Set<LifecycleElement> checkedInitMethods = new LinkedHashSet<LifecycleElement>(this.initMethods.size());
|
||||
Set<LifecycleElement> checkedInitMethods = new LinkedHashSet<>(this.initMethods.size());
|
||||
for (LifecycleElement element : this.initMethods) {
|
||||
String methodIdentifier = element.getIdentifier();
|
||||
if (!beanDefinition.isExternallyManagedInitMethod(methodIdentifier)) {
|
||||
@@ -283,7 +283,7 @@ public class InitDestroyAnnotationBeanPostProcessor
|
||||
}
|
||||
}
|
||||
}
|
||||
Set<LifecycleElement> checkedDestroyMethods = new LinkedHashSet<LifecycleElement>(this.destroyMethods.size());
|
||||
Set<LifecycleElement> checkedDestroyMethods = new LinkedHashSet<>(this.destroyMethods.size());
|
||||
for (LifecycleElement element : this.destroyMethods) {
|
||||
String methodIdentifier = element.getIdentifier();
|
||||
if (!beanDefinition.isExternallyManagedDestroyMethod(methodIdentifier)) {
|
||||
|
||||
@@ -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.
|
||||
@@ -62,7 +62,7 @@ public class InjectionMetadata {
|
||||
|
||||
|
||||
public void checkConfigMembers(RootBeanDefinition beanDefinition) {
|
||||
Set<InjectedElement> checkedElements = new LinkedHashSet<InjectedElement>(this.injectedElements.size());
|
||||
Set<InjectedElement> checkedElements = new LinkedHashSet<>(this.injectedElements.size());
|
||||
for (InjectedElement element : this.injectedElements) {
|
||||
Member member = element.getMember();
|
||||
if (!beanDefinition.isExternallyManagedConfigMember(member)) {
|
||||
|
||||
@@ -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.
|
||||
@@ -56,7 +56,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class QualifierAnnotationAutowireCandidateResolver extends GenericTypeAwareAutowireCandidateResolver {
|
||||
|
||||
private final Set<Class<? extends Annotation>> qualifierTypes = new LinkedHashSet<Class<? extends Annotation>>(2);
|
||||
private final Set<Class<? extends Annotation>> qualifierTypes = new LinkedHashSet<>(2);
|
||||
|
||||
private Class<? extends Annotation> valueAnnotationType = Value.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.
|
||||
@@ -146,7 +146,7 @@ public class RequiredAnnotationBeanPostProcessor extends InstantiationAwareBeanP
|
||||
|
||||
if (!this.validatedBeanNames.contains(beanName)) {
|
||||
if (!shouldSkip(this.beanFactory, beanName)) {
|
||||
List<String> invalidProperties = new ArrayList<String>();
|
||||
List<String> invalidProperties = new ArrayList<>();
|
||||
for (PropertyDescriptor pd : pds) {
|
||||
if (isRequiredProperty(pd) && !pvs.contains(pd.getName())) {
|
||||
invalidProperties.add(pd.getName());
|
||||
|
||||
@@ -42,9 +42,9 @@ import org.springframework.util.ObjectUtils;
|
||||
*/
|
||||
public class ConstructorArgumentValues {
|
||||
|
||||
private final Map<Integer, ValueHolder> indexedArgumentValues = new LinkedHashMap<Integer, ValueHolder>(0);
|
||||
private final Map<Integer, ValueHolder> indexedArgumentValues = new LinkedHashMap<>(0);
|
||||
|
||||
private final List<ValueHolder> genericArgumentValues = new LinkedList<ValueHolder>();
|
||||
private final List<ValueHolder> genericArgumentValues = new LinkedList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -70,7 +70,7 @@ public class CustomScopeConfigurer implements BeanFactoryPostProcessor, BeanClas
|
||||
*/
|
||||
public void addScope(String scopeName, Scope scope) {
|
||||
if (this.scopes == null) {
|
||||
this.scopes = new LinkedHashMap<String, Object>(1);
|
||||
this.scopes = new LinkedHashMap<>(1);
|
||||
}
|
||||
this.scopes.put(scopeName, scope);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -82,7 +82,7 @@ public class ListFactoryBean extends AbstractFactoryBean<List<Object>> {
|
||||
result = BeanUtils.instantiateClass(this.targetListClass);
|
||||
}
|
||||
else {
|
||||
result = new ArrayList<Object>(this.sourceList.size());
|
||||
result = new ArrayList<>(this.sourceList.size());
|
||||
}
|
||||
Class<?> valueType = null;
|
||||
if (this.targetListClass != null) {
|
||||
|
||||
@@ -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.
|
||||
@@ -82,7 +82,7 @@ public class MapFactoryBean extends AbstractFactoryBean<Map<Object, Object>> {
|
||||
result = BeanUtils.instantiateClass(this.targetMapClass);
|
||||
}
|
||||
else {
|
||||
result = new LinkedHashMap<Object, Object>(this.sourceMap.size());
|
||||
result = new LinkedHashMap<>(this.sourceMap.size());
|
||||
}
|
||||
Class<?> keyType = null;
|
||||
Class<?> valueType = null;
|
||||
|
||||
@@ -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.
|
||||
@@ -82,7 +82,7 @@ public class SetFactoryBean extends AbstractFactoryBean<Set<Object>> {
|
||||
result = BeanUtils.instantiateClass(this.targetSetClass);
|
||||
}
|
||||
else {
|
||||
result = new LinkedHashSet<Object>(this.sourceSet.size());
|
||||
result = new LinkedHashSet<>(this.sourceSet.size());
|
||||
}
|
||||
Class<?> valueType = null;
|
||||
if (this.targetSetClass != 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.
|
||||
@@ -112,7 +112,7 @@ public class YamlMapFactoryBean extends YamlProcessor implements FactoryBean<Map
|
||||
* @see #process(java.util.Map, MatchCallback)
|
||||
*/
|
||||
protected Map<String, Object> createMap() {
|
||||
final Map<String, Object> result = new LinkedHashMap<String, Object>();
|
||||
final Map<String, Object> result = new LinkedHashMap<>();
|
||||
process(new MatchCallback() {
|
||||
@Override
|
||||
public void process(Properties properties, Map<String, Object> map) {
|
||||
@@ -129,7 +129,7 @@ public class YamlMapFactoryBean extends YamlProcessor implements FactoryBean<Map
|
||||
Object value = entry.getValue();
|
||||
Object existing = output.get(key);
|
||||
if (value instanceof Map && existing instanceof Map) {
|
||||
Map<String, Object> result = new LinkedHashMap<String, Object>((Map) existing);
|
||||
Map<String, Object> result = new LinkedHashMap<>((Map) existing);
|
||||
merge(result, (Map) value);
|
||||
output.put(key, result);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -191,7 +191,7 @@ public abstract class YamlProcessor {
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<String, Object> asMap(Object object) {
|
||||
// YAML can have numbers as keys
|
||||
Map<String, Object> result = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
if (!(object instanceof Map)) {
|
||||
// A document can be a text literal
|
||||
result.put("document", object);
|
||||
@@ -265,7 +265,7 @@ public abstract class YamlProcessor {
|
||||
* @since 4.1.3
|
||||
*/
|
||||
protected final Map<String, Object> getFlattenedMap(Map<String, Object> source) {
|
||||
Map<String, Object> result = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
buildFlattenedMap(result, source, null);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -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,8 +73,8 @@ public class BeanComponentDefinition extends BeanDefinitionHolder implements Com
|
||||
|
||||
|
||||
private void findInnerBeanDefinitionsAndBeanReferences(BeanDefinition beanDefinition) {
|
||||
List<BeanDefinition> innerBeans = new ArrayList<BeanDefinition>();
|
||||
List<BeanReference> references = new ArrayList<BeanReference>();
|
||||
List<BeanDefinition> innerBeans = new ArrayList<>();
|
||||
List<BeanReference> references = new ArrayList<>();
|
||||
PropertyValues propertyValues = beanDefinition.getPropertyValues();
|
||||
for (int i = 0; i < propertyValues.getPropertyValues().length; i++) {
|
||||
PropertyValue propertyValue = propertyValues.getPropertyValues()[i];
|
||||
|
||||
@@ -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.
|
||||
@@ -36,7 +36,7 @@ public class CompositeComponentDefinition extends AbstractComponentDefinition {
|
||||
|
||||
private final Object source;
|
||||
|
||||
private final List<ComponentDefinition> nestedComponents = new LinkedList<ComponentDefinition>();
|
||||
private final List<ComponentDefinition> nestedComponents = new LinkedList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -47,7 +47,7 @@ public final class ParseState {
|
||||
* Create a new {@code ParseState} with an empty {@link Stack}.
|
||||
*/
|
||||
public ParseState() {
|
||||
this.state = new Stack<Entry>();
|
||||
this.state = new Stack<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -35,7 +35,7 @@ public class ServiceListFactoryBean extends AbstractServiceLoaderBasedFactoryBea
|
||||
|
||||
@Override
|
||||
protected Object getObjectToExpose(ServiceLoader<?> serviceLoader) {
|
||||
List<Object> result = new LinkedList<Object>();
|
||||
List<Object> result = new LinkedList<>();
|
||||
for (Object loaderObject : serviceLoader) {
|
||||
result.add(loaderObject);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -136,21 +136,21 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
* Dependency types to ignore on dependency check and autowire, as Set of
|
||||
* Class objects: for example, String. Default is none.
|
||||
*/
|
||||
private final Set<Class<?>> ignoredDependencyTypes = new HashSet<Class<?>>();
|
||||
private final Set<Class<?>> ignoredDependencyTypes = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Dependency interfaces to ignore on dependency check and autowire, as Set of
|
||||
* Class objects. By default, only the BeanFactory interface is ignored.
|
||||
*/
|
||||
private final Set<Class<?>> ignoredDependencyInterfaces = new HashSet<Class<?>>();
|
||||
private final Set<Class<?>> ignoredDependencyInterfaces = new HashSet<>();
|
||||
|
||||
/** Cache of unfinished FactoryBean instances: FactoryBean name --> BeanWrapper */
|
||||
private final Map<String, BeanWrapper> factoryBeanInstanceCache =
|
||||
new ConcurrentHashMap<String, BeanWrapper>(16);
|
||||
new ConcurrentHashMap<>(16);
|
||||
|
||||
/** Cache of filtered PropertyDescriptors: bean Class -> PropertyDescriptor array */
|
||||
private final ConcurrentMap<Class<?>, PropertyDescriptor[]> filteredPropertyDescriptorsCache =
|
||||
new ConcurrentHashMap<Class<?>, PropertyDescriptor[]>(256);
|
||||
new ConcurrentHashMap<>(256);
|
||||
|
||||
|
||||
/**
|
||||
@@ -562,7 +562,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
}
|
||||
else if (!this.allowRawInjectionDespiteWrapping && hasDependentBean(beanName)) {
|
||||
String[] dependentBeans = getDependentBeans(beanName);
|
||||
Set<String> actualDependentBeans = new LinkedHashSet<String>(dependentBeans.length);
|
||||
Set<String> actualDependentBeans = new LinkedHashSet<>(dependentBeans.length);
|
||||
for (String dependentBean : dependentBeans) {
|
||||
if (!removeSingletonIfCreatedForTypeCheckOnly(dependentBean)) {
|
||||
actualDependentBeans.add(dependentBean);
|
||||
@@ -697,7 +697,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
}
|
||||
ConstructorArgumentValues cav = mbd.getConstructorArgumentValues();
|
||||
Set<ConstructorArgumentValues.ValueHolder> usedValueHolders =
|
||||
new HashSet<ConstructorArgumentValues.ValueHolder>(paramTypes.length);
|
||||
new HashSet<>(paramTypes.length);
|
||||
Object[] args = new Object[paramTypes.length];
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
ConstructorArgumentValues.ValueHolder valueHolder = cav.getArgumentValue(
|
||||
@@ -1277,7 +1277,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
converter = bw;
|
||||
}
|
||||
|
||||
Set<String> autowiredBeanNames = new LinkedHashSet<String>(4);
|
||||
Set<String> autowiredBeanNames = new LinkedHashSet<>(4);
|
||||
String[] propertyNames = unsatisfiedNonSimpleProperties(mbd, bw);
|
||||
for (String propertyName : propertyNames) {
|
||||
try {
|
||||
@@ -1320,7 +1320,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
* @see org.springframework.beans.BeanUtils#isSimpleProperty
|
||||
*/
|
||||
protected String[] unsatisfiedNonSimpleProperties(AbstractBeanDefinition mbd, BeanWrapper bw) {
|
||||
Set<String> result = new TreeSet<String>();
|
||||
Set<String> result = new TreeSet<>();
|
||||
PropertyValues pvs = mbd.getPropertyValues();
|
||||
PropertyDescriptor[] pds = bw.getPropertyDescriptors();
|
||||
for (PropertyDescriptor pd : pds) {
|
||||
@@ -1365,7 +1365,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
*/
|
||||
protected PropertyDescriptor[] filterPropertyDescriptorsForDependencyCheck(BeanWrapper bw) {
|
||||
List<PropertyDescriptor> pds =
|
||||
new LinkedList<PropertyDescriptor>(Arrays.asList(bw.getPropertyDescriptors()));
|
||||
new LinkedList<>(Arrays.asList(bw.getPropertyDescriptors()));
|
||||
for (Iterator<PropertyDescriptor> it = pds.iterator(); it.hasNext();) {
|
||||
PropertyDescriptor pd = it.next();
|
||||
if (isExcludedFromDependencyCheck(pd)) {
|
||||
@@ -1469,7 +1469,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
BeanDefinitionValueResolver valueResolver = new BeanDefinitionValueResolver(this, beanName, mbd, converter);
|
||||
|
||||
// Create a deep copy, resolving any references for values.
|
||||
List<PropertyValue> deepCopy = new ArrayList<PropertyValue>(original.size());
|
||||
List<PropertyValue> deepCopy = new ArrayList<>(original.size());
|
||||
boolean resolveNecessary = false;
|
||||
for (PropertyValue pv : original) {
|
||||
if (pv.isConverted()) {
|
||||
|
||||
@@ -153,7 +153,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
private boolean primary = false;
|
||||
|
||||
private final Map<String, AutowireCandidateQualifier> qualifiers =
|
||||
new LinkedHashMap<String, AutowireCandidateQualifier>(0);
|
||||
new LinkedHashMap<>(0);
|
||||
|
||||
private boolean nonPublicAccessAllowed = true;
|
||||
|
||||
@@ -631,7 +631,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
* @return the Set of {@link AutowireCandidateQualifier} objects.
|
||||
*/
|
||||
public Set<AutowireCandidateQualifier> getQualifiers() {
|
||||
return new LinkedHashSet<AutowireCandidateQualifier>(this.qualifiers.values());
|
||||
return new LinkedHashSet<>(this.qualifiers.values());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -132,20 +132,20 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
|
||||
/** Custom PropertyEditorRegistrars to apply to the beans of this factory */
|
||||
private final Set<PropertyEditorRegistrar> propertyEditorRegistrars =
|
||||
new LinkedHashSet<PropertyEditorRegistrar>(4);
|
||||
new LinkedHashSet<>(4);
|
||||
|
||||
/** A custom TypeConverter to use, overriding the default PropertyEditor mechanism */
|
||||
private TypeConverter typeConverter;
|
||||
|
||||
/** Custom PropertyEditors to apply to the beans of this factory */
|
||||
private final Map<Class<?>, Class<? extends PropertyEditor>> customEditors =
|
||||
new HashMap<Class<?>, Class<? extends PropertyEditor>>(4);
|
||||
new HashMap<>(4);
|
||||
|
||||
/** String resolvers to apply e.g. to annotation attribute values */
|
||||
private final List<StringValueResolver> embeddedValueResolvers = new LinkedList<StringValueResolver>();
|
||||
private final List<StringValueResolver> embeddedValueResolvers = new LinkedList<>();
|
||||
|
||||
/** BeanPostProcessors to apply in createBean */
|
||||
private final List<BeanPostProcessor> beanPostProcessors = new ArrayList<BeanPostProcessor>();
|
||||
private final List<BeanPostProcessor> beanPostProcessors = new ArrayList<>();
|
||||
|
||||
/** Indicates whether any InstantiationAwareBeanPostProcessors have been registered */
|
||||
private boolean hasInstantiationAwareBeanPostProcessors;
|
||||
@@ -154,14 +154,14 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
private boolean hasDestructionAwareBeanPostProcessors;
|
||||
|
||||
/** Map from scope identifier String to corresponding Scope */
|
||||
private final Map<String, Scope> scopes = new LinkedHashMap<String, Scope>(8);
|
||||
private final Map<String, Scope> scopes = new LinkedHashMap<>(8);
|
||||
|
||||
/** Security context used when running with a SecurityManager */
|
||||
private SecurityContextProvider securityContextProvider;
|
||||
|
||||
/** Map from bean name to merged RootBeanDefinition */
|
||||
private final Map<String, RootBeanDefinition> mergedBeanDefinitions =
|
||||
new ConcurrentHashMap<String, RootBeanDefinition>(256);
|
||||
new ConcurrentHashMap<>(256);
|
||||
|
||||
/** Names of beans that have already been created at least once */
|
||||
private final Set<String> alreadyCreated =
|
||||
@@ -169,7 +169,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
|
||||
/** Names of beans that are currently in creation */
|
||||
private final ThreadLocal<Object> prototypesCurrentlyInCreation =
|
||||
new NamedThreadLocal<Object>("Prototype beans currently in creation");
|
||||
new NamedThreadLocal<>("Prototype beans currently in creation");
|
||||
|
||||
|
||||
/**
|
||||
@@ -627,7 +627,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
@Override
|
||||
public String[] getAliases(String name) {
|
||||
String beanName = transformedBeanName(name);
|
||||
List<String> aliases = new ArrayList<String>();
|
||||
List<String> aliases = new ArrayList<>();
|
||||
boolean factoryPrefix = name.startsWith(FACTORY_BEAN_PREFIX);
|
||||
String fullBeanName = beanName;
|
||||
if (factoryPrefix) {
|
||||
@@ -1009,7 +1009,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
this.prototypesCurrentlyInCreation.set(beanName);
|
||||
}
|
||||
else if (curVal instanceof String) {
|
||||
Set<String> beanNameSet = new HashSet<String>(2);
|
||||
Set<String> beanNameSet = new HashSet<>(2);
|
||||
beanNameSet.add((String) curVal);
|
||||
beanNameSet.add(beanName);
|
||||
this.prototypesCurrentlyInCreation.set(beanNameSet);
|
||||
|
||||
@@ -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.
|
||||
@@ -376,7 +376,7 @@ class BeanDefinitionValueResolver {
|
||||
* For each element in the managed list, resolve reference if necessary.
|
||||
*/
|
||||
private List<?> resolveManagedList(Object argName, List<?> ml) {
|
||||
List<Object> resolved = new ArrayList<Object>(ml.size());
|
||||
List<Object> resolved = new ArrayList<>(ml.size());
|
||||
for (int i = 0; i < ml.size(); i++) {
|
||||
resolved.add(
|
||||
resolveValueIfNecessary(new KeyedArgName(argName, i), ml.get(i)));
|
||||
@@ -388,7 +388,7 @@ class BeanDefinitionValueResolver {
|
||||
* For each element in the managed set, resolve reference if necessary.
|
||||
*/
|
||||
private Set<?> resolveManagedSet(Object argName, Set<?> ms) {
|
||||
Set<Object> resolved = new LinkedHashSet<Object>(ms.size());
|
||||
Set<Object> resolved = new LinkedHashSet<>(ms.size());
|
||||
int i = 0;
|
||||
for (Object m : ms) {
|
||||
resolved.add(resolveValueIfNecessary(new KeyedArgName(argName, i), m));
|
||||
@@ -401,7 +401,7 @@ class BeanDefinitionValueResolver {
|
||||
* For each element in the managed map, resolve reference if necessary.
|
||||
*/
|
||||
private Map<?, ?> resolveManagedMap(Object argName, Map<?, ?> mm) {
|
||||
Map<Object, Object> resolved = new LinkedHashMap<Object, Object>(mm.size());
|
||||
Map<Object, Object> resolved = new LinkedHashMap<>(mm.size());
|
||||
for (Map.Entry<?, ?> entry : mm.entrySet()) {
|
||||
Object resolvedKey = resolveValueIfNecessary(argName, entry.getKey());
|
||||
Object resolvedValue = resolveValueIfNecessary(
|
||||
|
||||
@@ -71,7 +71,7 @@ import org.springframework.util.StringUtils;
|
||||
class ConstructorResolver {
|
||||
|
||||
private static final NamedThreadLocal<InjectionPoint> currentInjectionPoint =
|
||||
new NamedThreadLocal<InjectionPoint>("Current injection point");
|
||||
new NamedThreadLocal<>("Current injection point");
|
||||
|
||||
private final AbstractAutowireCapableBeanFactory beanFactory;
|
||||
|
||||
@@ -196,7 +196,7 @@ class ConstructorResolver {
|
||||
}
|
||||
// Swallow and try next constructor.
|
||||
if (causes == null) {
|
||||
causes = new LinkedList<UnsatisfiedDependencyException>();
|
||||
causes = new LinkedList<>();
|
||||
}
|
||||
causes.add(ex);
|
||||
continue;
|
||||
@@ -222,7 +222,7 @@ class ConstructorResolver {
|
||||
}
|
||||
else if (constructorToUse != null && typeDiffWeight == minTypeDiffWeight) {
|
||||
if (ambiguousConstructors == null) {
|
||||
ambiguousConstructors = new LinkedHashSet<Constructor<?>>();
|
||||
ambiguousConstructors = new LinkedHashSet<>();
|
||||
ambiguousConstructors.add(constructorToUse);
|
||||
}
|
||||
ambiguousConstructors.add(candidate);
|
||||
@@ -422,7 +422,7 @@ class ConstructorResolver {
|
||||
factoryClass = ClassUtils.getUserClass(factoryClass);
|
||||
|
||||
Method[] rawCandidates = getCandidateMethods(factoryClass, mbd);
|
||||
List<Method> candidateSet = new ArrayList<Method>();
|
||||
List<Method> candidateSet = new ArrayList<>();
|
||||
for (Method candidate : rawCandidates) {
|
||||
if (Modifier.isStatic(candidate.getModifiers()) == isStatic && mbd.isFactoryMethod(candidate)) {
|
||||
candidateSet.add(candidate);
|
||||
@@ -474,7 +474,7 @@ class ConstructorResolver {
|
||||
}
|
||||
// Swallow and try next overloaded factory method.
|
||||
if (causes == null) {
|
||||
causes = new LinkedList<UnsatisfiedDependencyException>();
|
||||
causes = new LinkedList<>();
|
||||
}
|
||||
causes.add(ex);
|
||||
continue;
|
||||
@@ -509,7 +509,7 @@ class ConstructorResolver {
|
||||
paramTypes.length == factoryMethodToUse.getParameterTypes().length &&
|
||||
!Arrays.equals(paramTypes, factoryMethodToUse.getParameterTypes())) {
|
||||
if (ambiguousFactoryMethods == null) {
|
||||
ambiguousFactoryMethods = new LinkedHashSet<Method>();
|
||||
ambiguousFactoryMethods = new LinkedHashSet<>();
|
||||
ambiguousFactoryMethods.add(factoryMethodToUse);
|
||||
}
|
||||
ambiguousFactoryMethods.add(candidate);
|
||||
@@ -525,14 +525,14 @@ class ConstructorResolver {
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
List<String> argTypes = new ArrayList<String>(minNrOfArgs);
|
||||
List<String> argTypes = new ArrayList<>(minNrOfArgs);
|
||||
if (explicitArgs != null) {
|
||||
for (Object arg : explicitArgs) {
|
||||
argTypes.add(arg != null ? arg.getClass().getSimpleName() : "null");
|
||||
}
|
||||
}
|
||||
else {
|
||||
Set<ValueHolder> valueHolders = new LinkedHashSet<ValueHolder>(resolvedValues.getArgumentCount());
|
||||
Set<ValueHolder> valueHolders = new LinkedHashSet<>(resolvedValues.getArgumentCount());
|
||||
valueHolders.addAll(resolvedValues.getIndexedArgumentValues().values());
|
||||
valueHolders.addAll(resolvedValues.getGenericArgumentValues());
|
||||
for (ValueHolder value : valueHolders) {
|
||||
@@ -670,8 +670,8 @@ class ConstructorResolver {
|
||||
|
||||
ArgumentsHolder args = new ArgumentsHolder(paramTypes.length);
|
||||
Set<ConstructorArgumentValues.ValueHolder> usedValueHolders =
|
||||
new HashSet<ConstructorArgumentValues.ValueHolder>(paramTypes.length);
|
||||
Set<String> autowiredBeanNames = new LinkedHashSet<String>(4);
|
||||
new HashSet<>(paramTypes.length);
|
||||
Set<String> autowiredBeanNames = new LinkedHashSet<>(4);
|
||||
|
||||
for (int paramIndex = 0; paramIndex < paramTypes.length; paramIndex++) {
|
||||
Class<?> paramType = paramTypes[paramIndex];
|
||||
|
||||
@@ -128,7 +128,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
|
||||
/** Map from serialized id to factory instance */
|
||||
private static final Map<String, Reference<DefaultListableBeanFactory>> serializableFactories =
|
||||
new ConcurrentHashMap<String, Reference<DefaultListableBeanFactory>>(8);
|
||||
new ConcurrentHashMap<>(8);
|
||||
|
||||
/** Optional id for this factory, for serialization purposes */
|
||||
private String serializationId;
|
||||
@@ -146,22 +146,22 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
private AutowireCandidateResolver autowireCandidateResolver = new SimpleAutowireCandidateResolver();
|
||||
|
||||
/** Map from dependency type to corresponding autowired value */
|
||||
private final Map<Class<?>, Object> resolvableDependencies = new ConcurrentHashMap<Class<?>, Object>(16);
|
||||
private final Map<Class<?>, Object> resolvableDependencies = new ConcurrentHashMap<>(16);
|
||||
|
||||
/** Map of bean definition objects, keyed by bean name */
|
||||
private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<String, BeanDefinition>(256);
|
||||
private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>(256);
|
||||
|
||||
/** Map of singleton and non-singleton bean names, keyed by dependency type */
|
||||
private final Map<Class<?>, String[]> allBeanNamesByType = new ConcurrentHashMap<Class<?>, String[]>(64);
|
||||
private final Map<Class<?>, String[]> allBeanNamesByType = new ConcurrentHashMap<>(64);
|
||||
|
||||
/** Map of singleton-only bean names, keyed by dependency type */
|
||||
private final Map<Class<?>, String[]> singletonBeanNamesByType = new ConcurrentHashMap<Class<?>, String[]>(64);
|
||||
private final Map<Class<?>, String[]> singletonBeanNamesByType = new ConcurrentHashMap<>(64);
|
||||
|
||||
/** List of bean definition names, in registration order */
|
||||
private volatile List<String> beanDefinitionNames = new ArrayList<String>(256);
|
||||
private volatile List<String> beanDefinitionNames = new ArrayList<>(256);
|
||||
|
||||
/** List of names of manually registered singletons, in registration order */
|
||||
private volatile Set<String> manualSingletonNames = new LinkedHashSet<String>(16);
|
||||
private volatile Set<String> manualSingletonNames = new LinkedHashSet<>(16);
|
||||
|
||||
/** Cached array of bean definition names in case of frozen configuration */
|
||||
private volatile String[] frozenBeanDefinitionNames;
|
||||
@@ -192,7 +192,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
*/
|
||||
public void setSerializationId(String serializationId) {
|
||||
if (serializationId != null) {
|
||||
serializableFactories.put(serializationId, new WeakReference<DefaultListableBeanFactory>(this));
|
||||
serializableFactories.put(serializationId, new WeakReference<>(this));
|
||||
}
|
||||
else if (this.serializationId != null) {
|
||||
serializableFactories.remove(this.serializationId);
|
||||
@@ -328,7 +328,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
Assert.notNull(requiredType, "Required type must not be null");
|
||||
String[] beanNames = getBeanNamesForType(requiredType);
|
||||
if (beanNames.length > 1) {
|
||||
ArrayList<String> autowireCandidates = new ArrayList<String>();
|
||||
ArrayList<String> autowireCandidates = new ArrayList<>();
|
||||
for (String beanName : beanNames) {
|
||||
if (!containsBeanDefinition(beanName) || getBeanDefinition(beanName).isAutowireCandidate()) {
|
||||
autowireCandidates.add(beanName);
|
||||
@@ -342,7 +342,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
return getBean(beanNames[0], requiredType, args);
|
||||
}
|
||||
else if (beanNames.length > 1) {
|
||||
Map<String, Object> candidates = new HashMap<String, Object>();
|
||||
Map<String, Object> candidates = new HashMap<>();
|
||||
for (String beanName : beanNames) {
|
||||
candidates.put(beanName, getBean(beanName, requiredType, args));
|
||||
}
|
||||
@@ -419,7 +419,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
}
|
||||
|
||||
private String[] doGetBeanNamesForType(ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
// Check all bean definitions.
|
||||
for (String beanName : this.beanDefinitionNames) {
|
||||
@@ -519,7 +519,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
throws BeansException {
|
||||
|
||||
String[] beanNames = getBeanNamesForType(type, includeNonSingletons, allowEagerInit);
|
||||
Map<String, T> result = new LinkedHashMap<String, T>(beanNames.length);
|
||||
Map<String, T> result = new LinkedHashMap<>(beanNames.length);
|
||||
for (String beanName : beanNames) {
|
||||
try {
|
||||
result.put(beanName, getBean(beanName, type));
|
||||
@@ -547,7 +547,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType) {
|
||||
List<String> results = new ArrayList<String>();
|
||||
List<String> results = new ArrayList<>();
|
||||
for (String beanName : this.beanDefinitionNames) {
|
||||
BeanDefinition beanDefinition = getBeanDefinition(beanName);
|
||||
if (!beanDefinition.isAbstract() && findAnnotationOnBean(beanName, annotationType) != null) {
|
||||
@@ -565,7 +565,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
@Override
|
||||
public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType) {
|
||||
String[] beanNames = getBeanNamesForAnnotation(annotationType);
|
||||
Map<String, Object> results = new LinkedHashMap<String, Object>(beanNames.length);
|
||||
Map<String, Object> results = new LinkedHashMap<>(beanNames.length);
|
||||
for (String beanName : beanNames) {
|
||||
results.put(beanName, getBean(beanName));
|
||||
}
|
||||
@@ -695,7 +695,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
|
||||
@Override
|
||||
public Iterator<String> getBeanNamesIterator() {
|
||||
CompositeIterator<String> iterator = new CompositeIterator<String>();
|
||||
CompositeIterator<String> iterator = new CompositeIterator<>();
|
||||
iterator.add(this.beanDefinitionNames.iterator());
|
||||
iterator.add(this.manualSingletonNames.iterator());
|
||||
return iterator;
|
||||
@@ -736,7 +736,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
|
||||
// Iterate over a copy to allow for init methods which in turn register new bean definitions.
|
||||
// While this may not be part of the regular factory bootstrap, it does otherwise work fine.
|
||||
List<String> beanNames = new ArrayList<String>(this.beanDefinitionNames);
|
||||
List<String> beanNames = new ArrayList<>(this.beanDefinitionNames);
|
||||
|
||||
// Trigger initialization of all non-lazy singleton beans...
|
||||
for (String beanName : beanNames) {
|
||||
@@ -848,12 +848,12 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
// Cannot modify startup-time collection elements anymore (for stable iteration)
|
||||
synchronized (this.beanDefinitionMap) {
|
||||
this.beanDefinitionMap.put(beanName, beanDefinition);
|
||||
List<String> updatedDefinitions = new ArrayList<String>(this.beanDefinitionNames.size() + 1);
|
||||
List<String> updatedDefinitions = new ArrayList<>(this.beanDefinitionNames.size() + 1);
|
||||
updatedDefinitions.addAll(this.beanDefinitionNames);
|
||||
updatedDefinitions.add(beanName);
|
||||
this.beanDefinitionNames = updatedDefinitions;
|
||||
if (this.manualSingletonNames.contains(beanName)) {
|
||||
Set<String> updatedSingletons = new LinkedHashSet<String>(this.manualSingletonNames);
|
||||
Set<String> updatedSingletons = new LinkedHashSet<>(this.manualSingletonNames);
|
||||
updatedSingletons.remove(beanName);
|
||||
this.manualSingletonNames = updatedSingletons;
|
||||
}
|
||||
@@ -888,7 +888,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
if (hasBeanCreationStarted()) {
|
||||
// Cannot modify startup-time collection elements anymore (for stable iteration)
|
||||
synchronized (this.beanDefinitionMap) {
|
||||
List<String> updatedDefinitions = new ArrayList<String>(this.beanDefinitionNames);
|
||||
List<String> updatedDefinitions = new ArrayList<>(this.beanDefinitionNames);
|
||||
updatedDefinitions.remove(beanName);
|
||||
this.beanDefinitionNames = updatedDefinitions;
|
||||
}
|
||||
@@ -943,7 +943,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
// Cannot modify startup-time collection elements anymore (for stable iteration)
|
||||
synchronized (this.beanDefinitionMap) {
|
||||
if (!this.beanDefinitionMap.containsKey(beanName)) {
|
||||
Set<String> updatedSingletons = new LinkedHashSet<String>(this.manualSingletonNames.size() + 1);
|
||||
Set<String> updatedSingletons = new LinkedHashSet<>(this.manualSingletonNames.size() + 1);
|
||||
updatedSingletons.addAll(this.manualSingletonNames);
|
||||
updatedSingletons.add(beanName);
|
||||
this.manualSingletonNames = updatedSingletons;
|
||||
@@ -1162,7 +1162,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
}
|
||||
|
||||
private FactoryAwareOrderSourceProvider createFactoryAwareOrderSourceProvider(Map<String, Object> beans) {
|
||||
IdentityHashMap<Object, String> instancesToBeanNames = new IdentityHashMap<Object, String>();
|
||||
IdentityHashMap<Object, String> instancesToBeanNames = new IdentityHashMap<>();
|
||||
for (Map.Entry<String, Object> entry : beans.entrySet()) {
|
||||
instancesToBeanNames.put(entry.getValue(), entry.getKey());
|
||||
}
|
||||
@@ -1187,7 +1187,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
|
||||
String[] candidateNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(
|
||||
this, requiredType, true, descriptor.isEager());
|
||||
Map<String, Object> result = new LinkedHashMap<String, Object>(candidateNames.length);
|
||||
Map<String, Object> result = new LinkedHashMap<>(candidateNames.length);
|
||||
for (Class<?> autowiringType : this.resolvableDependencies.keySet()) {
|
||||
if (autowiringType.isAssignableFrom(requiredType)) {
|
||||
Object autowiringValue = this.resolvableDependencies.get(autowiringType);
|
||||
@@ -1603,7 +1603,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||
if (beanDefinition == null) {
|
||||
return null;
|
||||
}
|
||||
List<Object> sources = new ArrayList<Object>();
|
||||
List<Object> sources = new ArrayList<>();
|
||||
Method factoryMethod = beanDefinition.getResolvedFactoryMethod();
|
||||
if (factoryMethod != null) {
|
||||
sources.add(factoryMethod);
|
||||
|
||||
@@ -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.
|
||||
@@ -83,16 +83,16 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
/** Cache of singleton objects: bean name --> bean instance */
|
||||
private final Map<String, Object> singletonObjects = new ConcurrentHashMap<String, Object>(256);
|
||||
private final Map<String, Object> singletonObjects = new ConcurrentHashMap<>(256);
|
||||
|
||||
/** Cache of singleton factories: bean name --> ObjectFactory */
|
||||
private final Map<String, ObjectFactory<?>> singletonFactories = new HashMap<String, ObjectFactory<?>>(16);
|
||||
private final Map<String, ObjectFactory<?>> singletonFactories = new HashMap<>(16);
|
||||
|
||||
/** Cache of early singleton objects: bean name --> bean instance */
|
||||
private final Map<String, Object> earlySingletonObjects = new HashMap<String, Object>(16);
|
||||
private final Map<String, Object> earlySingletonObjects = new HashMap<>(16);
|
||||
|
||||
/** Set of registered singletons, containing the bean names in registration order */
|
||||
private final Set<String> registeredSingletons = new LinkedHashSet<String>(256);
|
||||
private final Set<String> registeredSingletons = new LinkedHashSet<>(256);
|
||||
|
||||
/** Names of beans that are currently in creation */
|
||||
private final Set<String> singletonsCurrentlyInCreation =
|
||||
@@ -109,16 +109,16 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
||||
private boolean singletonsCurrentlyInDestruction = false;
|
||||
|
||||
/** Disposable bean instances: bean name --> disposable instance */
|
||||
private final Map<String, Object> disposableBeans = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> disposableBeans = new LinkedHashMap<>();
|
||||
|
||||
/** Map between containing bean names: bean name --> Set of bean names that the bean contains */
|
||||
private final Map<String, Set<String>> containedBeanMap = new ConcurrentHashMap<String, Set<String>>(16);
|
||||
private final Map<String, Set<String>> containedBeanMap = new ConcurrentHashMap<>(16);
|
||||
|
||||
/** Map between dependent bean names: bean name --> Set of dependent bean names */
|
||||
private final Map<String, Set<String>> dependentBeanMap = new ConcurrentHashMap<String, Set<String>>(64);
|
||||
private final Map<String, Set<String>> dependentBeanMap = new ConcurrentHashMap<>(64);
|
||||
|
||||
/** Map between depending bean names: bean name --> Set of bean names for the bean's dependencies */
|
||||
private final Map<String, Set<String>> dependenciesForBeanMap = new ConcurrentHashMap<String, Set<String>>(64);
|
||||
private final Map<String, Set<String>> dependenciesForBeanMap = new ConcurrentHashMap<>(64);
|
||||
|
||||
|
||||
@Override
|
||||
@@ -224,7 +224,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
||||
boolean newSingleton = false;
|
||||
boolean recordSuppressedExceptions = (this.suppressedExceptions == null);
|
||||
if (recordSuppressedExceptions) {
|
||||
this.suppressedExceptions = new LinkedHashSet<Exception>();
|
||||
this.suppressedExceptions = new LinkedHashSet<>();
|
||||
}
|
||||
try {
|
||||
singletonObject = singletonFactory.getObject();
|
||||
@@ -396,7 +396,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
||||
synchronized (this.containedBeanMap) {
|
||||
containedBeans = this.containedBeanMap.get(containingBeanName);
|
||||
if (containedBeans == null) {
|
||||
containedBeans = new LinkedHashSet<String>(8);
|
||||
containedBeans = new LinkedHashSet<>(8);
|
||||
this.containedBeanMap.put(containingBeanName, containedBeans);
|
||||
}
|
||||
containedBeans.add(containedBeanName);
|
||||
@@ -422,7 +422,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
||||
synchronized (this.dependentBeanMap) {
|
||||
dependentBeans = this.dependentBeanMap.get(canonicalName);
|
||||
if (dependentBeans == null) {
|
||||
dependentBeans = new LinkedHashSet<String>(8);
|
||||
dependentBeans = new LinkedHashSet<>(8);
|
||||
this.dependentBeanMap.put(canonicalName, dependentBeans);
|
||||
}
|
||||
dependentBeans.add(dependentBeanName);
|
||||
@@ -430,7 +430,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
||||
synchronized (this.dependenciesForBeanMap) {
|
||||
Set<String> dependenciesForBean = this.dependenciesForBeanMap.get(dependentBeanName);
|
||||
if (dependenciesForBean == null) {
|
||||
dependenciesForBean = new LinkedHashSet<String>(8);
|
||||
dependenciesForBean = new LinkedHashSet<>(8);
|
||||
this.dependenciesForBeanMap.put(dependentBeanName, dependenciesForBean);
|
||||
}
|
||||
dependenciesForBean.add(canonicalName);
|
||||
@@ -462,7 +462,7 @@ public class DefaultSingletonBeanRegistry extends SimpleAliasRegistry implements
|
||||
}
|
||||
for (String transitiveDependency : dependentBeans) {
|
||||
if (alreadySeen == null) {
|
||||
alreadySeen = new HashSet<String>();
|
||||
alreadySeen = new HashSet<>();
|
||||
}
|
||||
alreadySeen.add(beanName);
|
||||
if (isDependent(transitiveDependency, dependentBeanName, alreadySeen)) {
|
||||
|
||||
@@ -220,7 +220,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
|
||||
private List<DestructionAwareBeanPostProcessor> filterPostProcessors(List<BeanPostProcessor> processors, Object bean) {
|
||||
List<DestructionAwareBeanPostProcessor> filteredPostProcessors = null;
|
||||
if (!CollectionUtils.isEmpty(processors)) {
|
||||
filteredPostProcessors = new ArrayList<DestructionAwareBeanPostProcessor>(processors.size());
|
||||
filteredPostProcessors = new ArrayList<>(processors.size());
|
||||
for (BeanPostProcessor processor : processors) {
|
||||
if (processor instanceof DestructionAwareBeanPostProcessor) {
|
||||
DestructionAwareBeanPostProcessor dabpp = (DestructionAwareBeanPostProcessor) processor;
|
||||
@@ -388,7 +388,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
|
||||
protected Object writeReplace() {
|
||||
List<DestructionAwareBeanPostProcessor> serializablePostProcessors = null;
|
||||
if (this.beanPostProcessors != null) {
|
||||
serializablePostProcessors = new ArrayList<DestructionAwareBeanPostProcessor>();
|
||||
serializablePostProcessors = new ArrayList<>();
|
||||
for (DestructionAwareBeanPostProcessor postProcessor : this.beanPostProcessors) {
|
||||
if (postProcessor instanceof Serializable) {
|
||||
serializablePostProcessors.add(postProcessor);
|
||||
|
||||
@@ -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.
|
||||
@@ -43,7 +43,7 @@ import org.springframework.beans.factory.FactoryBeanNotInitializedException;
|
||||
public abstract class FactoryBeanRegistrySupport extends DefaultSingletonBeanRegistry {
|
||||
|
||||
/** Cache of singleton objects created by FactoryBeans: FactoryBean name --> object */
|
||||
private final Map<String, Object> factoryBeanObjectCache = new ConcurrentHashMap<String, Object>(16);
|
||||
private final Map<String, Object> factoryBeanObjectCache = new ConcurrentHashMap<>(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.
|
||||
@@ -101,7 +101,7 @@ public class ManagedList<E> extends ArrayList<E> implements Mergeable, BeanMetad
|
||||
if (!(parent instanceof List)) {
|
||||
throw new IllegalArgumentException("Cannot merge with object of type [" + parent.getClass() + "]");
|
||||
}
|
||||
List<E> merged = new ManagedList<E>();
|
||||
List<E> merged = new ManagedList<>();
|
||||
merged.addAll((List<E>) parent);
|
||||
merged.addAll(this);
|
||||
return merged;
|
||||
|
||||
@@ -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.
|
||||
@@ -116,7 +116,7 @@ public class ManagedMap<K, V> extends LinkedHashMap<K, V> implements Mergeable,
|
||||
if (!(parent instanceof Map)) {
|
||||
throw new IllegalArgumentException("Cannot merge with object of type [" + parent.getClass() + "]");
|
||||
}
|
||||
Map<K, V> merged = new ManagedMap<K, V>();
|
||||
Map<K, V> merged = new ManagedMap<>();
|
||||
merged.putAll((Map<K, V>) parent);
|
||||
merged.putAll(this);
|
||||
return merged;
|
||||
|
||||
@@ -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.
|
||||
@@ -100,7 +100,7 @@ public class ManagedSet<E> extends LinkedHashSet<E> implements Mergeable, BeanMe
|
||||
if (!(parent instanceof Set)) {
|
||||
throw new IllegalArgumentException("Cannot merge with object of type [" + parent.getClass() + "]");
|
||||
}
|
||||
Set<E> merged = new ManagedSet<E>();
|
||||
Set<E> merged = new ManagedSet<>();
|
||||
merged.addAll((Set<E>) parent);
|
||||
merged.addAll(this);
|
||||
return merged;
|
||||
|
||||
@@ -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.
|
||||
@@ -289,7 +289,7 @@ public class PropertiesBeanDefinitionReader extends AbstractBeanDefinitionReader
|
||||
*/
|
||||
public int registerBeanDefinitions(ResourceBundle rb, String prefix) throws BeanDefinitionStoreException {
|
||||
// Simply create a map and call overloaded method.
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Enumeration<String> keys = rb.getKeys();
|
||||
while (keys.hasMoreElements()) {
|
||||
String key = keys.nextElement();
|
||||
|
||||
@@ -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.
|
||||
@@ -38,7 +38,7 @@ public class ReplaceOverride extends MethodOverride {
|
||||
|
||||
private final String methodReplacerBeanName;
|
||||
|
||||
private List<String> typeIdentifiers = new LinkedList<String>();
|
||||
private List<String> typeIdentifiers = new LinkedList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -258,7 +258,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
||||
public void registerExternallyManagedConfigMember(Member configMember) {
|
||||
synchronized (this.postProcessingLock) {
|
||||
if (this.externallyManagedConfigMembers == null) {
|
||||
this.externallyManagedConfigMembers = new HashSet<Member>(1);
|
||||
this.externallyManagedConfigMembers = new HashSet<>(1);
|
||||
}
|
||||
this.externallyManagedConfigMembers.add(configMember);
|
||||
}
|
||||
@@ -274,7 +274,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
||||
public void registerExternallyManagedInitMethod(String initMethod) {
|
||||
synchronized (this.postProcessingLock) {
|
||||
if (this.externallyManagedInitMethods == null) {
|
||||
this.externallyManagedInitMethods = new HashSet<String>(1);
|
||||
this.externallyManagedInitMethods = new HashSet<>(1);
|
||||
}
|
||||
this.externallyManagedInitMethods.add(initMethod);
|
||||
}
|
||||
@@ -290,7 +290,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
||||
public void registerExternallyManagedDestroyMethod(String destroyMethod) {
|
||||
synchronized (this.postProcessingLock) {
|
||||
if (this.externallyManagedDestroyMethods == null) {
|
||||
this.externallyManagedDestroyMethods = new HashSet<String>(1);
|
||||
this.externallyManagedDestroyMethods = new HashSet<>(1);
|
||||
}
|
||||
this.externallyManagedDestroyMethods.add(destroyMethod);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -37,7 +37,7 @@ import org.springframework.util.StringUtils;
|
||||
public class SimpleBeanDefinitionRegistry extends SimpleAliasRegistry implements BeanDefinitionRegistry {
|
||||
|
||||
/** Map of bean definition objects, keyed by bean name */
|
||||
private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<String, BeanDefinition>(64);
|
||||
private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<>(64);
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class SimpleInstantiationStrategy implements InstantiationStrategy {
|
||||
|
||||
private static final ThreadLocal<Method> currentlyInvokedFactoryMethod = new ThreadLocal<Method>();
|
||||
private static final ThreadLocal<Method> currentlyInvokedFactoryMethod = new ThreadLocal<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,7 +67,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
* with singleton bean instances through {@link #addBean} calls.
|
||||
*/
|
||||
public StaticListableBeanFactory() {
|
||||
this.beans = new LinkedHashMap<String, Object>();
|
||||
this.beans = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,7 +249,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
@Override
|
||||
public String[] getBeanNamesForType(ResolvableType type) {
|
||||
boolean isFactoryType = (type != null && FactoryBean.class.isAssignableFrom(type.getRawClass()));
|
||||
List<String> matches = new ArrayList<String>();
|
||||
List<String> matches = new ArrayList<>();
|
||||
for (Map.Entry<String, Object> entry : this.beans.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
Object beanInstance = entry.getValue();
|
||||
@@ -289,7 +289,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
throws BeansException {
|
||||
|
||||
boolean isFactoryType = (type != null && FactoryBean.class.isAssignableFrom(type));
|
||||
Map<String, T> matches = new LinkedHashMap<String, T>();
|
||||
Map<String, T> matches = new LinkedHashMap<>();
|
||||
|
||||
for (Map.Entry<String, Object> entry : this.beans.entrySet()) {
|
||||
String beanName = entry.getKey();
|
||||
@@ -320,7 +320,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
|
||||
@Override
|
||||
public String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType) {
|
||||
List<String> results = new ArrayList<String>();
|
||||
List<String> results = new ArrayList<>();
|
||||
for (String beanName : this.beans.keySet()) {
|
||||
if (findAnnotationOnBean(beanName, annotationType) != null) {
|
||||
results.add(beanName);
|
||||
@@ -333,7 +333,7 @@ public class StaticListableBeanFactory implements ListableBeanFactory {
|
||||
public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType)
|
||||
throws BeansException {
|
||||
|
||||
Map<String, Object> results = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> results = new LinkedHashMap<>();
|
||||
for (String beanName : this.beans.keySet()) {
|
||||
if (findAnnotationOnBean(beanName, annotationType) != null) {
|
||||
results.put(beanName, getBean(beanName));
|
||||
|
||||
@@ -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.
|
||||
@@ -250,7 +250,7 @@ public class BeanDefinitionParserDelegate {
|
||||
* beans-element basis. Duplicate bean ids/names may not exist within the
|
||||
* same level of beans element nesting, but may be duplicated across levels.
|
||||
*/
|
||||
private final Set<String> usedNames = new HashSet<String>();
|
||||
private final Set<String> usedNames = new HashSet<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -429,7 +429,7 @@ public class BeanDefinitionParserDelegate {
|
||||
String id = ele.getAttribute(ID_ATTRIBUTE);
|
||||
String nameAttr = ele.getAttribute(NAME_ATTRIBUTE);
|
||||
|
||||
List<String> aliases = new ArrayList<String>();
|
||||
List<String> aliases = new ArrayList<>();
|
||||
if (StringUtils.hasLength(nameAttr)) {
|
||||
String[] nameArr = StringUtils.tokenizeToStringArray(nameAttr, MULTI_VALUE_ATTRIBUTE_DELIMITERS);
|
||||
aliases.addAll(Arrays.asList(nameArr));
|
||||
@@ -1162,7 +1162,7 @@ public class BeanDefinitionParserDelegate {
|
||||
public List<Object> parseListElement(Element collectionEle, BeanDefinition bd) {
|
||||
String defaultElementType = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
|
||||
NodeList nl = collectionEle.getChildNodes();
|
||||
ManagedList<Object> target = new ManagedList<Object>(nl.getLength());
|
||||
ManagedList<Object> target = new ManagedList<>(nl.getLength());
|
||||
target.setSource(extractSource(collectionEle));
|
||||
target.setElementTypeName(defaultElementType);
|
||||
target.setMergeEnabled(parseMergeAttribute(collectionEle));
|
||||
@@ -1176,7 +1176,7 @@ public class BeanDefinitionParserDelegate {
|
||||
public Set<Object> parseSetElement(Element collectionEle, BeanDefinition bd) {
|
||||
String defaultElementType = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
|
||||
NodeList nl = collectionEle.getChildNodes();
|
||||
ManagedSet<Object> target = new ManagedSet<Object>(nl.getLength());
|
||||
ManagedSet<Object> target = new ManagedSet<>(nl.getLength());
|
||||
target.setSource(extractSource(collectionEle));
|
||||
target.setElementTypeName(defaultElementType);
|
||||
target.setMergeEnabled(parseMergeAttribute(collectionEle));
|
||||
@@ -1203,7 +1203,7 @@ public class BeanDefinitionParserDelegate {
|
||||
String defaultValueType = mapEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
|
||||
|
||||
List<Element> entryEles = DomUtils.getChildElementsByTagName(mapEle, ENTRY_ELEMENT);
|
||||
ManagedMap<Object, Object> map = new ManagedMap<Object, Object>(entryEles.size());
|
||||
ManagedMap<Object, Object> map = new ManagedMap<>(entryEles.size());
|
||||
map.setSource(extractSource(mapEle));
|
||||
map.setKeyTypeName(defaultKeyType);
|
||||
map.setValueTypeName(defaultValueType);
|
||||
|
||||
@@ -209,7 +209,7 @@ public class DefaultBeanDefinitionDocumentReader implements BeanDefinitionDocume
|
||||
// Resolve system properties: e.g. "${user.dir}"
|
||||
location = getReaderContext().getEnvironment().resolveRequiredPlaceholders(location);
|
||||
|
||||
Set<Resource> actualResources = new LinkedHashSet<Resource>(4);
|
||||
Set<Resource> actualResources = new LinkedHashSet<>(4);
|
||||
|
||||
// Discover whether the location is an absolute or relative URI
|
||||
boolean absoluteLocation = false;
|
||||
|
||||
@@ -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.
|
||||
@@ -156,7 +156,7 @@ public class DefaultNamespaceHandlerResolver implements NamespaceHandlerResolver
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Loaded NamespaceHandler mappings: " + mappings);
|
||||
}
|
||||
Map<String, Object> handlerMappings = new ConcurrentHashMap<String, Object>(mappings.size());
|
||||
Map<String, Object> handlerMappings = new ConcurrentHashMap<>(mappings.size());
|
||||
CollectionUtils.mergePropertiesIntoMap(mappings, handlerMappings);
|
||||
this.handlerMappings = handlerMappings;
|
||||
}
|
||||
|
||||
@@ -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,21 +48,21 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler {
|
||||
* local name of the {@link Element Elements} they handle.
|
||||
*/
|
||||
private final Map<String, BeanDefinitionParser> parsers =
|
||||
new HashMap<String, BeanDefinitionParser>();
|
||||
new HashMap<>();
|
||||
|
||||
/**
|
||||
* Stores the {@link BeanDefinitionDecorator} implementations keyed by the
|
||||
* local name of the {@link Element Elements} they handle.
|
||||
*/
|
||||
private final Map<String, BeanDefinitionDecorator> decorators =
|
||||
new HashMap<String, BeanDefinitionDecorator>();
|
||||
new HashMap<>();
|
||||
|
||||
/**
|
||||
* Stores the {@link BeanDefinitionDecorator} implementations keyed by the local
|
||||
* name of the {@link Attr Attrs} they handle.
|
||||
*/
|
||||
private final Map<String, BeanDefinitionDecorator> attributeDecorators =
|
||||
new HashMap<String, BeanDefinitionDecorator>();
|
||||
new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2009 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 final class ParserContext {
|
||||
|
||||
private BeanDefinition containingBeanDefinition;
|
||||
|
||||
private final Stack<ComponentDefinition> containingComponents = new Stack<ComponentDefinition>();
|
||||
private final Stack<ComponentDefinition> containingComponents = new Stack<>();
|
||||
|
||||
|
||||
public ParserContext(XmlReaderContext readerContext, BeanDefinitionParserDelegate delegate) {
|
||||
|
||||
@@ -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.
|
||||
@@ -146,7 +146,7 @@ public class PluggableSchemaResolver implements EntityResolver {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Loaded schema mappings: " + mappings);
|
||||
}
|
||||
Map<String, String> schemaMappings = new ConcurrentHashMap<String, String>(mappings.size());
|
||||
Map<String, String> schemaMappings = new ConcurrentHashMap<>(mappings.size());
|
||||
CollectionUtils.mergePropertiesIntoMap(mappings, schemaMappings);
|
||||
this.schemaMappings = schemaMappings;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -123,7 +123,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
|
||||
private final XmlValidationModeDetector validationModeDetector = new XmlValidationModeDetector();
|
||||
|
||||
private final ThreadLocal<Set<EncodedResource>> resourcesCurrentlyBeingLoaded =
|
||||
new NamedThreadLocal<Set<EncodedResource>>("XML bean definition resources currently being loaded");
|
||||
new NamedThreadLocal<>("XML bean definition resources currently being loaded");
|
||||
|
||||
|
||||
/**
|
||||
@@ -319,7 +319,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader {
|
||||
|
||||
Set<EncodedResource> currentResources = this.resourcesCurrentlyBeingLoaded.get();
|
||||
if (currentResources == null) {
|
||||
currentResources = new HashSet<EncodedResource>(4);
|
||||
currentResources = new HashSet<>(4);
|
||||
this.resourcesCurrentlyBeingLoaded.set(currentResources);
|
||||
}
|
||||
if (!currentResources.add(encodedResource)) {
|
||||
|
||||
@@ -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.
|
||||
@@ -160,13 +160,13 @@ public class CustomCollectionEditor extends PropertyEditorSupport {
|
||||
}
|
||||
}
|
||||
else if (List.class == collectionType) {
|
||||
return new ArrayList<Object>(initialCapacity);
|
||||
return new ArrayList<>(initialCapacity);
|
||||
}
|
||||
else if (SortedSet.class == collectionType) {
|
||||
return new TreeSet<Object>();
|
||||
return new TreeSet<>();
|
||||
}
|
||||
else {
|
||||
return new LinkedHashSet<Object>(initialCapacity);
|
||||
return new LinkedHashSet<>(initialCapacity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -138,10 +138,10 @@ public class CustomMapEditor extends PropertyEditorSupport {
|
||||
}
|
||||
}
|
||||
else if (SortedMap.class == mapType) {
|
||||
return new TreeMap<Object, Object>();
|
||||
return new TreeMap<>();
|
||||
}
|
||||
else {
|
||||
return new LinkedHashMap<Object, Object>(initialCapacity);
|
||||
return new LinkedHashMap<>(initialCapacity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -78,7 +78,7 @@ public class PagedListHolder<E> implements Serializable {
|
||||
* @see #setSource
|
||||
*/
|
||||
public PagedListHolder() {
|
||||
this(new ArrayList<E>(0));
|
||||
this(new ArrayList<>(0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,7 +147,7 @@ public class PropertyComparator<T> implements Comparator<T> {
|
||||
*/
|
||||
public static void sort(Object[] source, SortDefinition sortDefinition) throws BeansException {
|
||||
if (StringUtils.hasText(sortDefinition.getProperty())) {
|
||||
Arrays.sort(source, new PropertyComparator<Object>(sortDefinition));
|
||||
Arrays.sort(source, new PropertyComparator<>(sortDefinition));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user