Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -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 @@ import org.springframework.util.Assert;
|
||||
public abstract class AttributeAccessorSupport implements AttributeAccessor, Serializable {
|
||||
|
||||
/** Map with String keys and Object values */
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<String, Object>(0);
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<>(0);
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.
|
||||
@@ -60,7 +60,7 @@ public abstract class BridgeMethodResolver {
|
||||
return bridgeMethod;
|
||||
}
|
||||
// Gather all methods with matching name and parameter size.
|
||||
List<Method> candidateMethods = new ArrayList<Method>();
|
||||
List<Method> candidateMethods = new ArrayList<>();
|
||||
Method[] methods = ReflectionUtils.getAllDeclaredMethods(bridgeMethod.getDeclaringClass());
|
||||
for (Method candidateMethod : methods) {
|
||||
if (isBridgedCandidateFor(candidateMethod, bridgeMethod)) {
|
||||
|
||||
@@ -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.
|
||||
@@ -55,9 +55,9 @@ import org.springframework.util.MultiValueMap;
|
||||
*/
|
||||
public abstract class CollectionFactory {
|
||||
|
||||
private static final Set<Class<?>> approximableCollectionTypes = new HashSet<Class<?>>(11);
|
||||
private static final Set<Class<?>> approximableCollectionTypes = new HashSet<>(11);
|
||||
|
||||
private static final Set<Class<?>> approximableMapTypes = new HashSet<Class<?>>(7);
|
||||
private static final Set<Class<?>> approximableMapTypes = new HashSet<>(7);
|
||||
|
||||
|
||||
static {
|
||||
@@ -118,10 +118,10 @@ public abstract class CollectionFactory {
|
||||
@SuppressWarnings({ "unchecked", "cast", "rawtypes" })
|
||||
public static <E> Collection<E> createApproximateCollection(Object collection, int capacity) {
|
||||
if (collection instanceof LinkedList) {
|
||||
return new LinkedList<E>();
|
||||
return new LinkedList<>();
|
||||
}
|
||||
else if (collection instanceof List) {
|
||||
return new ArrayList<E>(capacity);
|
||||
return new ArrayList<>(capacity);
|
||||
}
|
||||
else if (collection instanceof EnumSet) {
|
||||
// Cast is necessary for compilation in Eclipse 4.4.1.
|
||||
@@ -130,10 +130,10 @@ public abstract class CollectionFactory {
|
||||
return enumSet;
|
||||
}
|
||||
else if (collection instanceof SortedSet) {
|
||||
return new TreeSet<E>(((SortedSet<E>) collection).comparator());
|
||||
return new TreeSet<>(((SortedSet<E>) collection).comparator());
|
||||
}
|
||||
else {
|
||||
return new LinkedHashSet<E>(capacity);
|
||||
return new LinkedHashSet<>(capacity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,13 +179,13 @@ public abstract class CollectionFactory {
|
||||
Assert.notNull(collectionType, "Collection type must not be null");
|
||||
if (collectionType.isInterface()) {
|
||||
if (Set.class == collectionType || Collection.class == collectionType) {
|
||||
return new LinkedHashSet<E>(capacity);
|
||||
return new LinkedHashSet<>(capacity);
|
||||
}
|
||||
else if (List.class == collectionType) {
|
||||
return new ArrayList<E>(capacity);
|
||||
return new ArrayList<>(capacity);
|
||||
}
|
||||
else if (SortedSet.class == collectionType || NavigableSet.class == collectionType) {
|
||||
return new TreeSet<E>();
|
||||
return new TreeSet<>();
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Unsupported Collection interface: " + collectionType.getName());
|
||||
@@ -245,10 +245,10 @@ public abstract class CollectionFactory {
|
||||
return enumMap;
|
||||
}
|
||||
else if (map instanceof SortedMap) {
|
||||
return new TreeMap<K, V>(((SortedMap<K, V>) map).comparator());
|
||||
return new TreeMap<>(((SortedMap<K, V>) map).comparator());
|
||||
}
|
||||
else {
|
||||
return new LinkedHashMap<K, V>(capacity);
|
||||
return new LinkedHashMap<>(capacity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,10 +295,10 @@ public abstract class CollectionFactory {
|
||||
Assert.notNull(mapType, "Map type must not be null");
|
||||
if (mapType.isInterface()) {
|
||||
if (Map.class == mapType) {
|
||||
return new LinkedHashMap<K, V>(capacity);
|
||||
return new LinkedHashMap<>(capacity);
|
||||
}
|
||||
else if (SortedMap.class == mapType || NavigableMap.class == mapType) {
|
||||
return new TreeMap<K, V>();
|
||||
return new TreeMap<>();
|
||||
}
|
||||
else if (MultiValueMap.class == mapType) {
|
||||
return new LinkedMultiValueMap();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@ public class Constants {
|
||||
private final String className;
|
||||
|
||||
/** Map from String field name to object value */
|
||||
private final Map<String, Object> fieldCache = new HashMap<String, Object>();
|
||||
private final Map<String, Object> fieldCache = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -159,7 +159,7 @@ public class Constants {
|
||||
*/
|
||||
public Set<String> getNames(String namePrefix) {
|
||||
String prefixToUse = (namePrefix != null ? namePrefix.trim().toUpperCase(Locale.ENGLISH) : "");
|
||||
Set<String> names = new HashSet<String>();
|
||||
Set<String> names = new HashSet<>();
|
||||
for (String code : this.fieldCache.keySet()) {
|
||||
if (code.startsWith(prefixToUse)) {
|
||||
names.add(code);
|
||||
@@ -191,7 +191,7 @@ public class Constants {
|
||||
*/
|
||||
public Set<String> getNamesForSuffix(String nameSuffix) {
|
||||
String suffixToUse = (nameSuffix != null ? nameSuffix.trim().toUpperCase(Locale.ENGLISH) : "");
|
||||
Set<String> names = new HashSet<String>();
|
||||
Set<String> names = new HashSet<>();
|
||||
for (String code : this.fieldCache.keySet()) {
|
||||
if (code.endsWith(suffixToUse)) {
|
||||
names.add(code);
|
||||
@@ -213,7 +213,7 @@ public class Constants {
|
||||
*/
|
||||
public Set<Object> getValues(String namePrefix) {
|
||||
String prefixToUse = (namePrefix != null ? namePrefix.trim().toUpperCase(Locale.ENGLISH) : "");
|
||||
Set<Object> values = new HashSet<Object>();
|
||||
Set<Object> values = new HashSet<>();
|
||||
for (String code : this.fieldCache.keySet()) {
|
||||
if (code.startsWith(prefixToUse)) {
|
||||
values.add(this.fieldCache.get(code));
|
||||
@@ -245,7 +245,7 @@ public class Constants {
|
||||
*/
|
||||
public Set<Object> getValuesForSuffix(String nameSuffix) {
|
||||
String suffixToUse = (nameSuffix != null ? nameSuffix.trim().toUpperCase(Locale.ENGLISH) : "");
|
||||
Set<Object> values = new HashSet<Object>();
|
||||
Set<Object> values = new HashSet<>();
|
||||
for (String code : this.fieldCache.keySet()) {
|
||||
if (code.endsWith(suffixToUse)) {
|
||||
values.add(this.fieldCache.get(code));
|
||||
|
||||
@@ -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.
|
||||
@@ -52,7 +52,7 @@ public abstract class Conventions {
|
||||
private static final Set<Class<?>> IGNORED_INTERFACES;
|
||||
static {
|
||||
IGNORED_INTERFACES = Collections.unmodifiableSet(
|
||||
new HashSet<Class<?>>(Arrays.<Class<?>> asList(
|
||||
new HashSet<>(Arrays.<Class<?>>asList(
|
||||
Serializable.class,
|
||||
Externalizable.class,
|
||||
Cloneable.class,
|
||||
|
||||
@@ -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.
|
||||
@@ -89,7 +89,7 @@ public class ExceptionDepthComparator implements Comparator<Class<? extends Thro
|
||||
return exceptionTypes.iterator().next();
|
||||
}
|
||||
List<Class<? extends Throwable>> handledExceptions =
|
||||
new ArrayList<Class<? extends Throwable>>(exceptionTypes);
|
||||
new ArrayList<>(exceptionTypes);
|
||||
Collections.sort(handledExceptions, new ExceptionDepthComparator(targetException));
|
||||
return handledExceptions.get(0);
|
||||
}
|
||||
|
||||
@@ -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 @@ public abstract class GenericTypeResolver {
|
||||
/** Cache from Class to TypeVariable Map */
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final Map<Class<?>, Map<TypeVariable, Type>> typeVariableCache =
|
||||
new ConcurrentReferenceHashMap<Class<?>, Map<TypeVariable, Type>>();
|
||||
new ConcurrentReferenceHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -273,7 +273,7 @@ public abstract class GenericTypeResolver {
|
||||
public static Map<TypeVariable, Type> getTypeVariableMap(Class<?> clazz) {
|
||||
Map<TypeVariable, Type> typeVariableMap = typeVariableCache.get(clazz);
|
||||
if (typeVariableMap == null) {
|
||||
typeVariableMap = new HashMap<TypeVariable, Type>();
|
||||
typeVariableMap = new HashMap<>();
|
||||
buildTypeVariableMap(ResolvableType.forClass(clazz), typeVariableMap);
|
||||
typeVariableCache.put(clazz, Collections.unmodifiableMap(typeVariableMap));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD
|
||||
|
||||
// the cache uses a nested index (value is a map) to keep the top level cache relatively small in size
|
||||
private final Map<Class<?>, Map<Member, String[]>> parameterNamesCache =
|
||||
new ConcurrentHashMap<Class<?>, Map<Member, String[]>>(32);
|
||||
new ConcurrentHashMap<>(32);
|
||||
|
||||
|
||||
@Override
|
||||
@@ -110,7 +110,7 @@ public class LocalVariableTableParameterNameDiscoverer implements ParameterNameD
|
||||
}
|
||||
try {
|
||||
ClassReader classReader = new ClassReader(is);
|
||||
Map<Member, String[]> map = new ConcurrentHashMap<Member, String[]>(32);
|
||||
Map<Member, String[]> map = new ConcurrentHashMap<>(32);
|
||||
classReader.accept(new ParameterNameDiscoveringVisitor(clazz, map), 0);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -52,8 +52,8 @@ public abstract class MethodIntrospector {
|
||||
* or an empty map in case of no match
|
||||
*/
|
||||
public static <T> Map<Method, T> selectMethods(Class<?> targetType, final MetadataLookup<T> metadataLookup) {
|
||||
final Map<Method, T> methodMap = new LinkedHashMap<Method, T>();
|
||||
Set<Class<?>> handlerTypes = new LinkedHashSet<Class<?>>();
|
||||
final Map<Method, T> methodMap = new LinkedHashMap<>();
|
||||
Set<Class<?>> handlerTypes = new LinkedHashSet<>();
|
||||
Class<?> specificHandlerType = null;
|
||||
|
||||
if (!Proxy.isProxyClass(targetType)) {
|
||||
|
||||
@@ -277,7 +277,7 @@ public class MethodParameter {
|
||||
*/
|
||||
private Map<Integer, Integer> getTypeIndexesPerLevel() {
|
||||
if (this.typeIndexesPerLevel == null) {
|
||||
this.typeIndexesPerLevel = new HashMap<Integer, Integer>(4);
|
||||
this.typeIndexesPerLevel = new HashMap<>(4);
|
||||
}
|
||||
return this.typeIndexesPerLevel;
|
||||
}
|
||||
|
||||
@@ -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 @@ import java.util.List;
|
||||
public class PrioritizedParameterNameDiscoverer implements ParameterNameDiscoverer {
|
||||
|
||||
private final List<ParameterNameDiscoverer> parameterNameDiscoverers =
|
||||
new LinkedList<ParameterNameDiscoverer>();
|
||||
new LinkedList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -90,7 +90,7 @@ public class ResolvableType implements Serializable {
|
||||
private static final ResolvableType[] EMPTY_TYPES_ARRAY = new ResolvableType[0];
|
||||
|
||||
private static final ConcurrentReferenceHashMap<ResolvableType, ResolvableType> cache =
|
||||
new ConcurrentReferenceHashMap<ResolvableType, ResolvableType>(256);
|
||||
new ConcurrentReferenceHashMap<>(256);
|
||||
|
||||
|
||||
/**
|
||||
@@ -334,7 +334,7 @@ public class ResolvableType implements Serializable {
|
||||
return false;
|
||||
}
|
||||
if (matchedBefore == null) {
|
||||
matchedBefore = new IdentityHashMap<Type, Type>(1);
|
||||
matchedBefore = new IdentityHashMap<>(1);
|
||||
}
|
||||
matchedBefore.put(this.type, other.type);
|
||||
for (int i = 0; i < ourGenerics.length; 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.
|
||||
@@ -60,7 +60,7 @@ abstract class SerializableTypeWrapper {
|
||||
GenericArrayType.class, ParameterizedType.class, TypeVariable.class, WildcardType.class};
|
||||
|
||||
private static final ConcurrentReferenceHashMap<Type, Type> cache =
|
||||
new ConcurrentReferenceHashMap<Type, Type>(256);
|
||||
new ConcurrentReferenceHashMap<>(256);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -38,7 +38,7 @@ import org.springframework.util.StringValueResolver;
|
||||
public class SimpleAliasRegistry implements AliasRegistry {
|
||||
|
||||
/** Map from alias to canonical name */
|
||||
private final Map<String, String> aliasMap = new ConcurrentHashMap<String, String>(16);
|
||||
private final Map<String, String> aliasMap = new ConcurrentHashMap<>(16);
|
||||
|
||||
|
||||
@Override
|
||||
@@ -105,7 +105,7 @@ public class SimpleAliasRegistry implements AliasRegistry {
|
||||
|
||||
@Override
|
||||
public String[] getAliases(String name) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
List<String> result = new ArrayList<>();
|
||||
synchronized (this.aliasMap) {
|
||||
retrieveAliases(name, result);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public class SimpleAliasRegistry implements AliasRegistry {
|
||||
public void resolveAliases(StringValueResolver valueResolver) {
|
||||
Assert.notNull(valueResolver, "StringValueResolver must not be null");
|
||||
synchronized (this.aliasMap) {
|
||||
Map<String, String> aliasCopy = new HashMap<String, String>(this.aliasMap);
|
||||
Map<String, String> aliasCopy = new HashMap<>(this.aliasMap);
|
||||
for (String alias : aliasCopy.keySet()) {
|
||||
String registeredName = aliasCopy.get(alias);
|
||||
String resolvedAlias = valueResolver.resolveStringValue(alias);
|
||||
|
||||
@@ -183,14 +183,14 @@ public class AnnotatedElementUtils {
|
||||
}
|
||||
|
||||
try {
|
||||
final Set<String> types = new LinkedHashSet<String>();
|
||||
final Set<String> types = new LinkedHashSet<>();
|
||||
searchWithGetSemantics(composed.annotationType(), null, null, null, new SimpleAnnotationProcessor<Object>(true) {
|
||||
@Override
|
||||
public Object process(AnnotatedElement annotatedElement, Annotation annotation, int metaDepth) {
|
||||
types.add(annotation.annotationType().getName());
|
||||
return CONTINUE;
|
||||
}
|
||||
}, new HashSet<AnnotatedElement>(), 1);
|
||||
}, new HashSet<>(), 1);
|
||||
return (!types.isEmpty() ? types : null);
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
@@ -560,7 +560,7 @@ public class AnnotatedElementUtils {
|
||||
public static MultiValueMap<String, Object> getAllAnnotationAttributes(AnnotatedElement element,
|
||||
String annotationName, final boolean classValuesAsString, final boolean nestedAnnotationsAsMap) {
|
||||
|
||||
final MultiValueMap<String, Object> attributesMap = new LinkedMultiValueMap<String, Object>();
|
||||
final MultiValueMap<String, Object> attributesMap = new LinkedMultiValueMap<>();
|
||||
|
||||
searchWithGetSemantics(element, null, annotationName, new SimpleAnnotationProcessor<Object>() {
|
||||
@Override
|
||||
@@ -853,7 +853,7 @@ public class AnnotatedElementUtils {
|
||||
|
||||
try {
|
||||
return searchWithGetSemantics(element, annotationType, annotationName, containerType, processor,
|
||||
new HashSet<AnnotatedElement>(), 0);
|
||||
new HashSet<>(), 0);
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
AnnotationUtils.rethrowAnnotationConfigurationException(ex);
|
||||
@@ -895,7 +895,7 @@ public class AnnotatedElementUtils {
|
||||
}
|
||||
|
||||
if (element instanceof Class) { // otherwise getAnnotations doesn't return anything new
|
||||
List<Annotation> inheritedAnnotations = new ArrayList<Annotation>();
|
||||
List<Annotation> inheritedAnnotations = new ArrayList<>();
|
||||
for (Annotation annotation : element.getAnnotations()) {
|
||||
if (!declaredAnnotations.contains(annotation)) {
|
||||
inheritedAnnotations.add(annotation);
|
||||
@@ -1037,7 +1037,7 @@ public class AnnotatedElementUtils {
|
||||
|
||||
try {
|
||||
return searchWithFindSemantics(
|
||||
element, annotationType, annotationName, containerType, processor, new HashSet<AnnotatedElement>(), 0);
|
||||
element, annotationType, annotationName, containerType, processor, new HashSet<>(), 0);
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
AnnotationUtils.rethrowAnnotationConfigurationException(ex);
|
||||
@@ -1073,7 +1073,7 @@ public class AnnotatedElementUtils {
|
||||
try {
|
||||
// Locally declared annotations (ignoring @Inherited)
|
||||
Annotation[] annotations = element.getDeclaredAnnotations();
|
||||
List<T> aggregatedResults = (processor.aggregates() ? new ArrayList<T>() : null);
|
||||
List<T> aggregatedResults = (processor.aggregates() ? new ArrayList<>() : null);
|
||||
|
||||
// Search in local annotations
|
||||
for (Annotation annotation : annotations) {
|
||||
@@ -1302,7 +1302,7 @@ public class AnnotatedElementUtils {
|
||||
private static <A extends Annotation> Set<A> postProcessAndSynthesizeAggregatedResults(AnnotatedElement element,
|
||||
Class<A> annotationType, List<AnnotationAttributes> aggregatedResults) {
|
||||
|
||||
Set<A> annotations = new LinkedHashSet<A>();
|
||||
Set<A> annotations = new LinkedHashSet<>();
|
||||
for (AnnotationAttributes attributes : aggregatedResults) {
|
||||
AnnotationUtils.postProcessAnnotationAttributes(element, attributes, false, false);
|
||||
annotations.add(AnnotationUtils.synthesizeAnnotation(attributes, annotationType, element));
|
||||
@@ -1502,7 +1502,7 @@ public class AnnotatedElementUtils {
|
||||
this.classValuesAsString = classValuesAsString;
|
||||
this.nestedAnnotationsAsMap = nestedAnnotationsAsMap;
|
||||
this.aggregates = aggregates;
|
||||
this.aggregatedResults = (aggregates ? new ArrayList<AnnotationAttributes>() : null);
|
||||
this.aggregatedResults = (aggregates ? new ArrayList<>() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1533,7 +1533,7 @@ public class AnnotatedElementUtils {
|
||||
|
||||
// Track which attribute values have already been replaced so that we can short
|
||||
// circuit the search algorithms.
|
||||
Set<String> valuesAlreadyReplaced = new HashSet<String>();
|
||||
Set<String> valuesAlreadyReplaced = new HashSet<>();
|
||||
|
||||
for (Method attributeMethod : AnnotationUtils.getAttributeMethods(annotation.annotationType())) {
|
||||
String attributeName = attributeMethod.getName();
|
||||
@@ -1545,7 +1545,7 @@ public class AnnotatedElementUtils {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<String> targetAttributeNames = new ArrayList<String>();
|
||||
List<String> targetAttributeNames = new ArrayList<>();
|
||||
targetAttributeNames.add(attributeOverrideName);
|
||||
valuesAlreadyReplaced.add(attributeOverrideName);
|
||||
|
||||
|
||||
@@ -114,25 +114,25 @@ public abstract class AnnotationUtils {
|
||||
private static final String REPEATABLE_CLASS_NAME = "java.lang.annotation.Repeatable";
|
||||
|
||||
private static final Map<AnnotationCacheKey, Annotation> findAnnotationCache =
|
||||
new ConcurrentReferenceHashMap<AnnotationCacheKey, Annotation>(256);
|
||||
new ConcurrentReferenceHashMap<>(256);
|
||||
|
||||
private static final Map<AnnotationCacheKey, Boolean> metaPresentCache =
|
||||
new ConcurrentReferenceHashMap<AnnotationCacheKey, Boolean>(256);
|
||||
new ConcurrentReferenceHashMap<>(256);
|
||||
|
||||
private static final Map<Class<?>, Boolean> annotatedInterfaceCache =
|
||||
new ConcurrentReferenceHashMap<Class<?>, Boolean>(256);
|
||||
new ConcurrentReferenceHashMap<>(256);
|
||||
|
||||
private static final Map<Class<? extends Annotation>, Boolean> synthesizableCache =
|
||||
new ConcurrentReferenceHashMap<Class<? extends Annotation>, Boolean>(256);
|
||||
new ConcurrentReferenceHashMap<>(256);
|
||||
|
||||
private static final Map<Class<? extends Annotation>, Map<String, List<String>>> attributeAliasesCache =
|
||||
new ConcurrentReferenceHashMap<Class<? extends Annotation>, Map<String, List<String>>>(256);
|
||||
new ConcurrentReferenceHashMap<>(256);
|
||||
|
||||
private static final Map<Class<? extends Annotation>, List<Method>> attributeMethodsCache =
|
||||
new ConcurrentReferenceHashMap<Class<? extends Annotation>, List<Method>>(256);
|
||||
new ConcurrentReferenceHashMap<>(256);
|
||||
|
||||
private static final Map<Method, AliasDescriptor> aliasDescriptorCache =
|
||||
new ConcurrentReferenceHashMap<Method, AliasDescriptor>(256);
|
||||
new ConcurrentReferenceHashMap<>(256);
|
||||
|
||||
private static transient Log logger;
|
||||
|
||||
@@ -438,7 +438,7 @@ public abstract class AnnotationUtils {
|
||||
if (annotatedElement instanceof Method) {
|
||||
annotatedElement = BridgeMethodResolver.findBridgedMethod((Method) annotatedElement);
|
||||
}
|
||||
return new AnnotationCollector<A>(annotationType, containerAnnotationType, declaredMode).getResult(annotatedElement);
|
||||
return new AnnotationCollector<>(annotationType, containerAnnotationType, declaredMode).getResult(annotatedElement);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
handleIntrospectionFailure(annotatedElement, ex);
|
||||
@@ -470,7 +470,7 @@ public abstract class AnnotationUtils {
|
||||
|
||||
// Do NOT store result in the findAnnotationCache since doing so could break
|
||||
// findAnnotation(Class, Class) and findAnnotation(Method, Class).
|
||||
A ann = findAnnotation(annotatedElement, annotationType, new HashSet<Annotation>());
|
||||
A ann = findAnnotation(annotatedElement, annotationType, new HashSet<>());
|
||||
return synthesizeAnnotation(ann, annotatedElement);
|
||||
}
|
||||
|
||||
@@ -655,7 +655,7 @@ public abstract class AnnotationUtils {
|
||||
AnnotationCacheKey cacheKey = new AnnotationCacheKey(clazz, annotationType);
|
||||
A result = (A) findAnnotationCache.get(cacheKey);
|
||||
if (result == null) {
|
||||
result = findAnnotation(clazz, annotationType, new HashSet<Annotation>());
|
||||
result = findAnnotation(clazz, annotationType, new HashSet<>());
|
||||
if (result != null && synthesize) {
|
||||
result = synthesizeAnnotation(result, clazz);
|
||||
findAnnotationCache.put(cacheKey, result);
|
||||
@@ -1144,7 +1144,7 @@ public abstract class AnnotationUtils {
|
||||
|
||||
// Track which attribute values have already been replaced so that we can short
|
||||
// circuit the search algorithms.
|
||||
Set<String> valuesAlreadyReplaced = new HashSet<String>();
|
||||
Set<String> valuesAlreadyReplaced = new HashSet<>();
|
||||
|
||||
// Validate @AliasFor configuration
|
||||
Map<String, List<String>> aliasMap = getAttributeAliasMap(annotationType);
|
||||
@@ -1509,7 +1509,7 @@ public abstract class AnnotationUtils {
|
||||
return map;
|
||||
}
|
||||
|
||||
map = new LinkedHashMap<String, List<String>>();
|
||||
map = new LinkedHashMap<>();
|
||||
for (Method attribute : getAttributeMethods(annotationType)) {
|
||||
List<String> aliasNames = getAttributeAliasNames(attribute);
|
||||
if (!aliasNames.isEmpty()) {
|
||||
@@ -1645,7 +1645,7 @@ public abstract class AnnotationUtils {
|
||||
return methods;
|
||||
}
|
||||
|
||||
methods = new ArrayList<Method>();
|
||||
methods = new ArrayList<>();
|
||||
for (Method method : annotationType.getDeclaredMethods()) {
|
||||
if (isAttributeMethod(method)) {
|
||||
ReflectionUtils.makeAccessible(method);
|
||||
@@ -1824,9 +1824,9 @@ public abstract class AnnotationUtils {
|
||||
|
||||
private final boolean declaredMode;
|
||||
|
||||
private final Set<AnnotatedElement> visited = new HashSet<AnnotatedElement>();
|
||||
private final Set<AnnotatedElement> visited = new HashSet<>();
|
||||
|
||||
private final Set<A> result = new LinkedHashSet<A>();
|
||||
private final Set<A> result = new LinkedHashSet<>();
|
||||
|
||||
AnnotationCollector(Class<A> annotationType, Class<? extends Annotation> containerAnnotationType, boolean declaredMode) {
|
||||
this.annotationType = annotationType;
|
||||
@@ -1867,7 +1867,7 @@ public abstract class AnnotationUtils {
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<A> getValue(AnnotatedElement element, Annotation annotation) {
|
||||
try {
|
||||
List<A> synthesizedAnnotations = new ArrayList<A>();
|
||||
List<A> synthesizedAnnotations = new ArrayList<>();
|
||||
for (A anno : (A[]) AnnotationUtils.getValue(annotation)) {
|
||||
synthesizedAnnotations.add(synthesizeAnnotation(anno, element));
|
||||
}
|
||||
@@ -2080,7 +2080,7 @@ public abstract class AnnotationUtils {
|
||||
}
|
||||
|
||||
// Else: search for implicit aliases
|
||||
List<String> aliases = new ArrayList<String>();
|
||||
List<String> aliases = new ArrayList<>();
|
||||
for (AliasDescriptor otherDescriptor : getOtherDescriptors()) {
|
||||
if (this.isAliasFor(otherDescriptor)) {
|
||||
this.validateAgainst(otherDescriptor);
|
||||
@@ -2091,7 +2091,7 @@ public abstract class AnnotationUtils {
|
||||
}
|
||||
|
||||
private List<AliasDescriptor> getOtherDescriptors() {
|
||||
List<AliasDescriptor> otherDescriptors = new ArrayList<AliasDescriptor>();
|
||||
List<AliasDescriptor> otherDescriptors = new ArrayList<>();
|
||||
for (Method currentAttribute : getAttributeMethods(this.sourceAnnotationType)) {
|
||||
if (!this.sourceAttribute.equals(currentAttribute)) {
|
||||
AliasDescriptor otherDescriptor = AliasDescriptor.from(currentAttribute);
|
||||
|
||||
@@ -88,7 +88,7 @@ class MapAnnotationAttributeExtractor extends AbstractAliasAwareAnnotationAttrib
|
||||
private static Map<String, Object> enrichAndValidateAttributes(
|
||||
Map<String, Object> originalAttributes, Class<? extends Annotation> annotationType) {
|
||||
|
||||
Map<String, Object> attributes = new LinkedHashMap<String, Object>(originalAttributes);
|
||||
Map<String, Object> attributes = new LinkedHashMap<>(originalAttributes);
|
||||
Map<String, List<String>> attributeAliasMap = getAttributeAliasMap(annotationType);
|
||||
|
||||
for (Method attributeMethod : getAttributeMethods(annotationType)) {
|
||||
|
||||
@@ -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.
|
||||
@@ -47,7 +47,7 @@ class SynthesizedAnnotationInvocationHandler implements InvocationHandler {
|
||||
|
||||
private final AnnotationAttributeExtractor<?> attributeExtractor;
|
||||
|
||||
private final Map<String, Object> valueCache = new ConcurrentHashMap<String, Object>(8);
|
||||
private final Map<String, Object> valueCache = new ConcurrentHashMap<>(8);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -48,7 +48,7 @@ import org.springframework.util.StringUtils;
|
||||
public final class Property {
|
||||
|
||||
private static Map<Property, Annotation[]> annotationCache =
|
||||
new ConcurrentReferenceHashMap<Property, Annotation[]>();
|
||||
new ConcurrentReferenceHashMap<>();
|
||||
|
||||
private final Class<?> objectType;
|
||||
|
||||
@@ -194,7 +194,7 @@ public final class Property {
|
||||
private Annotation[] resolveAnnotations() {
|
||||
Annotation[] annotations = annotationCache.get(this);
|
||||
if (annotations == null) {
|
||||
Map<Class<? extends Annotation>, Annotation> annotationMap = new LinkedHashMap<Class<? extends Annotation>, Annotation>();
|
||||
Map<Class<? extends Annotation>, Annotation> annotationMap = new LinkedHashMap<>();
|
||||
addAnnotationsToMap(annotationMap, getReadMethod());
|
||||
addAnnotationsToMap(annotationMap, getWriteMethod());
|
||||
addAnnotationsToMap(annotationMap, getField());
|
||||
|
||||
@@ -48,7 +48,7 @@ public class TypeDescriptor implements Serializable {
|
||||
|
||||
static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
|
||||
|
||||
private static final Map<Class<?>, TypeDescriptor> commonTypesCache = new HashMap<Class<?>, TypeDescriptor>(18);
|
||||
private static final Map<Class<?>, TypeDescriptor> commonTypesCache = new HashMap<>(18);
|
||||
|
||||
private static final Class<?>[] CACHED_COMMON_TYPES = {
|
||||
boolean.class, Boolean.class, byte.class, Byte.class, char.class, Character.class,
|
||||
|
||||
@@ -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.
|
||||
@@ -70,7 +70,7 @@ public class ConvertingComparator<S, T> implements Comparator<S> {
|
||||
public ConvertingComparator(
|
||||
Comparator<T> comparator, ConversionService conversionService, Class<? extends T> targetType) {
|
||||
|
||||
this(comparator, new ConversionServiceConverter<S, T>(conversionService, targetType));
|
||||
this(comparator, new ConversionServiceConverter<>(conversionService, targetType));
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ConvertingComparator<S, T> implements Comparator<S> {
|
||||
* @return a new {@link ConvertingComparator} instance
|
||||
*/
|
||||
public static <K, V> ConvertingComparator<Map.Entry<K, V>, K> mapEntryKeys(Comparator<K> comparator) {
|
||||
return new ConvertingComparator<Map.Entry<K,V>, K>(comparator, new Converter<Map.Entry<K, V>, K>() {
|
||||
return new ConvertingComparator<>(comparator, new Converter<Map.Entry<K, V>, K>() {
|
||||
@Override
|
||||
public K convert(Map.Entry<K, V> source) {
|
||||
return source.getKey();
|
||||
@@ -103,7 +103,7 @@ public class ConvertingComparator<S, T> implements Comparator<S> {
|
||||
* @return a new {@link ConvertingComparator} instance
|
||||
*/
|
||||
public static <K, V> ConvertingComparator<Map.Entry<K, V>, V> mapEntryValues(Comparator<V> comparator) {
|
||||
return new ConvertingComparator<Map.Entry<K,V>, V>(comparator, new Converter<Map.Entry<K, V>, V>() {
|
||||
return new ConvertingComparator<>(comparator, new Converter<Map.Entry<K, V>, V>() {
|
||||
@Override
|
||||
public V convert(Map.Entry<K, V> source) {
|
||||
return source.getValue();
|
||||
|
||||
@@ -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.
|
||||
@@ -43,7 +43,7 @@ final class ByteBufferConverter implements ConditionalGenericConverter {
|
||||
private static final Set<ConvertiblePair> CONVERTIBLE_PAIRS;
|
||||
|
||||
static {
|
||||
Set<ConvertiblePair> convertiblePairs = new HashSet<ConvertiblePair>(4);
|
||||
Set<ConvertiblePair> convertiblePairs = new HashSet<>(4);
|
||||
convertiblePairs.add(new ConvertiblePair(ByteBuffer.class, byte[].class));
|
||||
convertiblePairs.add(new ConvertiblePair(byte[].class, ByteBuffer.class));
|
||||
convertiblePairs.add(new ConvertiblePair(ByteBuffer.class, Object.class));
|
||||
|
||||
@@ -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.
|
||||
@@ -42,7 +42,7 @@ final class CharacterToNumberFactory implements ConverterFactory<Character, Numb
|
||||
|
||||
@Override
|
||||
public <T extends Number> Converter<Character, T> getConverter(Class<T> targetType) {
|
||||
return new CharacterToNumber<T>(targetType);
|
||||
return new CharacterToNumber<>(targetType);
|
||||
}
|
||||
|
||||
private static final class CharacterToNumber<T extends Number> implements Converter<Character, T> {
|
||||
|
||||
@@ -76,7 +76,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
private final Converters converters = new Converters();
|
||||
|
||||
private final Map<ConverterCacheKey, GenericConverter> converterCache =
|
||||
new ConcurrentReferenceHashMap<ConverterCacheKey, GenericConverter>(64);
|
||||
new ConcurrentReferenceHashMap<>(64);
|
||||
|
||||
|
||||
// ConverterRegistry implementation
|
||||
@@ -476,10 +476,10 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
*/
|
||||
private static class Converters {
|
||||
|
||||
private final Set<GenericConverter> globalConverters = new LinkedHashSet<GenericConverter>();
|
||||
private final Set<GenericConverter> globalConverters = new LinkedHashSet<>();
|
||||
|
||||
private final Map<ConvertiblePair, ConvertersForPair> converters =
|
||||
new LinkedHashMap<ConvertiblePair, ConvertersForPair>(36);
|
||||
new LinkedHashMap<>(36);
|
||||
|
||||
public void add(GenericConverter converter) {
|
||||
Set<ConvertiblePair> convertibleTypes = converter.getConvertibleTypes();
|
||||
@@ -559,8 +559,8 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
* @return an ordered list of all classes that the given type extends or implements
|
||||
*/
|
||||
private List<Class<?>> getClassHierarchy(Class<?> type) {
|
||||
List<Class<?>> hierarchy = new ArrayList<Class<?>>(20);
|
||||
Set<Class<?>> visited = new HashSet<Class<?>>(20);
|
||||
List<Class<?>> hierarchy = new ArrayList<>(20);
|
||||
Set<Class<?>> visited = new HashSet<>(20);
|
||||
addToClassHierarchy(0, ClassUtils.resolvePrimitiveIfNecessary(type), false, hierarchy, visited);
|
||||
boolean array = type.isArray();
|
||||
|
||||
@@ -617,7 +617,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
}
|
||||
|
||||
private List<String> getConverterStrings() {
|
||||
List<String> converterStrings = new ArrayList<String>();
|
||||
List<String> converterStrings = new ArrayList<>();
|
||||
for (ConvertersForPair convertersForPair : converters.values()) {
|
||||
converterStrings.add(convertersForPair.toString());
|
||||
}
|
||||
@@ -632,7 +632,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
||||
*/
|
||||
private static class ConvertersForPair {
|
||||
|
||||
private final LinkedList<GenericConverter> converters = new LinkedList<GenericConverter>();
|
||||
private final LinkedList<GenericConverter> converters = new LinkedList<>();
|
||||
|
||||
public void add(GenericConverter converter) {
|
||||
this.converters.addFirst(converter);
|
||||
|
||||
@@ -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.
|
||||
@@ -75,7 +75,7 @@ final class MapToMapConverter implements ConditionalGenericConverter {
|
||||
TypeDescriptor keyDesc = targetType.getMapKeyTypeDescriptor();
|
||||
TypeDescriptor valueDesc = targetType.getMapValueTypeDescriptor();
|
||||
|
||||
List<MapEntry> targetEntries = new ArrayList<MapEntry>(sourceMap.size());
|
||||
List<MapEntry> targetEntries = new ArrayList<>(sourceMap.size());
|
||||
for (Map.Entry<Object, Object> entry : sourceMap.entrySet()) {
|
||||
Object sourceKey = entry.getKey();
|
||||
Object sourceValue = entry.getValue();
|
||||
|
||||
@@ -44,7 +44,7 @@ final class NumberToNumberConverterFactory implements ConverterFactory<Number, N
|
||||
|
||||
@Override
|
||||
public <T extends Number> Converter<Number, T> getConverter(Class<T> targetType) {
|
||||
return new NumberToNumber<T>(targetType);
|
||||
return new NumberToNumber<>(targetType);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.
|
||||
@@ -66,7 +66,7 @@ final class ObjectToObjectConverter implements ConditionalGenericConverter {
|
||||
|
||||
// Cache for the latest to-method resolved on a given Class
|
||||
private static final Map<Class<?>, Member> conversionMemberCache =
|
||||
new ConcurrentReferenceHashMap<Class<?>, Member>(32);
|
||||
new ConcurrentReferenceHashMap<>(32);
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -112,7 +112,7 @@ class StreamConverter implements ConditionalGenericConverter {
|
||||
|
||||
|
||||
private static Set<ConvertiblePair> createConvertibleTypes() {
|
||||
Set<ConvertiblePair> convertiblePairs = new HashSet<ConvertiblePair>();
|
||||
Set<ConvertiblePair> convertiblePairs = new HashSet<>();
|
||||
convertiblePairs.add(new ConvertiblePair(Stream.class, Collection.class));
|
||||
convertiblePairs.add(new ConvertiblePair(Stream.class, Object[].class));
|
||||
convertiblePairs.add(new ConvertiblePair(Collection.class, Stream.class));
|
||||
|
||||
@@ -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.
|
||||
@@ -30,9 +30,9 @@ import org.springframework.core.convert.converter.Converter;
|
||||
*/
|
||||
final class StringToBooleanConverter implements Converter<String, Boolean> {
|
||||
|
||||
private static final Set<String> trueValues = new HashSet<String>(4);
|
||||
private static final Set<String> trueValues = new HashSet<>(4);
|
||||
|
||||
private static final Set<String> falseValues = new HashSet<String>(4);
|
||||
private static final Set<String> falseValues = new HashSet<>(4);
|
||||
|
||||
static {
|
||||
trueValues.add("true");
|
||||
|
||||
@@ -42,7 +42,7 @@ final class StringToNumberConverterFactory implements ConverterFactory<String, N
|
||||
|
||||
@Override
|
||||
public <T extends Number> Converter<String, T> getConverter(Class<T> targetType) {
|
||||
return new StringToNumber<T>(targetType);
|
||||
return new StringToNumber<>(targetType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -104,9 +104,9 @@ public abstract class AbstractEnvironment implements ConfigurableEnvironment {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final Set<String> activeProfiles = new LinkedHashSet<String>();
|
||||
private final Set<String> activeProfiles = new LinkedHashSet<>();
|
||||
|
||||
private final Set<String> defaultProfiles = new LinkedHashSet<String>(getReservedDefaultProfiles());
|
||||
private final Set<String> defaultProfiles = new LinkedHashSet<>(getReservedDefaultProfiles());
|
||||
|
||||
private final MutablePropertySources propertySources = new MutablePropertySources(this.logger);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public abstract class AbstractPropertyResolver implements ConfigurablePropertyRe
|
||||
|
||||
private String valueSeparator = SystemPropertyUtils.VALUE_SEPARATOR;
|
||||
|
||||
private final Set<String> requiredProperties = new LinkedHashSet<String>();
|
||||
private final Set<String> requiredProperties = new LinkedHashSet<>();
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,8 +33,8 @@ import java.util.Set;
|
||||
*/
|
||||
class CommandLineArgs {
|
||||
|
||||
private final Map<String, List<String>> optionArgs = new HashMap<String, List<String>>();
|
||||
private final List<String> nonOptionArgs = new ArrayList<String>();
|
||||
private final Map<String, List<String>> optionArgs = new HashMap<>();
|
||||
private final List<String> nonOptionArgs = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Add an option argument for the given option name and add the given value to the
|
||||
@@ -44,7 +44,7 @@ class CommandLineArgs {
|
||||
*/
|
||||
public void addOptionArg(String optionName, String optionValue) {
|
||||
if (!this.optionArgs.containsKey(optionName)) {
|
||||
this.optionArgs.put(optionName, new ArrayList<String>());
|
||||
this.optionArgs.put(optionName, new ArrayList<>());
|
||||
}
|
||||
if (optionValue != null) {
|
||||
this.optionArgs.get(optionName).add(optionValue);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class CompositePropertySource extends EnumerablePropertySource<Object> {
|
||||
|
||||
private final Set<PropertySource<?>> propertySources = new LinkedHashSet<PropertySource<?>>();
|
||||
private final Set<PropertySource<?>> propertySources = new LinkedHashSet<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ public class CompositePropertySource extends EnumerablePropertySource<Object> {
|
||||
|
||||
@Override
|
||||
public String[] getPropertyNames() {
|
||||
Set<String> names = new LinkedHashSet<String>();
|
||||
Set<String> names = new LinkedHashSet<>();
|
||||
for (PropertySource<?> propertySource : this.propertySources) {
|
||||
if (!(propertySource instanceof EnumerablePropertySource)) {
|
||||
throw new IllegalStateException(
|
||||
@@ -102,7 +102,7 @@ public class CompositePropertySource extends EnumerablePropertySource<Object> {
|
||||
* @since 4.1
|
||||
*/
|
||||
public void addFirstPropertySource(PropertySource<?> propertySource) {
|
||||
List<PropertySource<?>> existing = new ArrayList<PropertySource<?>>(this.propertySources);
|
||||
List<PropertySource<?>> existing = new ArrayList<>(this.propertySources);
|
||||
this.propertySources.clear();
|
||||
this.propertySources.add(propertySource);
|
||||
this.propertySources.addAll(existing);
|
||||
|
||||
@@ -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.
|
||||
@@ -82,9 +82,9 @@ public class JOptCommandLinePropertySource extends CommandLinePropertySource<Opt
|
||||
|
||||
@Override
|
||||
public String[] getPropertyNames() {
|
||||
List<String> names = new ArrayList<String>();
|
||||
List<String> names = new ArrayList<>();
|
||||
for (OptionSpec<?> spec : this.source.specs()) {
|
||||
List<String> aliases = new ArrayList<String>(spec.options());
|
||||
List<String> aliases = new ArrayList<>(spec.options());
|
||||
if (!aliases.isEmpty()) {
|
||||
// Only the longest name is used for enumerating
|
||||
names.add(aliases.get(aliases.size() - 1));
|
||||
@@ -96,7 +96,7 @@ public class JOptCommandLinePropertySource extends CommandLinePropertySource<Opt
|
||||
@Override
|
||||
public List<String> getOptionValues(String name) {
|
||||
List<?> argValues = this.source.valuesOf(name);
|
||||
List<String> stringArgValues = new ArrayList<String>();
|
||||
List<String> stringArgValues = new ArrayList<>();
|
||||
for (Object argValue : argValues) {
|
||||
stringArgValues.add(argValue instanceof String ? (String) argValue : argValue.toString());
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class JOptCommandLinePropertySource extends CommandLinePropertySource<Opt
|
||||
@Override
|
||||
protected List<String> getNonOptionArgs() {
|
||||
List<?> argValues = this.source.nonOptionArguments();
|
||||
List<String> stringArgValues = new ArrayList<String>();
|
||||
List<String> stringArgValues = new ArrayList<>();
|
||||
for (Object argValue : argValues) {
|
||||
Assert.isInstanceOf(String.class, argValue, "Argument values must be of type String");
|
||||
stringArgValues.add((String) argValue);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.
|
||||
@@ -31,7 +31,7 @@ import java.util.Set;
|
||||
@SuppressWarnings("serial")
|
||||
public class MissingRequiredPropertiesException extends IllegalStateException {
|
||||
|
||||
private final Set<String> missingRequiredProperties = new LinkedHashSet<String>();
|
||||
private final Set<String> missingRequiredProperties = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* Return the set of properties marked as required but not present
|
||||
|
||||
@@ -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 @@ public class MutablePropertySources implements PropertySources {
|
||||
|
||||
private final Log logger;
|
||||
|
||||
private final List<PropertySource<?>> propertySourceList = new CopyOnWriteArrayList<PropertySource<?>>();
|
||||
private final List<PropertySource<?>> propertySourceList = new CopyOnWriteArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,7 +45,7 @@ public class DefaultResourceLoader implements ResourceLoader {
|
||||
|
||||
private ClassLoader classLoader;
|
||||
|
||||
private final Set<ProtocolResolver> protocolResolvers = new LinkedHashSet<ProtocolResolver>(4);
|
||||
private final Set<ProtocolResolver> protocolResolvers = new LinkedHashSet<>(4);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -327,7 +327,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||
* @since 4.1.1
|
||||
*/
|
||||
protected Set<Resource> doFindAllClassPathResources(String path) throws IOException {
|
||||
Set<Resource> result = new LinkedHashSet<Resource>(16);
|
||||
Set<Resource> result = new LinkedHashSet<>(16);
|
||||
ClassLoader cl = getClassLoader();
|
||||
Enumeration<URL> resourceUrls = (cl != null ? cl.getResources(path) : ClassLoader.getSystemResources(path));
|
||||
while (resourceUrls.hasMoreElements()) {
|
||||
@@ -459,7 +459,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||
String rootDirPath = determineRootDir(locationPattern);
|
||||
String subPattern = locationPattern.substring(rootDirPath.length());
|
||||
Resource[] rootDirResources = getResources(rootDirPath);
|
||||
Set<Resource> result = new LinkedHashSet<Resource>(16);
|
||||
Set<Resource> result = new LinkedHashSet<>(16);
|
||||
for (Resource rootDirResource : rootDirResources) {
|
||||
rootDirResource = resolveRootDirResource(rootDirResource);
|
||||
URL rootDirURL = rootDirResource.getURL();
|
||||
@@ -607,7 +607,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||
// The Sun JRE does not return a slash here, but BEA JRockit does.
|
||||
rootEntryPath = rootEntryPath + "/";
|
||||
}
|
||||
Set<Resource> result = new LinkedHashSet<Resource>(8);
|
||||
Set<Resource> result = new LinkedHashSet<>(8);
|
||||
for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements();) {
|
||||
JarEntry entry = entries.nextElement();
|
||||
String entryPath = entry.getName();
|
||||
@@ -687,7 +687,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||
logger.debug("Looking for matching resources in directory tree [" + rootDir.getPath() + "]");
|
||||
}
|
||||
Set<File> matchingFiles = retrieveMatchingFiles(rootDir, subPattern);
|
||||
Set<Resource> result = new LinkedHashSet<Resource>(matchingFiles.size());
|
||||
Set<Resource> result = new LinkedHashSet<>(matchingFiles.size());
|
||||
for (File file : matchingFiles) {
|
||||
result.add(new FileSystemResource(file));
|
||||
}
|
||||
@@ -730,7 +730,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||
fullPattern += "/";
|
||||
}
|
||||
fullPattern = fullPattern + StringUtils.replace(pattern, File.separator, "/");
|
||||
Set<File> result = new LinkedHashSet<File>(8);
|
||||
Set<File> result = new LinkedHashSet<>(8);
|
||||
doRetrieveMatchingFiles(fullPattern, rootDir, result);
|
||||
return result;
|
||||
}
|
||||
@@ -806,7 +806,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
|
||||
|
||||
private final String rootPath;
|
||||
|
||||
private final Set<Resource> resources = new LinkedHashSet<Resource>();
|
||||
private final Set<Resource> resources = new LinkedHashSet<>();
|
||||
|
||||
public PatternVirtualFileVisitor(String rootPath, String subPattern, PathMatcher pathMatcher) {
|
||||
this.subPattern = subPattern;
|
||||
|
||||
@@ -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.
|
||||
@@ -125,7 +125,7 @@ public class ResourceArrayPropertyEditor extends PropertyEditorSupport {
|
||||
public void setValue(Object value) throws IllegalArgumentException {
|
||||
if (value instanceof Collection || (value instanceof Object[] && !(value instanceof Resource[]))) {
|
||||
Collection<?> input = (value instanceof Collection ? (Collection<?>) value : Arrays.asList((Object[]) value));
|
||||
List<Resource> merged = new ArrayList<Resource>();
|
||||
List<Resource> merged = new ArrayList<>();
|
||||
for (Object element : input) {
|
||||
if (element instanceof String) {
|
||||
// A location pattern: resolve it into a Resource array.
|
||||
|
||||
@@ -88,7 +88,7 @@ public abstract class SpringFactoriesLoader {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Loaded [" + factoryClass.getName() + "] names: " + factoryNames);
|
||||
}
|
||||
List<T> result = new ArrayList<T>(factoryNames.size());
|
||||
List<T> result = new ArrayList<>(factoryNames.size());
|
||||
for (String factoryName : factoryNames) {
|
||||
result.add(instantiateFactory(factoryName, factoryClass, classLoaderToUse));
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public abstract class SpringFactoriesLoader {
|
||||
try {
|
||||
Enumeration<URL> urls = (classLoader != null ? classLoader.getResources(FACTORIES_RESOURCE_LOCATION) :
|
||||
ClassLoader.getSystemResources(FACTORIES_RESOURCE_LOCATION));
|
||||
List<String> result = new ArrayList<String>();
|
||||
List<String> result = new ArrayList<>();
|
||||
while (urls.hasMoreElements()) {
|
||||
URL url = urls.nextElement();
|
||||
Properties properties = PropertiesLoaderUtils.loadProperties(new UrlResource(url));
|
||||
|
||||
@@ -191,28 +191,28 @@ public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator implement
|
||||
|
||||
@Override
|
||||
public Future<?> submit(Runnable task) {
|
||||
FutureTask<Object> future = new FutureTask<Object>(task, null);
|
||||
FutureTask<Object> future = new FutureTask<>(task, null);
|
||||
execute(future, TIMEOUT_INDEFINITE);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
FutureTask<T> future = new FutureTask<T>(task);
|
||||
FutureTask<T> future = new FutureTask<>(task);
|
||||
execute(future, TIMEOUT_INDEFINITE);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenableFuture<?> submitListenable(Runnable task) {
|
||||
ListenableFutureTask<Object> future = new ListenableFutureTask<Object>(task, null);
|
||||
ListenableFutureTask<Object> future = new ListenableFutureTask<>(task, null);
|
||||
execute(future, TIMEOUT_INDEFINITE);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
|
||||
ListenableFutureTask<T> future = new ListenableFutureTask<T>(task);
|
||||
ListenableFutureTask<T> future = new ListenableFutureTask<>(task);
|
||||
execute(future, TIMEOUT_INDEFINITE);
|
||||
return future;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class TaskExecutorAdapter implements AsyncListenableTaskExecutor {
|
||||
return ((ExecutorService) this.concurrentExecutor).submit(task);
|
||||
}
|
||||
else {
|
||||
FutureTask<Object> future = new FutureTask<Object>(task, null);
|
||||
FutureTask<Object> future = new FutureTask<>(task, null);
|
||||
doExecute(this.concurrentExecutor, this.taskDecorator, future);
|
||||
return future;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public class TaskExecutorAdapter implements AsyncListenableTaskExecutor {
|
||||
return ((ExecutorService) this.concurrentExecutor).submit(task);
|
||||
}
|
||||
else {
|
||||
FutureTask<T> future = new FutureTask<T>(task);
|
||||
FutureTask<T> future = new FutureTask<>(task);
|
||||
doExecute(this.concurrentExecutor, this.taskDecorator, future);
|
||||
return future;
|
||||
}
|
||||
@@ -134,7 +134,7 @@ public class TaskExecutorAdapter implements AsyncListenableTaskExecutor {
|
||||
@Override
|
||||
public ListenableFuture<?> submitListenable(Runnable task) {
|
||||
try {
|
||||
ListenableFutureTask<Object> future = new ListenableFutureTask<Object>(task, null);
|
||||
ListenableFutureTask<Object> future = new ListenableFutureTask<>(task, null);
|
||||
doExecute(this.concurrentExecutor, this.taskDecorator, future);
|
||||
return future;
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public class TaskExecutorAdapter implements AsyncListenableTaskExecutor {
|
||||
@Override
|
||||
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
|
||||
try {
|
||||
ListenableFutureTask<T> future = new ListenableFutureTask<T>(task);
|
||||
ListenableFutureTask<T> future = new ListenableFutureTask<>(task);
|
||||
doExecute(this.concurrentExecutor, this.taskDecorator, future);
|
||||
return future;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -72,7 +72,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
|
||||
|
||||
@Override
|
||||
public Set<String> getAnnotationTypes() {
|
||||
Set<String> types = new LinkedHashSet<String>();
|
||||
Set<String> types = new LinkedHashSet<>();
|
||||
for (Annotation ann : this.annotations) {
|
||||
types.add(ann.annotationType().getName());
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
|
||||
public Set<MethodMetadata> getAnnotatedMethods(String annotationName) {
|
||||
try {
|
||||
Method[] methods = getIntrospectedClass().getDeclaredMethods();
|
||||
Set<MethodMetadata> annotatedMethods = new LinkedHashSet<MethodMetadata>();
|
||||
Set<MethodMetadata> annotatedMethods = new LinkedHashSet<>();
|
||||
for (Method method : methods) {
|
||||
if (!method.isBridge() && method.getAnnotations().length > 0 &&
|
||||
AnnotatedElementUtils.isAnnotated(method, annotationName)) {
|
||||
|
||||
@@ -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.
|
||||
@@ -121,7 +121,7 @@ public class StandardClassMetadata implements ClassMetadata {
|
||||
|
||||
@Override
|
||||
public String[] getMemberClassNames() {
|
||||
LinkedHashSet<String> memberClassNames = new LinkedHashSet<String>();
|
||||
LinkedHashSet<String> memberClassNames = new LinkedHashSet<>();
|
||||
for (Class<?> nestedClass : this.introspectedClass.getDeclaredClasses()) {
|
||||
memberClassNames.add(nestedClass.getName());
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ final class AnnotationAttributesReadingVisitor extends RecursiveAnnotationAttrib
|
||||
else {
|
||||
attributes.add(0, this.attributes);
|
||||
}
|
||||
Set<Annotation> visited = new LinkedHashSet<Annotation>();
|
||||
Set<Annotation> visited = new LinkedHashSet<>();
|
||||
Annotation[] metaAnnotations = AnnotationUtils.getAnnotations(annotationClass);
|
||||
if (!ObjectUtils.isEmpty(metaAnnotations)) {
|
||||
for (Annotation metaAnnotation : metaAnnotations) {
|
||||
@@ -82,7 +82,7 @@ final class AnnotationAttributesReadingVisitor extends RecursiveAnnotationAttrib
|
||||
}
|
||||
}
|
||||
if (this.metaAnnotationMap != null) {
|
||||
Set<String> metaAnnotationTypeNames = new LinkedHashSet<String>(visited.size());
|
||||
Set<String> metaAnnotationTypeNames = new LinkedHashSet<>(visited.size());
|
||||
for (Annotation ann : visited) {
|
||||
metaAnnotationTypeNames.add(ann.annotationType().getName());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,9 +50,9 @@ public class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisito
|
||||
|
||||
protected final ClassLoader classLoader;
|
||||
|
||||
protected final Set<String> annotationSet = new LinkedHashSet<String>(4);
|
||||
protected final Set<String> annotationSet = new LinkedHashSet<>(4);
|
||||
|
||||
protected final Map<String, Set<String>> metaAnnotationMap = new LinkedHashMap<String, Set<String>>(4);
|
||||
protected final Map<String, Set<String>> metaAnnotationMap = new LinkedHashMap<>(4);
|
||||
|
||||
/**
|
||||
* Declared as a {@link LinkedMultiValueMap} instead of a {@link MultiValueMap}
|
||||
@@ -60,9 +60,9 @@ public class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisito
|
||||
* @see AnnotationReadingVisitorUtils#getMergedAnnotationAttributes
|
||||
*/
|
||||
protected final LinkedMultiValueMap<String, AnnotationAttributes> attributesMap =
|
||||
new LinkedMultiValueMap<String, AnnotationAttributes>(4);
|
||||
new LinkedMultiValueMap<>(4);
|
||||
|
||||
protected final Set<MethodMetadata> methodMetadataSet = new LinkedHashSet<MethodMetadata>(4);
|
||||
protected final Set<MethodMetadata> methodMetadataSet = new LinkedHashSet<>(4);
|
||||
|
||||
|
||||
public AnnotationMetadataReadingVisitor(ClassLoader classLoader) {
|
||||
@@ -141,7 +141,7 @@ public class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisito
|
||||
|
||||
@Override
|
||||
public MultiValueMap<String, Object> getAllAnnotationAttributes(String annotationName, boolean classValuesAsString) {
|
||||
MultiValueMap<String, Object> allAttributes = new LinkedMultiValueMap<String, Object>();
|
||||
MultiValueMap<String, Object> allAttributes = new LinkedMultiValueMap<>();
|
||||
List<AnnotationAttributes> attributes = this.attributesMap.get(annotationName);
|
||||
if (attributes == null) {
|
||||
return null;
|
||||
@@ -167,7 +167,7 @@ public class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisito
|
||||
|
||||
@Override
|
||||
public Set<MethodMetadata> getAnnotatedMethods(String annotationName) {
|
||||
Set<MethodMetadata> annotatedMethods = new LinkedHashSet<MethodMetadata>(4);
|
||||
Set<MethodMetadata> annotatedMethods = new LinkedHashSet<>(4);
|
||||
for (MethodMetadata methodMetadata : this.methodMetadataSet) {
|
||||
if (methodMetadata.isAnnotated(annotationName)) {
|
||||
annotatedMethods.add(methodMetadata);
|
||||
|
||||
@@ -129,13 +129,13 @@ abstract class AnnotationReadingVisitorUtils {
|
||||
// method.
|
||||
AnnotationAttributes results = new AnnotationAttributes(attributesList.get(0));
|
||||
|
||||
Set<String> overridableAttributeNames = new HashSet<String>(results.keySet());
|
||||
Set<String> overridableAttributeNames = new HashSet<>(results.keySet());
|
||||
overridableAttributeNames.remove(AnnotationUtils.VALUE);
|
||||
|
||||
// Since the map is a LinkedMultiValueMap, we depend on the ordering of
|
||||
// elements in the map and reverse the order of the keys in order to traverse
|
||||
// "down" the annotation hierarchy.
|
||||
List<String> annotationTypes = new ArrayList<String>(attributesMap.keySet());
|
||||
List<String> annotationTypes = new ArrayList<>(attributesMap.keySet());
|
||||
Collections.reverse(annotationTypes);
|
||||
|
||||
// No need to revisit the target annotation type:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,7 +61,7 @@ class ClassMetadataReadingVisitor extends ClassVisitor implements ClassMetadata
|
||||
|
||||
private String[] interfaces;
|
||||
|
||||
private Set<String> memberClassNames = new LinkedHashSet<String>();
|
||||
private Set<String> memberClassNames = new LinkedHashSet<>();
|
||||
|
||||
|
||||
public ClassMetadataReadingVisitor() {
|
||||
|
||||
@@ -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,10 +56,10 @@ public class MethodMetadataReadingVisitor extends MethodVisitor implements Metho
|
||||
|
||||
protected final Set<MethodMetadata> methodMetadataSet;
|
||||
|
||||
protected final Map<String, Set<String>> metaAnnotationMap = new LinkedHashMap<String, Set<String>>(4);
|
||||
protected final Map<String, Set<String>> metaAnnotationMap = new LinkedHashMap<>(4);
|
||||
|
||||
protected final LinkedMultiValueMap<String, AnnotationAttributes> attributesMap =
|
||||
new LinkedMultiValueMap<String, AnnotationAttributes>(4);
|
||||
new LinkedMultiValueMap<>(4);
|
||||
|
||||
|
||||
public MethodMetadataReadingVisitor(String methodName, int access, String declaringClassName,
|
||||
@@ -135,7 +135,7 @@ public class MethodMetadataReadingVisitor extends MethodVisitor implements Metho
|
||||
if (!this.attributesMap.containsKey(annotationName)) {
|
||||
return null;
|
||||
}
|
||||
MultiValueMap<String, Object> allAttributes = new LinkedMultiValueMap<String, Object>();
|
||||
MultiValueMap<String, Object> allAttributes = new LinkedMultiValueMap<>();
|
||||
for (AnnotationAttributes annotationAttributes : this.attributesMap.get(annotationName)) {
|
||||
for (Map.Entry<String, Object> entry : AnnotationReadingVisitorUtils.convertClassValues(
|
||||
this.classLoader, annotationAttributes, classValuesAsString).entrySet()) {
|
||||
|
||||
@@ -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.
|
||||
@@ -34,7 +34,7 @@ class RecursiveAnnotationArrayVisitor extends AbstractRecursiveAnnotationVisitor
|
||||
|
||||
private final String attributeName;
|
||||
|
||||
private final List<AnnotationAttributes> allNestedAttributes = new ArrayList<AnnotationAttributes>();
|
||||
private final List<AnnotationAttributes> allNestedAttributes = new ArrayList<>();
|
||||
|
||||
|
||||
public RecursiveAnnotationArrayVisitor(
|
||||
|
||||
@@ -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.
|
||||
@@ -47,7 +47,7 @@ public class SpringObjenesis implements Objenesis {
|
||||
private final InstantiatorStrategy strategy;
|
||||
|
||||
private final ConcurrentReferenceHashMap<Class<?>, ObjectInstantiator<?>> cache =
|
||||
new ConcurrentReferenceHashMap<Class<?>, ObjectInstantiator<?>>();
|
||||
new ConcurrentReferenceHashMap<>();
|
||||
|
||||
private volatile Boolean worthTrying;
|
||||
|
||||
|
||||
@@ -87,9 +87,9 @@ public class AntPathMatcher implements PathMatcher {
|
||||
|
||||
private volatile Boolean cachePatterns;
|
||||
|
||||
private final Map<String, String[]> tokenizedPatternCache = new ConcurrentHashMap<String, String[]>(256);
|
||||
private final Map<String, String[]> tokenizedPatternCache = new ConcurrentHashMap<>(256);
|
||||
|
||||
final Map<String, AntPathStringMatcher> stringMatcherCache = new ConcurrentHashMap<String, AntPathStringMatcher>(256);
|
||||
final Map<String, AntPathStringMatcher> stringMatcherCache = new ConcurrentHashMap<>(256);
|
||||
|
||||
|
||||
/**
|
||||
@@ -487,7 +487,7 @@ public class AntPathMatcher implements PathMatcher {
|
||||
|
||||
@Override
|
||||
public Map<String, String> extractUriTemplateVariables(String pattern, String path) {
|
||||
Map<String, String> variables = new LinkedHashMap<String, String>();
|
||||
Map<String, String> variables = new LinkedHashMap<>();
|
||||
boolean result = doMatch(pattern, path, true, variables);
|
||||
if (!result) {
|
||||
throw new IllegalStateException("Pattern \"" + pattern + "\" is not a match for \"" + path + "\"");
|
||||
@@ -623,7 +623,7 @@ public class AntPathMatcher implements PathMatcher {
|
||||
|
||||
private final Pattern pattern;
|
||||
|
||||
private final List<String> variableNames = new LinkedList<String>();
|
||||
private final List<String> variableNames = new LinkedList<>();
|
||||
|
||||
public AntPathStringMatcher(String pattern) {
|
||||
this(pattern, true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -60,7 +60,7 @@ public class AutoPopulatingList<E> implements List<E>, Serializable {
|
||||
* to the backing {@link List} on demand.
|
||||
*/
|
||||
public AutoPopulatingList(Class<? extends E> elementClass) {
|
||||
this(new ArrayList<E>(), elementClass);
|
||||
this(new ArrayList<>(), elementClass);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,7 +69,7 @@ public class AutoPopulatingList<E> implements List<E>, Serializable {
|
||||
* {@link List} on demand.
|
||||
*/
|
||||
public AutoPopulatingList(List<E> backingList, Class<? extends E> elementClass) {
|
||||
this(backingList, new ReflectiveElementFactory<E>(elementClass));
|
||||
this(backingList, new ReflectiveElementFactory<>(elementClass));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ public class AutoPopulatingList<E> implements List<E>, Serializable {
|
||||
* {@link ArrayList} and creates new elements on demand using the supplied {@link ElementFactory}.
|
||||
*/
|
||||
public AutoPopulatingList(ElementFactory<E> elementFactory) {
|
||||
this(new ArrayList<E>(), elementFactory);
|
||||
this(new ArrayList<>(), elementFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -76,25 +76,25 @@ public abstract class ClassUtils {
|
||||
* Map with primitive wrapper type as key and corresponding primitive
|
||||
* type as value, for example: Integer.class -> int.class.
|
||||
*/
|
||||
private static final Map<Class<?>, Class<?>> primitiveWrapperTypeMap = new IdentityHashMap<Class<?>, Class<?>>(8);
|
||||
private static final Map<Class<?>, Class<?>> primitiveWrapperTypeMap = new IdentityHashMap<>(8);
|
||||
|
||||
/**
|
||||
* Map with primitive type as key and corresponding wrapper
|
||||
* type as value, for example: int.class -> Integer.class.
|
||||
*/
|
||||
private static final Map<Class<?>, Class<?>> primitiveTypeToWrapperMap = new IdentityHashMap<Class<?>, Class<?>>(8);
|
||||
private static final Map<Class<?>, Class<?>> primitiveTypeToWrapperMap = new IdentityHashMap<>(8);
|
||||
|
||||
/**
|
||||
* Map with primitive type name as key and corresponding primitive
|
||||
* type as value, for example: "int" -> "int.class".
|
||||
*/
|
||||
private static final Map<String, Class<?>> primitiveTypeNameMap = new HashMap<String, Class<?>>(32);
|
||||
private static final Map<String, Class<?>> primitiveTypeNameMap = new HashMap<>(32);
|
||||
|
||||
/**
|
||||
* Map with common "java.lang" class name as key and corresponding Class as value.
|
||||
* Primarily for efficient deserialization of remote invocations.
|
||||
*/
|
||||
private static final Map<String, Class<?>> commonClassCache = new HashMap<String, Class<?>>(32);
|
||||
private static final Map<String, Class<?>> commonClassCache = new HashMap<>(32);
|
||||
|
||||
|
||||
static {
|
||||
@@ -112,7 +112,7 @@ public abstract class ClassUtils {
|
||||
registerCommonClasses(entry.getKey());
|
||||
}
|
||||
|
||||
Set<Class<?>> primitiveTypes = new HashSet<Class<?>>(32);
|
||||
Set<Class<?>> primitiveTypes = new HashSet<>(32);
|
||||
primitiveTypes.addAll(primitiveWrapperTypeMap.values());
|
||||
primitiveTypes.addAll(Arrays.asList(new Class<?>[] {
|
||||
boolean[].class, byte[].class, char[].class, double[].class,
|
||||
@@ -629,7 +629,7 @@ public abstract class ClassUtils {
|
||||
}
|
||||
}
|
||||
else {
|
||||
Set<Method> candidates = new HashSet<Method>(1);
|
||||
Set<Method> candidates = new HashSet<>(1);
|
||||
Method[] methods = clazz.getMethods();
|
||||
for (Method method : methods) {
|
||||
if (methodName.equals(method.getName())) {
|
||||
@@ -673,7 +673,7 @@ public abstract class ClassUtils {
|
||||
}
|
||||
}
|
||||
else {
|
||||
Set<Method> candidates = new HashSet<Method>(1);
|
||||
Set<Method> candidates = new HashSet<>(1);
|
||||
Method[] methods = clazz.getMethods();
|
||||
for (Method method : methods) {
|
||||
if (methodName.equals(method.getName())) {
|
||||
@@ -1136,7 +1136,7 @@ public abstract class ClassUtils {
|
||||
if (clazz.isInterface() && isVisible(clazz, classLoader)) {
|
||||
return Collections.<Class<?>>singleton(clazz);
|
||||
}
|
||||
Set<Class<?>> interfaces = new LinkedHashSet<Class<?>>();
|
||||
Set<Class<?>> interfaces = new LinkedHashSet<>();
|
||||
while (clazz != null) {
|
||||
Class<?>[] ifcs = clazz.getInterfaces();
|
||||
for (Class<?> ifc : ifcs) {
|
||||
|
||||
@@ -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.
|
||||
@@ -318,7 +318,7 @@ public abstract class CollectionUtils {
|
||||
* returned will be a different instance than the array given.
|
||||
*/
|
||||
public static <A, E extends A> A[] toArray(Enumeration<E> enumeration, A[] array) {
|
||||
ArrayList<A> elements = new ArrayList<A>();
|
||||
ArrayList<A> elements = new ArrayList<>();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
elements.add(enumeration.nextElement());
|
||||
}
|
||||
@@ -331,7 +331,7 @@ public abstract class CollectionUtils {
|
||||
* @return the iterator
|
||||
*/
|
||||
public static <E> Iterator<E> toIterator(Enumeration<E> enumeration) {
|
||||
return new EnumerationIterator<E>(enumeration);
|
||||
return new EnumerationIterator<>(enumeration);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,7 +341,7 @@ public abstract class CollectionUtils {
|
||||
* @since 3.1
|
||||
*/
|
||||
public static <K, V> MultiValueMap<K, V> toMultiValueMap(Map<K, List<V>> map) {
|
||||
return new MultiValueMapAdapter<K, V>(map);
|
||||
return new MultiValueMapAdapter<>(map);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -353,7 +353,7 @@ public abstract class CollectionUtils {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <K, V> MultiValueMap<K, V> unmodifiableMultiValueMap(MultiValueMap<? extends K, ? extends V> map) {
|
||||
Assert.notNull(map, "'map' must not be null");
|
||||
Map<K, List<V>> result = new LinkedHashMap<K, List<V>>(map.size());
|
||||
Map<K, List<V>> result = new LinkedHashMap<>(map.size());
|
||||
for (Map.Entry<? extends K, ? extends List<? extends V>> entry : map.entrySet()) {
|
||||
List<? extends V> values = Collections.unmodifiableList(entry.getValue());
|
||||
result.put(entry.getKey(), (List<V>) values);
|
||||
@@ -408,7 +408,7 @@ public abstract class CollectionUtils {
|
||||
public void add(K key, V value) {
|
||||
List<V> values = this.map.get(key);
|
||||
if (values == null) {
|
||||
values = new LinkedList<V>();
|
||||
values = new LinkedList<>();
|
||||
this.map.put(key, values);
|
||||
}
|
||||
values.add(value);
|
||||
@@ -422,7 +422,7 @@ public abstract class CollectionUtils {
|
||||
|
||||
@Override
|
||||
public void set(K key, V value) {
|
||||
List<V> values = new LinkedList<V>();
|
||||
List<V> values = new LinkedList<>();
|
||||
values.add(value);
|
||||
this.map.put(key, values);
|
||||
}
|
||||
@@ -436,7 +436,7 @@ public abstract class CollectionUtils {
|
||||
|
||||
@Override
|
||||
public Map<K, V> toSingleValueMap() {
|
||||
LinkedHashMap<K, V> singleValueMap = new LinkedHashMap<K,V>(this.map.size());
|
||||
LinkedHashMap<K, V> singleValueMap = new LinkedHashMap<>(this.map.size());
|
||||
for (Entry<K, List<V>> entry : map.entrySet()) {
|
||||
singleValueMap.put(entry.getKey(), entry.getValue().get(0));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -34,7 +34,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class CompositeIterator<E> implements Iterator<E> {
|
||||
|
||||
private final Set<Iterator<E>> iterators = new LinkedHashSet<Iterator<E>>();
|
||||
private final Set<Iterator<E>> iterators = new LinkedHashSet<>();
|
||||
|
||||
private boolean inUse = false;
|
||||
|
||||
|
||||
@@ -483,7 +483,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
@Override
|
||||
public void add(V value) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Entry<K, V> newEntry = new Entry<K, V>((K) key, value);
|
||||
Entry<K, V> newEntry = new Entry<>((K) key, value);
|
||||
Reference<K, V> newReference = Segment.this.referenceManager.createReference(newEntry, hash, head);
|
||||
Segment.this.references[index] = newReference;
|
||||
Segment.this.count++;
|
||||
@@ -532,7 +532,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
|
||||
Set<Reference<K, V>> toPurge = Collections.emptySet();
|
||||
if (reference != null) {
|
||||
toPurge = new HashSet<Reference<K, V>>();
|
||||
toPurge = new HashSet<>();
|
||||
while (reference != null) {
|
||||
toPurge.add(reference);
|
||||
reference = this.referenceManager.pollForPurge();
|
||||
@@ -924,7 +924,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
*/
|
||||
protected class ReferenceManager {
|
||||
|
||||
private final ReferenceQueue<Entry<K, V>> queue = new ReferenceQueue<Entry<K, V>>();
|
||||
private final ReferenceQueue<Entry<K, V>> queue = new ReferenceQueue<>();
|
||||
|
||||
/**
|
||||
* Factory method used to create a new {@link Reference}.
|
||||
@@ -935,9 +935,9 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
*/
|
||||
public Reference<K, V> createReference(Entry<K, V> entry, int hash, Reference<K, V> next) {
|
||||
if (ConcurrentReferenceHashMap.this.referenceType == ReferenceType.WEAK) {
|
||||
return new WeakEntryReference<K, V>(entry, hash, next, this.queue);
|
||||
return new WeakEntryReference<>(entry, hash, next, this.queue);
|
||||
}
|
||||
return new SoftEntryReference<K, V>(entry, hash, next, this.queue);
|
||||
return new SoftEntryReference<>(entry, hash, next, this.queue);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,7 +48,7 @@ public class FastByteArrayOutputStream extends OutputStream {
|
||||
|
||||
|
||||
// The buffers used to store the content bytes
|
||||
private final LinkedList<byte[]> buffers = new LinkedList<byte[]>();
|
||||
private final LinkedList<byte[]> buffers = new LinkedList<>();
|
||||
|
||||
// The size, in bytes, to use when allocating the first byte[]
|
||||
private final int initialBlockSize;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class LinkedCaseInsensitiveMap<V> extends LinkedHashMap<String, V> {
|
||||
*/
|
||||
public LinkedCaseInsensitiveMap(Locale locale) {
|
||||
super();
|
||||
this.caseInsensitiveKeys = new HashMap<String, String>();
|
||||
this.caseInsensitiveKeys = new HashMap<>();
|
||||
this.locale = (locale != null ? locale : Locale.getDefault());
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class LinkedCaseInsensitiveMap<V> extends LinkedHashMap<String, V> {
|
||||
*/
|
||||
public LinkedCaseInsensitiveMap(int initialCapacity, Locale locale) {
|
||||
super(initialCapacity);
|
||||
this.caseInsensitiveKeys = new HashMap<String, String>(initialCapacity);
|
||||
this.caseInsensitiveKeys = new HashMap<>(initialCapacity);
|
||||
this.locale = (locale != null ? locale : Locale.getDefault());
|
||||
}
|
||||
|
||||
|
||||
@@ -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 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
* Create a new LinkedMultiValueMap that wraps a {@link LinkedHashMap}.
|
||||
*/
|
||||
public LinkedMultiValueMap() {
|
||||
this.targetMap = new LinkedHashMap<K, List<V>>();
|
||||
this.targetMap = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
* @param initialCapacity the initial capacity
|
||||
*/
|
||||
public LinkedMultiValueMap(int initialCapacity) {
|
||||
this.targetMap = new LinkedHashMap<K, List<V>>(initialCapacity);
|
||||
this.targetMap = new LinkedHashMap<>(initialCapacity);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
* @see #deepCopy()
|
||||
*/
|
||||
public LinkedMultiValueMap(Map<K, List<V>> otherMap) {
|
||||
this.targetMap = new LinkedHashMap<K, List<V>>(otherMap);
|
||||
this.targetMap = new LinkedHashMap<>(otherMap);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
public void add(K key, V value) {
|
||||
List<V> values = this.targetMap.get(key);
|
||||
if (values == null) {
|
||||
values = new LinkedList<V>();
|
||||
values = new LinkedList<>();
|
||||
this.targetMap.put(key, values);
|
||||
}
|
||||
values.add(value);
|
||||
@@ -91,7 +91,7 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
|
||||
@Override
|
||||
public void set(K key, V value) {
|
||||
List<V> values = new LinkedList<V>();
|
||||
List<V> values = new LinkedList<>();
|
||||
values.add(value);
|
||||
this.targetMap.put(key, values);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
|
||||
@Override
|
||||
public Map<K, V> toSingleValueMap() {
|
||||
LinkedHashMap<K, V> singleValueMap = new LinkedHashMap<K,V>(this.targetMap.size());
|
||||
LinkedHashMap<K, V> singleValueMap = new LinkedHashMap<>(this.targetMap.size());
|
||||
for (Entry<K, List<V>> entry : this.targetMap.entrySet()) {
|
||||
singleValueMap.put(entry.getKey(), entry.getValue().get(0));
|
||||
}
|
||||
@@ -185,7 +185,7 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
*/
|
||||
@Override
|
||||
public LinkedMultiValueMap<K, V> clone() {
|
||||
return new LinkedMultiValueMap<K, V>(this);
|
||||
return new LinkedMultiValueMap<>(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,9 +195,9 @@ public class LinkedMultiValueMap<K, V> implements MultiValueMap<K, V>, Serializa
|
||||
* @see #clone()
|
||||
*/
|
||||
public LinkedMultiValueMap<K, V> deepCopy() {
|
||||
LinkedMultiValueMap<K, V> copy = new LinkedMultiValueMap<K, V>(this.targetMap.size());
|
||||
LinkedMultiValueMap<K, V> copy = new LinkedMultiValueMap<>(this.targetMap.size());
|
||||
for (Map.Entry<K, List<V>> entry : this.targetMap.entrySet()) {
|
||||
copy.put(entry.getKey(), new LinkedList<V>(entry.getValue()));
|
||||
copy.put(entry.getKey(), new LinkedList<>(entry.getValue()));
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
||||
this.type = type.toLowerCase(Locale.ENGLISH);
|
||||
this.subtype = subtype.toLowerCase(Locale.ENGLISH);
|
||||
if (!CollectionUtils.isEmpty(parameters)) {
|
||||
Map<String, String> map = new LinkedCaseInsensitiveMap<String>(parameters.size(), Locale.ENGLISH);
|
||||
Map<String, String> map = new LinkedCaseInsensitiveMap<>(parameters.size(), Locale.ENGLISH);
|
||||
for (Map.Entry<String, String> entry : parameters.entrySet()) {
|
||||
String attribute = entry.getKey();
|
||||
String value = entry.getValue();
|
||||
@@ -482,9 +482,9 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
||||
if (comp != 0) {
|
||||
return comp;
|
||||
}
|
||||
TreeSet<String> thisAttributes = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||
TreeSet<String> thisAttributes = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||
thisAttributes.addAll(getParameters().keySet());
|
||||
TreeSet<String> otherAttributes = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||
TreeSet<String> otherAttributes = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||
otherAttributes.addAll(other.getParameters().keySet());
|
||||
Iterator<String> thisAttributesIterator = thisAttributes.iterator();
|
||||
Iterator<String> otherAttributesIterator = otherAttributes.iterator();
|
||||
@@ -520,7 +520,7 @@ public class MimeType implements Comparable<MimeType>, Serializable {
|
||||
}
|
||||
|
||||
private static Map<String, String> addCharsetParameter(Charset charset, Map<String, String> parameters) {
|
||||
Map<String, String> map = new LinkedHashMap<String, String>(parameters);
|
||||
Map<String, String> map = new LinkedHashMap<>(parameters);
|
||||
map.put(PARAM_CHARSET, charset.name());
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ public abstract class MimeTypeUtils {
|
||||
|
||||
Map<String, String> parameters = null;
|
||||
if (parts.length > 1) {
|
||||
parameters = new LinkedHashMap<String, String>(parts.length - 1);
|
||||
parameters = new LinkedHashMap<>(parts.length - 1);
|
||||
for (int i = 1; i < parts.length; i++) {
|
||||
String parameter = parts[i];
|
||||
int eqIndex = parameter.indexOf('=');
|
||||
@@ -278,7 +278,7 @@ public abstract class MimeTypeUtils {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
String[] tokens = mimeTypes.split(",\\s*");
|
||||
List<MimeType> result = new ArrayList<MimeType>(tokens.length);
|
||||
List<MimeType> result = new ArrayList<>(tokens.length);
|
||||
for (String token : tokens) {
|
||||
result.add(parseMimeType(token));
|
||||
}
|
||||
@@ -358,6 +358,6 @@ public abstract class MimeTypeUtils {
|
||||
/**
|
||||
* Comparator used by {@link #sortBySpecificity(List)}.
|
||||
*/
|
||||
public static final Comparator<MimeType> SPECIFICITY_COMPARATOR = new SpecificityComparator<MimeType>();
|
||||
public static final Comparator<MimeType> SPECIFICITY_COMPARATOR = new SpecificityComparator<>();
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class NumberUtils {
|
||||
public static final Set<Class<?>> STANDARD_NUMBER_TYPES;
|
||||
|
||||
static {
|
||||
Set<Class<?>> numberTypes = new HashSet<Class<?>>(8);
|
||||
Set<Class<?>> numberTypes = new HashSet<>(8);
|
||||
numberTypes.add(Byte.class);
|
||||
numberTypes.add(Short.class);
|
||||
numberTypes.add(Integer.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,7 +39,7 @@ public class PropertyPlaceholderHelper {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(PropertyPlaceholderHelper.class);
|
||||
|
||||
private static final Map<String, String> wellKnownSimplePrefixes = new HashMap<String, String>(4);
|
||||
private static final Map<String, String> wellKnownSimplePrefixes = new HashMap<>(4);
|
||||
|
||||
static {
|
||||
wellKnownSimplePrefixes.put("}", "{");
|
||||
@@ -123,7 +123,7 @@ public class PropertyPlaceholderHelper {
|
||||
*/
|
||||
public String replacePlaceholders(String value, PlaceholderResolver placeholderResolver) {
|
||||
Assert.notNull(value, "'value' must not be null");
|
||||
return parseStringValue(value, placeholderResolver, new HashSet<String>());
|
||||
return parseStringValue(value, placeholderResolver, new HashSet<>());
|
||||
}
|
||||
|
||||
protected String parseStringValue(
|
||||
|
||||
@@ -61,13 +61,13 @@ public abstract class ReflectionUtils {
|
||||
* from Java 8 based interfaces, allowing for fast iteration.
|
||||
*/
|
||||
private static final Map<Class<?>, Method[]> declaredMethodsCache =
|
||||
new ConcurrentReferenceHashMap<Class<?>, Method[]>(256);
|
||||
new ConcurrentReferenceHashMap<>(256);
|
||||
|
||||
/**
|
||||
* Cache for {@link Class#getDeclaredFields()}, allowing for fast iteration.
|
||||
*/
|
||||
private static final Map<Class<?>, Field[]> declaredFieldsCache =
|
||||
new ConcurrentReferenceHashMap<Class<?>, Field[]>(256);
|
||||
new ConcurrentReferenceHashMap<>(256);
|
||||
|
||||
|
||||
/**
|
||||
@@ -549,7 +549,7 @@ public abstract class ReflectionUtils {
|
||||
* @param leafClass the class to introspect
|
||||
*/
|
||||
public static Method[] getAllDeclaredMethods(Class<?> leafClass) {
|
||||
final List<Method> methods = new ArrayList<Method>(32);
|
||||
final List<Method> methods = new ArrayList<>(32);
|
||||
doWithMethods(leafClass, new MethodCallback() {
|
||||
@Override
|
||||
public void doWith(Method method) {
|
||||
@@ -566,7 +566,7 @@ public abstract class ReflectionUtils {
|
||||
* @param leafClass the class to introspect
|
||||
*/
|
||||
public static Method[] getUniqueDeclaredMethods(Class<?> leafClass) {
|
||||
final List<Method> methods = new ArrayList<Method>(32);
|
||||
final List<Method> methods = new ArrayList<>(32);
|
||||
doWithMethods(leafClass, new MethodCallback() {
|
||||
@Override
|
||||
public void doWith(Method method) {
|
||||
@@ -634,7 +634,7 @@ public abstract class ReflectionUtils {
|
||||
for (Method ifcMethod : ifc.getMethods()) {
|
||||
if (!Modifier.isAbstract(ifcMethod.getModifiers())) {
|
||||
if (result == null) {
|
||||
result = new LinkedList<Method>();
|
||||
result = new LinkedList<>();
|
||||
}
|
||||
result.add(ifcMethod);
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ public class SocketUtils {
|
||||
Assert.isTrue((maxPort - minPort) >= numRequested,
|
||||
"'numRequested' must not be greater than 'maxPort' - 'minPort'");
|
||||
|
||||
SortedSet<Integer> availablePorts = new TreeSet<Integer>();
|
||||
SortedSet<Integer> availablePorts = new TreeSet<>();
|
||||
int attemptCount = 0;
|
||||
while ((++attemptCount <= numRequested + 100) && availablePorts.size() < numRequested) {
|
||||
availablePorts.add(findAvailablePort(minPort, maxPort));
|
||||
|
||||
@@ -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.
|
||||
@@ -49,7 +49,7 @@ public class StopWatch {
|
||||
|
||||
private boolean keepTaskList = true;
|
||||
|
||||
private final List<TaskInfo> taskList = new LinkedList<TaskInfo>();
|
||||
private final List<TaskInfo> taskList = new LinkedList<>();
|
||||
|
||||
/** Start time of the current task */
|
||||
private long startTimeMillis;
|
||||
|
||||
@@ -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.
|
||||
@@ -640,7 +640,7 @@ public abstract class StringUtils {
|
||||
}
|
||||
|
||||
String[] pathArray = delimitedListToStringArray(pathToUse, FOLDER_SEPARATOR);
|
||||
List<String> pathElements = new LinkedList<String>();
|
||||
List<String> pathElements = new LinkedList<>();
|
||||
int tops = 0;
|
||||
|
||||
for (int i = pathArray.length - 1; i >= 0; i--) {
|
||||
@@ -808,7 +808,7 @@ public abstract class StringUtils {
|
||||
if (ObjectUtils.isEmpty(array2)) {
|
||||
return array1;
|
||||
}
|
||||
List<String> result = new ArrayList<String>();
|
||||
List<String> result = new ArrayList<>();
|
||||
result.addAll(Arrays.asList(array1));
|
||||
for (String str : array2) {
|
||||
if (!result.contains(str)) {
|
||||
@@ -888,7 +888,7 @@ public abstract class StringUtils {
|
||||
if (ObjectUtils.isEmpty(array)) {
|
||||
return array;
|
||||
}
|
||||
Set<String> set = new LinkedHashSet<String>();
|
||||
Set<String> set = new LinkedHashSet<>();
|
||||
for (String element : array) {
|
||||
set.add(element);
|
||||
}
|
||||
@@ -1013,7 +1013,7 @@ public abstract class StringUtils {
|
||||
return null;
|
||||
}
|
||||
StringTokenizer st = new StringTokenizer(str, delimiters);
|
||||
List<String> tokens = new ArrayList<String>();
|
||||
List<String> tokens = new ArrayList<>();
|
||||
while (st.hasMoreTokens()) {
|
||||
String token = st.nextToken();
|
||||
if (trimTokens) {
|
||||
@@ -1065,7 +1065,7 @@ public abstract class StringUtils {
|
||||
if (delimiter == null) {
|
||||
return new String[] {str};
|
||||
}
|
||||
List<String> result = new ArrayList<String>();
|
||||
List<String> result = new ArrayList<>();
|
||||
if ("".equals(delimiter)) {
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
result.add(deleteAny(str.substring(i, i + 1), charsToDelete));
|
||||
@@ -1105,7 +1105,7 @@ public abstract class StringUtils {
|
||||
* @see #removeDuplicateStrings(String[])
|
||||
*/
|
||||
public static Set<String> commaDelimitedListToSet(String str) {
|
||||
Set<String> set = new LinkedHashSet<String>();
|
||||
Set<String> set = new LinkedHashSet<>();
|
||||
String[] tokens = commaDelimitedListToStringArray(str);
|
||||
for (String token : tokens) {
|
||||
set.add(token);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,10 +50,10 @@ public class WeakReferenceMonitor {
|
||||
private static final Log logger = LogFactory.getLog(WeakReferenceMonitor.class);
|
||||
|
||||
// Queue receiving reachability events
|
||||
private static final ReferenceQueue<Object> handleQueue = new ReferenceQueue<Object>();
|
||||
private static final ReferenceQueue<Object> handleQueue = new ReferenceQueue<>();
|
||||
|
||||
// All tracked entries (WeakReference => ReleaseListener)
|
||||
private static final Map<Reference<?>, ReleaseListener> trackedEntries = new HashMap<Reference<?>, ReleaseListener>();
|
||||
private static final Map<Reference<?>, ReleaseListener> trackedEntries = new HashMap<>();
|
||||
|
||||
// Thread polling handleQueue, lazy initialized
|
||||
private static Thread monitoringThread = null;
|
||||
@@ -72,7 +72,7 @@ public class WeakReferenceMonitor {
|
||||
|
||||
// Make weak reference to this handle, so we can say when
|
||||
// handle is not used any more by polling on handleQueue.
|
||||
WeakReference<Object> weakRef = new WeakReference<Object>(handle, handleQueue);
|
||||
WeakReference<Object> weakRef = new WeakReference<>(handle, handleQueue);
|
||||
|
||||
// Add monitored entry to internal map of all monitored entries.
|
||||
addEntry(weakRef, listener);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -49,7 +49,7 @@ public class CompoundComparator<T> implements Comparator<T>, Serializable {
|
||||
* IllegalStateException is thrown.
|
||||
*/
|
||||
public CompoundComparator() {
|
||||
this.comparators = new ArrayList<InvertibleComparator>();
|
||||
this.comparators = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ public class CompoundComparator<T> implements Comparator<T>, Serializable {
|
||||
@SuppressWarnings("unchecked")
|
||||
public CompoundComparator(Comparator... comparators) {
|
||||
Assert.notNull(comparators, "Comparators must not be null");
|
||||
this.comparators = new ArrayList<InvertibleComparator>(comparators.length);
|
||||
this.comparators = new ArrayList<>(comparators.length);
|
||||
for (Comparator comparator : comparators) {
|
||||
this.addComparator(comparator);
|
||||
}
|
||||
@@ -121,7 +121,7 @@ public class CompoundComparator<T> implements Comparator<T>, Serializable {
|
||||
* @param ascending the sort order: ascending (true) or descending (false)
|
||||
*/
|
||||
public void setComparator(int index, Comparator<T> comparator, boolean ascending) {
|
||||
this.comparators.set(index, new InvertibleComparator<T>(comparator, ascending));
|
||||
this.comparators.set(index, new InvertibleComparator<>(comparator, ascending));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,14 +36,14 @@ public class NullSafeComparator<T> implements Comparator<T> {
|
||||
* than non-null objects.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final NullSafeComparator NULLS_LOW = new NullSafeComparator<Object>(true);
|
||||
public static final NullSafeComparator NULLS_LOW = new NullSafeComparator<>(true);
|
||||
|
||||
/**
|
||||
* A shared default instance of this comparator, treating nulls higher
|
||||
* than non-null objects.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final NullSafeComparator NULLS_HIGH = new NullSafeComparator<Object>(false);
|
||||
public static final NullSafeComparator NULLS_HIGH = new NullSafeComparator<>(false);
|
||||
|
||||
private final Comparator<T> nonNullComparator;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class CompletableToListenableFutureAdapter<T> implements ListenableFuture
|
||||
|
||||
private final CompletableFuture<T> completableFuture;
|
||||
|
||||
private final ListenableFutureCallbackRegistry<T> callbacks = new ListenableFutureCallbackRegistry<T>();
|
||||
private final ListenableFutureCallbackRegistry<T> callbacks = new ListenableFutureCallbackRegistry<>();
|
||||
|
||||
|
||||
public CompletableToListenableFutureAdapter(CompletableFuture<T> completableFuture) {
|
||||
|
||||
@@ -34,9 +34,9 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class ListenableFutureCallbackRegistry<T> {
|
||||
|
||||
private final Queue<SuccessCallback<? super T>> successCallbacks = new LinkedList<SuccessCallback<? super T>>();
|
||||
private final Queue<SuccessCallback<? super T>> successCallbacks = new LinkedList<>();
|
||||
|
||||
private final Queue<FailureCallback> failureCallbacks = new LinkedList<FailureCallback>();
|
||||
private final Queue<FailureCallback> failureCallbacks = new LinkedList<>();
|
||||
|
||||
private State state = State.NEW;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -28,7 +28,7 @@ import java.util.concurrent.FutureTask;
|
||||
*/
|
||||
public class ListenableFutureTask<T> extends FutureTask<T> implements ListenableFuture<T> {
|
||||
|
||||
private final ListenableFutureCallbackRegistry<T> callbacks = new ListenableFutureCallbackRegistry<T>();
|
||||
private final ListenableFutureCallbackRegistry<T> callbacks = new ListenableFutureCallbackRegistry<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,8 +44,8 @@ public class SettableListenableFuture<T> implements ListenableFuture<T> {
|
||||
|
||||
|
||||
public SettableListenableFuture() {
|
||||
this.settableTask = new SettableTask<T>();
|
||||
this.listenableFuture = new ListenableFutureTask<T>(this.settableTask);
|
||||
this.settableTask = new SettableTask<>();
|
||||
this.listenableFuture = new ListenableFutureTask<>(this.settableTask);
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ public class SettableListenableFuture<T> implements ListenableFuture<T> {
|
||||
|
||||
private static final Object NO_VALUE = new Object();
|
||||
|
||||
private final AtomicReference<Object> value = new AtomicReference<Object>(NO_VALUE);
|
||||
private final AtomicReference<Object> value = new AtomicReference<>(NO_VALUE);
|
||||
|
||||
private volatile boolean cancelled = false;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,7 +40,7 @@ import org.xml.sax.ext.LexicalHandler;
|
||||
*/
|
||||
abstract class AbstractStaxHandler implements ContentHandler, LexicalHandler {
|
||||
|
||||
private final List<Map<String, String>> namespaceMappings = new ArrayList<Map<String, String>>();
|
||||
private final List<Map<String, String>> namespaceMappings = new ArrayList<>();
|
||||
|
||||
private boolean inCData;
|
||||
|
||||
@@ -233,7 +233,7 @@ abstract class AbstractStaxHandler implements ContentHandler, LexicalHandler {
|
||||
}
|
||||
|
||||
private void newNamespaceMapping() {
|
||||
this.namespaceMappings.add(new HashMap<String, String>());
|
||||
this.namespaceMappings.add(new HashMap<>());
|
||||
}
|
||||
|
||||
private void removeNamespaceMapping() {
|
||||
|
||||
@@ -57,7 +57,7 @@ abstract class AbstractStaxXMLReader extends AbstractXMLReader {
|
||||
|
||||
private Boolean isStandalone;
|
||||
|
||||
private final Map<String, String> namespaces = new LinkedHashMap<String, String>();
|
||||
private final Map<String, String> namespaces = new LinkedHashMap<>();
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,7 @@ class DomContentHandler implements ContentHandler {
|
||||
|
||||
private final Document document;
|
||||
|
||||
private final List<Element> elements = new ArrayList<Element>();
|
||||
private final List<Element> elements = new ArrayList<>();
|
||||
|
||||
private final Node node;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -61,7 +61,7 @@ public abstract class DomUtils {
|
||||
Assert.notNull(childEleNames, "Element names collection must not be null");
|
||||
List<String> childEleNameList = Arrays.asList(childEleNames);
|
||||
NodeList nl = ele.getChildNodes();
|
||||
List<Element> childEles = new ArrayList<Element>();
|
||||
List<Element> childEles = new ArrayList<>();
|
||||
for (int i = 0; i < nl.getLength(); i++) {
|
||||
Node node = nl.item(i);
|
||||
if (node instanceof Element && nodeNameMatch(node, childEleNameList)) {
|
||||
@@ -123,7 +123,7 @@ public abstract class DomUtils {
|
||||
public static List<Element> getChildElements(Element ele) {
|
||||
Assert.notNull(ele, "Element must not be null");
|
||||
NodeList nl = ele.getChildNodes();
|
||||
List<Element> childEles = new ArrayList<Element>();
|
||||
List<Element> childEles = new ArrayList<>();
|
||||
for (int i = 0; i < nl.getLength(); i++) {
|
||||
Node node = nl.item(i);
|
||||
if (node instanceof Element) {
|
||||
|
||||
@@ -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.
|
||||
@@ -38,9 +38,9 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class SimpleNamespaceContext implements NamespaceContext {
|
||||
|
||||
private final Map<String, String> prefixToNamespaceUri = new HashMap<String, String>();
|
||||
private final Map<String, String> prefixToNamespaceUri = new HashMap<>();
|
||||
|
||||
private final Map<String, Set<String>> namespaceUriToPrefixes = new HashMap<String, Set<String>>();
|
||||
private final Map<String, Set<String>> namespaceUriToPrefixes = new HashMap<>();
|
||||
|
||||
private String defaultNamespaceUri = "";
|
||||
|
||||
@@ -125,7 +125,7 @@ public class SimpleNamespaceContext implements NamespaceContext {
|
||||
this.prefixToNamespaceUri.put(prefix, namespaceUri);
|
||||
Set<String> prefixes = this.namespaceUriToPrefixes.get(namespaceUri);
|
||||
if (prefixes == null) {
|
||||
prefixes = new LinkedHashSet<String>();
|
||||
prefixes = new LinkedHashSet<>();
|
||||
this.namespaceUriToPrefixes.put(namespaceUri, prefixes);
|
||||
}
|
||||
prefixes.add(prefix);
|
||||
|
||||
@@ -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.
|
||||
@@ -96,7 +96,7 @@ class StaxEventHandler extends AbstractStaxHandler {
|
||||
}
|
||||
|
||||
private List<Namespace> getNamespaces(Map<String, String> namespaceMapping) {
|
||||
List<Namespace> result = new ArrayList<Namespace>();
|
||||
List<Namespace> result = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : namespaceMapping.entrySet()) {
|
||||
String prefix = entry.getKey();
|
||||
String namespaceUri = entry.getValue();
|
||||
@@ -106,7 +106,7 @@ class StaxEventHandler extends AbstractStaxHandler {
|
||||
}
|
||||
|
||||
private List<Attribute> getAttributes(Attributes attributes) {
|
||||
List<Attribute> result = new ArrayList<Attribute>();
|
||||
List<Attribute> result = new ArrayList<>();
|
||||
for (int i = 0; i < attributes.getLength(); i++) {
|
||||
QName attrName = toQName(attributes.getURI(i), attributes.getQName(i));
|
||||
if (!isNamespaceDeclaration(attrName)) {
|
||||
|
||||
@@ -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.
|
||||
@@ -47,7 +47,7 @@ class XMLEventStreamWriter implements XMLStreamWriter {
|
||||
|
||||
private final XMLEventFactory eventFactory;
|
||||
|
||||
private final List<EndElement> endElements = new ArrayList<EndElement>();
|
||||
private final List<EndElement> endElements = new ArrayList<>();
|
||||
|
||||
private boolean emptyElement = false;
|
||||
|
||||
@@ -201,7 +201,7 @@ class XMLEventStreamWriter implements XMLStreamWriter {
|
||||
int last = this.endElements.size() - 1;
|
||||
EndElement oldEndElement = this.endElements.get(last);
|
||||
Iterator oldNamespaces = oldEndElement.getNamespaces();
|
||||
List<Namespace> newNamespaces = new ArrayList<Namespace>();
|
||||
List<Namespace> newNamespaces = new ArrayList<>();
|
||||
while (oldNamespaces.hasNext()) {
|
||||
Namespace oldNamespace = (Namespace) oldNamespaces.next();
|
||||
newNamespaces.add(oldNamespace);
|
||||
|
||||
Reference in New Issue
Block a user