Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -571,7 +571,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||
Map<String, HandlerMapping> matchingBeans =
|
||||
BeanFactoryUtils.beansOfTypeIncludingAncestors(context, HandlerMapping.class, true, false);
|
||||
if (!matchingBeans.isEmpty()) {
|
||||
this.handlerMappings = new ArrayList<HandlerMapping>(matchingBeans.values());
|
||||
this.handlerMappings = new ArrayList<>(matchingBeans.values());
|
||||
// We keep HandlerMappings in sorted order.
|
||||
AnnotationAwareOrderComparator.sort(this.handlerMappings);
|
||||
}
|
||||
@@ -609,7 +609,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||
Map<String, HandlerAdapter> matchingBeans =
|
||||
BeanFactoryUtils.beansOfTypeIncludingAncestors(context, HandlerAdapter.class, true, false);
|
||||
if (!matchingBeans.isEmpty()) {
|
||||
this.handlerAdapters = new ArrayList<HandlerAdapter>(matchingBeans.values());
|
||||
this.handlerAdapters = new ArrayList<>(matchingBeans.values());
|
||||
// We keep HandlerAdapters in sorted order.
|
||||
AnnotationAwareOrderComparator.sort(this.handlerAdapters);
|
||||
}
|
||||
@@ -647,7 +647,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||
Map<String, HandlerExceptionResolver> matchingBeans = BeanFactoryUtils
|
||||
.beansOfTypeIncludingAncestors(context, HandlerExceptionResolver.class, true, false);
|
||||
if (!matchingBeans.isEmpty()) {
|
||||
this.handlerExceptionResolvers = new ArrayList<HandlerExceptionResolver>(matchingBeans.values());
|
||||
this.handlerExceptionResolvers = new ArrayList<>(matchingBeans.values());
|
||||
// We keep HandlerExceptionResolvers in sorted order.
|
||||
AnnotationAwareOrderComparator.sort(this.handlerExceptionResolvers);
|
||||
}
|
||||
@@ -709,7 +709,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||
Map<String, ViewResolver> matchingBeans =
|
||||
BeanFactoryUtils.beansOfTypeIncludingAncestors(context, ViewResolver.class, true, false);
|
||||
if (!matchingBeans.isEmpty()) {
|
||||
this.viewResolvers = new ArrayList<ViewResolver>(matchingBeans.values());
|
||||
this.viewResolvers = new ArrayList<>(matchingBeans.values());
|
||||
// We keep ViewResolvers in sorted order.
|
||||
AnnotationAwareOrderComparator.sort(this.viewResolvers);
|
||||
}
|
||||
@@ -814,7 +814,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||
String value = defaultStrategies.getProperty(key);
|
||||
if (value != null) {
|
||||
String[] classNames = StringUtils.commaDelimitedListToStringArray(value);
|
||||
List<T> strategies = new ArrayList<T>(classNames.length);
|
||||
List<T> strategies = new ArrayList<>(classNames.length);
|
||||
for (String className : classNames) {
|
||||
try {
|
||||
Class<?> clazz = ClassUtils.forName(className, DispatcherServlet.class.getClassLoader());
|
||||
@@ -835,7 +835,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||
return strategies;
|
||||
}
|
||||
else {
|
||||
return new LinkedList<T>();
|
||||
return new LinkedList<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,7 +870,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||
// to be able to restore the original attributes after the include.
|
||||
Map<String, Object> attributesSnapshot = null;
|
||||
if (WebUtils.isIncludeRequest(request)) {
|
||||
attributesSnapshot = new HashMap<String, Object>();
|
||||
attributesSnapshot = new HashMap<>();
|
||||
Enumeration<?> attrNames = request.getAttributeNames();
|
||||
while (attrNames.hasMoreElements()) {
|
||||
String attrName = (String) attrNames.nextElement();
|
||||
@@ -1319,7 +1319,7 @@ public class DispatcherServlet extends FrameworkServlet {
|
||||
private void restoreAttributesAfterInclude(HttpServletRequest request, Map<?,?> attributesSnapshot) {
|
||||
// Need to copy into separate Collection here, to avoid side effects
|
||||
// on the Enumeration when removing attributes.
|
||||
Set<String> attrsToCheck = new HashSet<String>();
|
||||
Set<String> attrsToCheck = new HashSet<>();
|
||||
Enumeration<?> attrNames = request.getAttributeNames();
|
||||
while (attrNames.hasMoreElements()) {
|
||||
String attrName = (String) attrNames.nextElement();
|
||||
|
||||
@@ -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,7 +50,7 @@ public final class FlashMap extends HashMap<String, Object> implements Comparabl
|
||||
|
||||
private String targetRequestPath;
|
||||
|
||||
private final MultiValueMap<String, String> targetRequestParams = new LinkedMultiValueMap<String, String>(4);
|
||||
private final MultiValueMap<String, String> targetRequestParams = new LinkedMultiValueMap<>(4);
|
||||
|
||||
private long expirationTime = -1;
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic
|
||||
|
||||
/** Actual ApplicationContextInitializer instances to apply to the context */
|
||||
private final List<ApplicationContextInitializer<ConfigurableApplicationContext>> contextInitializers =
|
||||
new ArrayList<ApplicationContextInitializer<ConfigurableApplicationContext>>();
|
||||
new ArrayList<>();
|
||||
|
||||
/** Comma-delimited ApplicationContextInitializer class names set through init param */
|
||||
private String contextInitializerClasses;
|
||||
|
||||
@@ -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.
|
||||
@@ -67,7 +67,7 @@ public class HandlerExecutionChain {
|
||||
if (handler instanceof HandlerExecutionChain) {
|
||||
HandlerExecutionChain originalChain = (HandlerExecutionChain) handler;
|
||||
this.handler = originalChain.getHandler();
|
||||
this.interceptorList = new ArrayList<HandlerInterceptor>();
|
||||
this.interceptorList = new ArrayList<>();
|
||||
CollectionUtils.mergeArrayIntoCollection(originalChain.getInterceptors(), this.interceptorList);
|
||||
CollectionUtils.mergeArrayIntoCollection(interceptors, this.interceptorList);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public class HandlerExecutionChain {
|
||||
|
||||
private List<HandlerInterceptor> initInterceptorList() {
|
||||
if (this.interceptorList == null) {
|
||||
this.interceptorList = new ArrayList<HandlerInterceptor>();
|
||||
this.interceptorList = new ArrayList<>();
|
||||
if (this.interceptors != null) {
|
||||
// An interceptor array specified through the constructor
|
||||
this.interceptorList.addAll(Arrays.asList(this.interceptors));
|
||||
|
||||
@@ -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.
|
||||
@@ -88,7 +88,7 @@ public abstract class HttpServletBean extends HttpServlet
|
||||
* Set of required properties (Strings) that must be supplied as
|
||||
* config parameters to this servlet.
|
||||
*/
|
||||
private final Set<String> requiredProperties = new HashSet<String>();
|
||||
private final Set<String> requiredProperties = new HashSet<>();
|
||||
|
||||
private ConfigurableEnvironment environment;
|
||||
|
||||
@@ -232,7 +232,7 @@ public abstract class HttpServletBean extends HttpServlet
|
||||
throws ServletException {
|
||||
|
||||
Set<String> missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ?
|
||||
new HashSet<String>(requiredProperties) : null;
|
||||
new HashSet<>(requiredProperties) : null;
|
||||
|
||||
Enumeration<String> en = config.getInitParameterNames();
|
||||
while (en.hasMoreElements()) {
|
||||
|
||||
@@ -469,7 +469,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
}
|
||||
|
||||
private ManagedList<?> getCallableInterceptors(Element element, Object source, ParserContext parserContext) {
|
||||
ManagedList<? super Object> interceptors = new ManagedList<Object>();
|
||||
ManagedList<? super Object> interceptors = new ManagedList<>();
|
||||
Element asyncElement = DomUtils.getChildElementByTagName(element, "async-support");
|
||||
if (asyncElement != null) {
|
||||
Element interceptorsElement = DomUtils.getChildElementByTagName(asyncElement, "callable-interceptors");
|
||||
@@ -486,7 +486,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
}
|
||||
|
||||
private ManagedList<?> getDeferredResultInterceptors(Element element, Object source, ParserContext parserContext) {
|
||||
ManagedList<? super Object> interceptors = new ManagedList<Object>();
|
||||
ManagedList<? super Object> interceptors = new ManagedList<>();
|
||||
Element asyncElement = DomUtils.getChildElementByTagName(element, "async-support");
|
||||
if (asyncElement != null) {
|
||||
Element interceptorsElement = DomUtils.getChildElementByTagName(asyncElement, "deferred-result-interceptors");
|
||||
@@ -512,7 +512,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
}
|
||||
|
||||
private ManagedList<Object> wrapLegacyResolvers(List<Object> list, ParserContext context) {
|
||||
ManagedList<Object> result = new ManagedList<Object>();
|
||||
ManagedList<Object> result = new ManagedList<>();
|
||||
for (Object object : list) {
|
||||
if (object instanceof BeanDefinitionHolder) {
|
||||
BeanDefinitionHolder beanDef = (BeanDefinitionHolder) object;
|
||||
@@ -537,7 +537,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
private ManagedList<?> getMessageConverters(Element element, Object source, ParserContext parserContext) {
|
||||
Element convertersElement = DomUtils.getChildElementByTagName(element, "message-converters");
|
||||
ManagedList<? super Object> messageConverters = new ManagedList<Object>();
|
||||
ManagedList<? super Object> messageConverters = new ManagedList<>();
|
||||
if (convertersElement != null) {
|
||||
messageConverters.setSource(source);
|
||||
for (Element beanElement : DomUtils.getChildElementsByTagName(convertersElement, "bean", "ref")) {
|
||||
@@ -604,7 +604,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
|
||||
private ManagedList<Object> extractBeanSubElements(Element parentElement, ParserContext parserContext) {
|
||||
ManagedList<Object> list = new ManagedList<Object>();
|
||||
ManagedList<Object> list = new ManagedList<>();
|
||||
list.setSource(parserContext.extractSource(parentElement));
|
||||
for (Element beanElement : DomUtils.getChildElementsByTagName(parentElement, "bean", "ref")) {
|
||||
Object object = parserContext.getDelegate().parsePropertySubElement(beanElement, null);
|
||||
@@ -614,7 +614,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
|
||||
}
|
||||
|
||||
private ManagedList<BeanReference> extractBeanRefSubElements(Element parentElement, ParserContext parserContext){
|
||||
ManagedList<BeanReference> list = new ManagedList<BeanReference>();
|
||||
ManagedList<BeanReference> list = new ManagedList<>();
|
||||
list.setSource(parserContext.extractSource(parentElement));
|
||||
for (Element refElement : DomUtils.getChildElementsByTagName(parentElement, "ref")) {
|
||||
BeanReference reference;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@ public class CorsBeanDefinitionParser implements BeanDefinitionParser {
|
||||
@Override
|
||||
public BeanDefinition parse(Element element, ParserContext parserContext) {
|
||||
|
||||
Map<String, CorsConfiguration> corsConfigurations = new LinkedHashMap<String, CorsConfiguration>();
|
||||
Map<String, CorsConfiguration> corsConfigurations = new LinkedHashMap<>();
|
||||
List<Element> mappings = DomUtils.getChildElementsByTagName(element, "mapping");
|
||||
|
||||
if (mappings.isEmpty()) {
|
||||
|
||||
@@ -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.
|
||||
@@ -58,7 +58,7 @@ class DefaultServletHandlerBeanDefinitionParser implements BeanDefinitionParser
|
||||
parserContext.getRegistry().registerBeanDefinition(defaultServletHandlerName, defaultServletHandlerDef);
|
||||
parserContext.registerComponent(new BeanComponentDefinition(defaultServletHandlerDef, defaultServletHandlerName));
|
||||
|
||||
Map<String, String> urlMap = new ManagedMap<String, String>();
|
||||
Map<String, String> urlMap = new ManagedMap<>();
|
||||
urlMap.put("/**", defaultServletHandlerName);
|
||||
|
||||
RootBeanDefinition handlerMappingDef = new RootBeanDefinition(SimpleUrlHandlerMapping.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.
|
||||
@@ -53,7 +53,7 @@ public class FreeMarkerConfigurerBeanDefinitionParser extends AbstractSingleBean
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
List<Element> childElements = DomUtils.getChildElementsByTagName(element, "template-loader-path");
|
||||
if (!childElements.isEmpty()) {
|
||||
List<String> locations = new ArrayList<String>(childElements.size());
|
||||
List<String> locations = new ArrayList<>(childElements.size());
|
||||
for (Element childElement : childElements) {
|
||||
locations.add(childElement.getAttribute("location"));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -86,7 +86,7 @@ class InterceptorsBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
private ManagedList<String> getIncludePatterns(Element interceptor, String elementName) {
|
||||
List<Element> paths = DomUtils.getChildElementsByTagName(interceptor, elementName);
|
||||
ManagedList<String> patterns = new ManagedList<String>(paths.size());
|
||||
ManagedList<String> patterns = new ManagedList<>(paths.size());
|
||||
for (Element path : paths) {
|
||||
patterns.add(path.getAttribute("path"));
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, String> urlMap = new ManagedMap<String, String>();
|
||||
Map<String, String> urlMap = new ManagedMap<>();
|
||||
String resourceRequestPath = element.getAttribute("mapping");
|
||||
if (!StringUtils.hasText(resourceRequestPath)) {
|
||||
parserContext.getReaderContext().error("The 'mapping' attribute is required.", parserContext.extractSource(element));
|
||||
@@ -160,7 +160,7 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
|
||||
return null;
|
||||
}
|
||||
|
||||
ManagedList<String> locations = new ManagedList<String>();
|
||||
ManagedList<String> locations = new ManagedList<>();
|
||||
locations.addAll(Arrays.asList(StringUtils.commaDelimitedListToStringArray(locationAttr)));
|
||||
|
||||
RootBeanDefinition resourceHandlerDef = new RootBeanDefinition(ResourceHttpRequestHandler.class);
|
||||
@@ -204,9 +204,9 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
|
||||
String autoRegistration = element.getAttribute("auto-registration");
|
||||
boolean isAutoRegistration = !(StringUtils.hasText(autoRegistration) && "false".equals(autoRegistration));
|
||||
|
||||
ManagedList<? super Object> resourceResolvers = new ManagedList<Object>();
|
||||
ManagedList<? super Object> resourceResolvers = new ManagedList<>();
|
||||
resourceResolvers.setSource(source);
|
||||
ManagedList<? super Object> resourceTransformers = new ManagedList<Object>();
|
||||
ManagedList<? super Object> resourceTransformers = new ManagedList<>();
|
||||
resourceTransformers.setSource(source);
|
||||
|
||||
parseResourceCache(resourceResolvers, resourceTransformers, element, source);
|
||||
@@ -348,7 +348,7 @@ class ResourcesBeanDefinitionParser implements BeanDefinitionParser {
|
||||
}
|
||||
|
||||
private RootBeanDefinition parseVersionResolver(ParserContext parserContext, Element element, Object source) {
|
||||
ManagedMap<String, ? super Object> strategyMap = new ManagedMap<String, Object>();
|
||||
ManagedMap<String, ? super Object> strategyMap = new ManagedMap<>();
|
||||
strategyMap.setSource(source);
|
||||
RootBeanDefinition versionResolverDef = new RootBeanDefinition(VersionResourceResolver.class);
|
||||
versionResolverDef.setSource(source);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,7 +54,7 @@ public class ScriptTemplateConfigurerBeanDefinitionParser extends AbstractSimple
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
List<Element> childElements = DomUtils.getChildElementsByTagName(element, "script");
|
||||
if (!childElements.isEmpty()) {
|
||||
List<String> locations = new ArrayList<String>(childElements.size());
|
||||
List<String> locations = new ArrayList<>(childElements.size());
|
||||
for (Element childElement : childElements) {
|
||||
locations.add(childElement.getAttribute("location"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,7 +54,7 @@ public class TilesConfigurerBeanDefinitionParser extends AbstractSingleBeanDefin
|
||||
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
|
||||
List<Element> childElements = DomUtils.getChildElementsByTagName(element, "definitions");
|
||||
if (!childElements.isEmpty()) {
|
||||
List<String> locations = new ArrayList<String>(childElements.size());
|
||||
List<String> locations = new ArrayList<>(childElements.size());
|
||||
for (Element childElement : childElements) {
|
||||
locations.add(childElement.getAttribute("location"));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -105,7 +105,7 @@ class ViewControllerBeanDefinitionParser implements BeanDefinitionParser {
|
||||
urlMap = (Map<String, BeanDefinition>) hm.getPropertyValues().getPropertyValue("urlMap").getValue();
|
||||
}
|
||||
else {
|
||||
urlMap = new ManagedMap<String, BeanDefinition>();
|
||||
urlMap = new ManagedMap<>();
|
||||
hm.getPropertyValues().add("urlMap", urlMap);
|
||||
}
|
||||
urlMap.put(element.getAttribute("path"), controller);
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ViewResolversBeanDefinitionParser implements BeanDefinitionParser {
|
||||
Object source = context.extractSource(element);
|
||||
context.pushContainingComponent(new CompositeComponentDefinition(element.getTagName(), source));
|
||||
|
||||
ManagedList<Object> resolvers = new ManagedList<Object>(4);
|
||||
ManagedList<Object> resolvers = new ManagedList<>(4);
|
||||
resolvers.setSource(context.extractSource(element));
|
||||
String[] names = new String[] {"jsp", "tiles", "bean-name", "freemarker", "groovy", "script-template", "bean", "ref"};
|
||||
|
||||
@@ -130,7 +130,7 @@ public class ViewResolversBeanDefinitionParser implements BeanDefinitionParser {
|
||||
else if (contentnNegotiationElements.size() == 1) {
|
||||
BeanDefinition beanDef = createContentNegotiatingViewResolver(contentnNegotiationElements.get(0), context);
|
||||
beanDef.getPropertyValues().add("viewResolvers", resolvers);
|
||||
ManagedList<Object> list = new ManagedList<Object>(1);
|
||||
ManagedList<Object> list = new ManagedList<>(1);
|
||||
list.add(beanDef);
|
||||
compositeResolverBeanDef.getPropertyValues().add("order", Ordered.HIGHEST_PRECEDENCE);
|
||||
compositeResolverBeanDef.getPropertyValues().add("viewResolvers", list);
|
||||
@@ -175,7 +175,7 @@ public class ViewResolversBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
List<Element> elements = DomUtils.getChildElementsByTagName(resolverElement, new String[] {"default-views"});
|
||||
if (!elements.isEmpty()) {
|
||||
ManagedList<Object> list = new ManagedList<Object>();
|
||||
ManagedList<Object> list = new ManagedList<>();
|
||||
for (Element element : DomUtils.getChildElementsByTagName(elements.get(0), "bean", "ref")) {
|
||||
list.add(context.getDelegate().parsePropertySubElement(element, null));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -41,10 +41,10 @@ public class AsyncSupportConfigurer {
|
||||
private Long timeout;
|
||||
|
||||
private final List<CallableProcessingInterceptor> callableInterceptors =
|
||||
new ArrayList<CallableProcessingInterceptor>();
|
||||
new ArrayList<>();
|
||||
|
||||
private final List<DeferredResultProcessingInterceptor> deferredResultInterceptors =
|
||||
new ArrayList<DeferredResultProcessingInterceptor>();
|
||||
new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -88,7 +88,7 @@ public class ContentNegotiationConfigurer {
|
||||
private final ContentNegotiationManagerFactoryBean factory =
|
||||
new ContentNegotiationManagerFactoryBean();
|
||||
|
||||
private final Map<String, MediaType> mediaTypes = new HashMap<String, MediaType>();
|
||||
private final Map<String, MediaType> mediaTypes = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -59,22 +59,22 @@ public class CorsRegistration {
|
||||
}
|
||||
|
||||
public CorsRegistration allowedOrigins(String... origins) {
|
||||
this.config.setAllowedOrigins(new ArrayList<String>(Arrays.asList(origins)));
|
||||
this.config.setAllowedOrigins(new ArrayList<>(Arrays.asList(origins)));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CorsRegistration allowedMethods(String... methods) {
|
||||
this.config.setAllowedMethods(new ArrayList<String>(Arrays.asList(methods)));
|
||||
this.config.setAllowedMethods(new ArrayList<>(Arrays.asList(methods)));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CorsRegistration allowedHeaders(String... headers) {
|
||||
this.config.setAllowedHeaders(new ArrayList<String>(Arrays.asList(headers)));
|
||||
this.config.setAllowedHeaders(new ArrayList<>(Arrays.asList(headers)));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CorsRegistration exposedHeaders(String... headers) {
|
||||
this.config.setExposedHeaders(new ArrayList<String>(Arrays.asList(headers)));
|
||||
this.config.setExposedHeaders(new ArrayList<>(Arrays.asList(headers)));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -33,7 +33,7 @@ import org.springframework.web.cors.CorsConfiguration;
|
||||
*/
|
||||
public class CorsRegistry {
|
||||
|
||||
private final List<CorsRegistration> registrations = new ArrayList<CorsRegistration>();
|
||||
private final List<CorsRegistration> registrations = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,7 @@ public class CorsRegistry {
|
||||
}
|
||||
|
||||
protected Map<String, CorsConfiguration> getCorsConfigurations() {
|
||||
Map<String, CorsConfiguration> configs = new LinkedHashMap<String, CorsConfiguration>(this.registrations.size());
|
||||
Map<String, CorsConfiguration> configs = new LinkedHashMap<>(this.registrations.size());
|
||||
for (CorsRegistration registration : this.registrations) {
|
||||
configs.put(registration.getPathPattern(), registration.getCorsConfiguration());
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -85,7 +85,7 @@ public class DefaultServletHandlerConfigurer {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, HttpRequestHandler> urlMap = new HashMap<String, HttpRequestHandler>();
|
||||
Map<String, HttpRequestHandler> urlMap = new HashMap<>();
|
||||
urlMap.put("/**", handler);
|
||||
|
||||
SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping();
|
||||
|
||||
@@ -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.
|
||||
@@ -37,9 +37,9 @@ public class InterceptorRegistration {
|
||||
|
||||
private final HandlerInterceptor interceptor;
|
||||
|
||||
private final List<String> includePatterns = new ArrayList<String>();
|
||||
private final List<String> includePatterns = new ArrayList<>();
|
||||
|
||||
private final List<String> excludePatterns = new ArrayList<String>();
|
||||
private final List<String> excludePatterns = new ArrayList<>();
|
||||
|
||||
private PathMatcher pathMatcher;
|
||||
|
||||
|
||||
@@ -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,7 +33,7 @@ import org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapt
|
||||
*/
|
||||
public class InterceptorRegistry {
|
||||
|
||||
private final List<InterceptorRegistration> registrations = new ArrayList<InterceptorRegistration>();
|
||||
private final List<InterceptorRegistration> registrations = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Adds the provided {@link HandlerInterceptor}.
|
||||
@@ -64,7 +64,7 @@ public class InterceptorRegistry {
|
||||
* Returns all registered interceptors.
|
||||
*/
|
||||
protected List<Object> getInterceptors() {
|
||||
List<Object> interceptors = new ArrayList<Object>();
|
||||
List<Object> interceptors = new ArrayList<>();
|
||||
for (InterceptorRegistration registration : registrations) {
|
||||
interceptors.add(registration.getInterceptor());
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@ public class ResourceChainRegistration {
|
||||
"org.webjars.WebJarAssetLocator", ResourceChainRegistration.class.getClassLoader());
|
||||
|
||||
|
||||
private final List<ResourceResolver> resolvers = new ArrayList<ResourceResolver>(4);
|
||||
private final List<ResourceResolver> resolvers = new ArrayList<>(4);
|
||||
|
||||
private final List<ResourceTransformer> transformers = new ArrayList<ResourceTransformer>(4);
|
||||
private final List<ResourceTransformer> transformers = new ArrayList<>(4);
|
||||
|
||||
private boolean hasVersionResolver;
|
||||
|
||||
@@ -108,7 +108,7 @@ public class ResourceChainRegistration {
|
||||
|
||||
protected List<ResourceResolver> getResourceResolvers() {
|
||||
if (!this.hasPathResolver) {
|
||||
List<ResourceResolver> result = new ArrayList<ResourceResolver>(this.resolvers);
|
||||
List<ResourceResolver> result = new ArrayList<>(this.resolvers);
|
||||
if (isWebJarsAssetLocatorPresent && !this.hasWebjarsResolver) {
|
||||
result.add(new WebJarsResourceResolver());
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public class ResourceChainRegistration {
|
||||
|
||||
protected List<ResourceTransformer> getResourceTransformers() {
|
||||
if (this.hasVersionResolver && !this.hasCssLinkTransformer) {
|
||||
List<ResourceTransformer> result = new ArrayList<ResourceTransformer>(this.transformers);
|
||||
List<ResourceTransformer> result = new ArrayList<>(this.transformers);
|
||||
boolean hasTransformers = !this.transformers.isEmpty();
|
||||
boolean hasCaching = hasTransformers && this.transformers.get(0) instanceof CachingResourceTransformer;
|
||||
result.add(hasCaching ? 1 : 0, new CssLinkResourceTransformer());
|
||||
|
||||
@@ -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 @@ public class ResourceHandlerRegistration {
|
||||
|
||||
private final String[] pathPatterns;
|
||||
|
||||
private final List<Resource> locations = new ArrayList<Resource>();
|
||||
private final List<Resource> locations = new ArrayList<>();
|
||||
|
||||
private Integer cachePeriod;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -58,7 +58,7 @@ public class ResourceHandlerRegistry {
|
||||
|
||||
private final ContentNegotiationManager contentNegotiationManager;
|
||||
|
||||
private final List<ResourceHandlerRegistration> registrations = new ArrayList<ResourceHandlerRegistration>();
|
||||
private final List<ResourceHandlerRegistration> registrations = new ArrayList<>();
|
||||
|
||||
private int order = Integer.MAX_VALUE -1;
|
||||
|
||||
@@ -116,7 +116,7 @@ public class ResourceHandlerRegistry {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, HttpRequestHandler> urlMap = new LinkedHashMap<String, HttpRequestHandler>();
|
||||
Map<String, HttpRequestHandler> urlMap = new LinkedHashMap<>();
|
||||
for (ResourceHandlerRegistration registration : this.registrations) {
|
||||
for (String pathPattern : registration.getPathPatterns()) {
|
||||
ResourceHttpRequestHandler handler = registration.getRequestHandler();
|
||||
|
||||
@@ -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.
|
||||
@@ -36,10 +36,10 @@ import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
|
||||
*/
|
||||
public class ViewControllerRegistry {
|
||||
|
||||
private final List<ViewControllerRegistration> registrations = new ArrayList<ViewControllerRegistration>(4);
|
||||
private final List<ViewControllerRegistration> registrations = new ArrayList<>(4);
|
||||
|
||||
private final List<RedirectViewControllerRegistration> redirectRegistrations =
|
||||
new ArrayList<RedirectViewControllerRegistration>(10);
|
||||
new ArrayList<>(10);
|
||||
|
||||
private int order = 1;
|
||||
|
||||
@@ -106,7 +106,7 @@ public class ViewControllerRegistry {
|
||||
if (this.registrations.isEmpty() && this.redirectRegistrations.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Map<String, Object> urlMap = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> urlMap = new LinkedHashMap<>();
|
||||
for (ViewControllerRegistration registration : this.registrations) {
|
||||
urlMap.put(registration.getUrlPath(), registration.getViewController());
|
||||
}
|
||||
|
||||
@@ -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,7 +55,7 @@ public class ViewResolverRegistry {
|
||||
|
||||
private ContentNegotiatingViewResolver contentNegotiatingResolver;
|
||||
|
||||
private final List<ViewResolver> viewResolvers = new ArrayList<ViewResolver>(4);
|
||||
private final List<ViewResolver> viewResolvers = new ArrayList<>(4);
|
||||
|
||||
private Integer order;
|
||||
|
||||
@@ -113,7 +113,7 @@ public class ViewResolverRegistry {
|
||||
if (this.contentNegotiatingResolver != null) {
|
||||
if (!ObjectUtils.isEmpty(defaultViews)) {
|
||||
if (!CollectionUtils.isEmpty(this.contentNegotiatingResolver.getDefaultViews())) {
|
||||
List<View> views = new ArrayList<View>(this.contentNegotiatingResolver.getDefaultViews());
|
||||
List<View> views = new ArrayList<>(this.contentNegotiatingResolver.getDefaultViews());
|
||||
views.addAll(Arrays.asList(defaultViews));
|
||||
this.contentNegotiatingResolver.setDefaultViews(views);
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
}
|
||||
|
||||
protected Map<String, MediaType> getDefaultMediaTypes() {
|
||||
Map<String, MediaType> map = new HashMap<String, MediaType>();
|
||||
Map<String, MediaType> map = new HashMap<>();
|
||||
if (romePresent) {
|
||||
map.put("atom", MediaType.APPLICATION_ATOM_XML);
|
||||
map.put("rss", MediaType.valueOf("application/rss+xml"));
|
||||
@@ -487,11 +487,11 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
adapter.setCustomReturnValueHandlers(getReturnValueHandlers());
|
||||
|
||||
if (jackson2Present) {
|
||||
List<RequestBodyAdvice> requestBodyAdvices = new ArrayList<RequestBodyAdvice>();
|
||||
List<RequestBodyAdvice> requestBodyAdvices = new ArrayList<>();
|
||||
requestBodyAdvices.add(new JsonViewRequestBodyAdvice());
|
||||
adapter.setRequestBodyAdvice(requestBodyAdvices);
|
||||
|
||||
List<ResponseBodyAdvice<?>> responseBodyAdvices = new ArrayList<ResponseBodyAdvice<?>>();
|
||||
List<ResponseBodyAdvice<?>> responseBodyAdvices = new ArrayList<>();
|
||||
responseBodyAdvices.add(new JsonViewResponseBodyAdvice());
|
||||
adapter.setResponseBodyAdvice(responseBodyAdvices);
|
||||
}
|
||||
@@ -632,7 +632,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
*/
|
||||
protected final List<HandlerMethodArgumentResolver> getArgumentResolvers() {
|
||||
if (this.argumentResolvers == null) {
|
||||
this.argumentResolvers = new ArrayList<HandlerMethodArgumentResolver>();
|
||||
this.argumentResolvers = new ArrayList<>();
|
||||
addArgumentResolvers(this.argumentResolvers);
|
||||
}
|
||||
return this.argumentResolvers;
|
||||
@@ -660,7 +660,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
*/
|
||||
protected final List<HandlerMethodReturnValueHandler> getReturnValueHandlers() {
|
||||
if (this.returnValueHandlers == null) {
|
||||
this.returnValueHandlers = new ArrayList<HandlerMethodReturnValueHandler>();
|
||||
this.returnValueHandlers = new ArrayList<>();
|
||||
addReturnValueHandlers(this.returnValueHandlers);
|
||||
}
|
||||
return this.returnValueHandlers;
|
||||
@@ -691,7 +691,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
*/
|
||||
protected final List<HttpMessageConverter<?>> getMessageConverters() {
|
||||
if (this.messageConverters == null) {
|
||||
this.messageConverters = new ArrayList<HttpMessageConverter<?>>();
|
||||
this.messageConverters = new ArrayList<>();
|
||||
configureMessageConverters(this.messageConverters);
|
||||
if (this.messageConverters.isEmpty()) {
|
||||
addDefaultHttpMessageConverters(this.messageConverters);
|
||||
@@ -737,7 +737,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
messageConverters.add(new ByteArrayHttpMessageConverter());
|
||||
messageConverters.add(stringConverter);
|
||||
messageConverters.add(new ResourceHttpMessageConverter());
|
||||
messageConverters.add(new SourceHttpMessageConverter<Source>());
|
||||
messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
||||
|
||||
if (romePresent) {
|
||||
@@ -815,7 +815,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
*/
|
||||
@Bean
|
||||
public HandlerExceptionResolver handlerExceptionResolver() {
|
||||
List<HandlerExceptionResolver> exceptionResolvers = new ArrayList<HandlerExceptionResolver>();
|
||||
List<HandlerExceptionResolver> exceptionResolvers = new ArrayList<>();
|
||||
configureHandlerExceptionResolvers(exceptionResolvers);
|
||||
|
||||
if (exceptionResolvers.isEmpty()) {
|
||||
@@ -871,7 +871,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
exceptionHandlerResolver.setCustomArgumentResolvers(getArgumentResolvers());
|
||||
exceptionHandlerResolver.setCustomReturnValueHandlers(getReturnValueHandlers());
|
||||
if (jackson2Present) {
|
||||
List<ResponseBodyAdvice<?>> interceptors = new ArrayList<ResponseBodyAdvice<?>>();
|
||||
List<ResponseBodyAdvice<?>> interceptors = new ArrayList<>();
|
||||
interceptors.add(new JsonViewResponseBodyAdvice());
|
||||
exceptionHandlerResolver.setResponseBodyAdvice(interceptors);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.web.servlet.HandlerExceptionResolver;
|
||||
*/
|
||||
class WebMvcConfigurerComposite implements WebMvcConfigurer {
|
||||
|
||||
private final List<WebMvcConfigurer> delegates = new ArrayList<WebMvcConfigurer>();
|
||||
private final List<WebMvcConfigurer> delegates = new ArrayList<>();
|
||||
|
||||
public void addWebMvcConfigurers(List<WebMvcConfigurer> configurers) {
|
||||
if (configurers != null) {
|
||||
@@ -150,7 +150,7 @@ class WebMvcConfigurerComposite implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public Validator getValidator() {
|
||||
List<Validator> candidates = new ArrayList<Validator>();
|
||||
List<Validator> candidates = new ArrayList<>();
|
||||
for (WebMvcConfigurer configurer : this.delegates) {
|
||||
Validator validator = configurer.getValidator();
|
||||
if (validator != null) {
|
||||
@@ -182,7 +182,7 @@ class WebMvcConfigurerComposite implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public MessageCodesResolver getMessageCodesResolver() {
|
||||
List<MessageCodesResolver> candidates = new ArrayList<MessageCodesResolver>();
|
||||
List<MessageCodesResolver> candidates = new ArrayList<>();
|
||||
for (WebMvcConfigurer configurer : this.delegates) {
|
||||
MessageCodesResolver messageCodesResolver = configurer.getMessageCodesResolver();
|
||||
if (messageCodesResolver != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -75,9 +75,9 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
||||
|
||||
private PathMatcher pathMatcher = new AntPathMatcher();
|
||||
|
||||
private final List<Object> interceptors = new ArrayList<Object>();
|
||||
private final List<Object> interceptors = new ArrayList<>();
|
||||
|
||||
private final List<HandlerInterceptor> adaptedInterceptors = new ArrayList<HandlerInterceptor>();
|
||||
private final List<HandlerInterceptor> adaptedInterceptors = new ArrayList<>();
|
||||
|
||||
private CorsProcessor corsProcessor = new DefaultCorsProcessor();
|
||||
|
||||
@@ -329,7 +329,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
||||
* @return the array of {@link MappedInterceptor}s, or {@code null} if none
|
||||
*/
|
||||
protected final MappedInterceptor[] getMappedInterceptors() {
|
||||
List<MappedInterceptor> mappedInterceptors = new ArrayList<MappedInterceptor>();
|
||||
List<MappedInterceptor> mappedInterceptors = new ArrayList<>();
|
||||
for (HandlerInterceptor interceptor : this.adaptedInterceptors) {
|
||||
if (interceptor instanceof MappedInterceptor) {
|
||||
mappedInterceptors.add((MappedInterceptor) interceptor);
|
||||
|
||||
@@ -468,17 +468,17 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
||||
*/
|
||||
class MappingRegistry {
|
||||
|
||||
private final Map<T, MappingRegistration<T>> registry = new HashMap<T, MappingRegistration<T>>();
|
||||
private final Map<T, MappingRegistration<T>> registry = new HashMap<>();
|
||||
|
||||
private final Map<T, HandlerMethod> mappingLookup = new LinkedHashMap<T, HandlerMethod>();
|
||||
private final Map<T, HandlerMethod> mappingLookup = new LinkedHashMap<>();
|
||||
|
||||
private final MultiValueMap<String, T> urlLookup = new LinkedMultiValueMap<String, T>();
|
||||
private final MultiValueMap<String, T> urlLookup = new LinkedMultiValueMap<>();
|
||||
|
||||
private final Map<String, List<HandlerMethod>> nameLookup =
|
||||
new ConcurrentHashMap<String, List<HandlerMethod>>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
private final Map<HandlerMethod, CorsConfiguration> corsLookup =
|
||||
new ConcurrentHashMap<HandlerMethod, CorsConfiguration>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();
|
||||
|
||||
@@ -554,7 +554,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
||||
this.corsLookup.put(handlerMethod, corsConfig);
|
||||
}
|
||||
|
||||
this.registry.put(mapping, new MappingRegistration<T>(mapping, handlerMethod, directUrls, name));
|
||||
this.registry.put(mapping, new MappingRegistration<>(mapping, handlerMethod, directUrls, name));
|
||||
}
|
||||
finally {
|
||||
this.readWriteLock.writeLock().unlock();
|
||||
@@ -572,7 +572,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
||||
}
|
||||
|
||||
private List<String> getDirectUrls(T mapping) {
|
||||
List<String> urls = new ArrayList<String>(1);
|
||||
List<String> urls = new ArrayList<>(1);
|
||||
for (String path : getMappingPathPatterns(mapping)) {
|
||||
if (!getPathMatcher().isPattern(path)) {
|
||||
urls.add(path);
|
||||
@@ -597,7 +597,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
||||
logger.trace("Mapping name '" + name + "'");
|
||||
}
|
||||
|
||||
List<HandlerMethod> newList = new ArrayList<HandlerMethod>(oldList.size() + 1);
|
||||
List<HandlerMethod> newList = new ArrayList<>(oldList.size() + 1);
|
||||
newList.addAll(oldList);
|
||||
newList.add(handlerMethod);
|
||||
this.nameLookup.put(name, newList);
|
||||
@@ -653,7 +653,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
||||
this.nameLookup.remove(name);
|
||||
return;
|
||||
}
|
||||
List<HandlerMethod> newList = new ArrayList<HandlerMethod>(oldList.size() - 1);
|
||||
List<HandlerMethod> newList = new ArrayList<>(oldList.size() - 1);
|
||||
for (HandlerMethod current : oldList) {
|
||||
if (!current.equals(handlerMethod)) {
|
||||
newList.add(current);
|
||||
|
||||
@@ -57,7 +57,7 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i
|
||||
|
||||
private boolean lazyInitHandlers = false;
|
||||
|
||||
private final Map<String, Object> handlerMap = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> handlerMap = new LinkedHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -171,7 +171,7 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i
|
||||
return buildPathExposingHandler(handler, urlPath, urlPath, null);
|
||||
}
|
||||
// Pattern match?
|
||||
List<String> matchingPatterns = new ArrayList<String>();
|
||||
List<String> matchingPatterns = new ArrayList<>();
|
||||
for (String registeredPattern : this.handlerMap.keySet()) {
|
||||
if (getPathMatcher().match(registeredPattern, urlPath)) {
|
||||
matchingPatterns.add(registeredPattern);
|
||||
@@ -207,7 +207,7 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i
|
||||
|
||||
// There might be multiple 'best patterns', let's make sure we have the correct URI template variables
|
||||
// for all of them
|
||||
Map<String, String> uriTemplateVariables = new LinkedHashMap<String, String>();
|
||||
Map<String, String> uriTemplateVariables = new LinkedHashMap<>();
|
||||
for (String matchingPattern : matchingPatterns) {
|
||||
if (patternComparator.compare(bestPatternMatch, matchingPattern) == 0) {
|
||||
Map<String, String> vars = getPathMatcher().extractUriTemplateVariables(matchingPattern, urlPath);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class BeanNameUrlHandlerMapping extends AbstractDetectingUrlHandlerMappin
|
||||
*/
|
||||
@Override
|
||||
protected String[] determineUrlsForHandler(String beanName) {
|
||||
List<String> urls = new ArrayList<String>();
|
||||
List<String> urls = new ArrayList<>();
|
||||
if (beanName.startsWith("/")) {
|
||||
urls.add(beanName);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class HandlerMappingIntrospector implements CorsConfigurationSource {
|
||||
Map<String, HandlerMapping> beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(
|
||||
context, HandlerMapping.class, true, false);
|
||||
if (!beans.isEmpty()) {
|
||||
List<HandlerMapping> mappings = new ArrayList<HandlerMapping>(beans.values());
|
||||
List<HandlerMapping> mappings = new ArrayList<>(beans.values());
|
||||
AnnotationAwareOrderComparator.sort(mappings);
|
||||
return mappings;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class HandlerMappingIntrospector implements CorsConfigurationSource {
|
||||
|
||||
String value = props.getProperty(HandlerMapping.class.getName());
|
||||
String[] names = StringUtils.commaDelimitedListToStringArray(value);
|
||||
List<HandlerMapping> result = new ArrayList<HandlerMapping>(names.length);
|
||||
List<HandlerMapping> result = new ArrayList<>(names.length);
|
||||
for (String name : names) {
|
||||
try {
|
||||
Class<?> clazz = ClassUtils.forName(name, DispatcherServlet.class.getClassLoader());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,7 +54,7 @@ public class SimpleMappingExceptionResolver extends AbstractHandlerExceptionReso
|
||||
|
||||
private Integer defaultStatusCode;
|
||||
|
||||
private Map<String, Integer> statusCodes = new HashMap<String, Integer>();
|
||||
private Map<String, Integer> statusCodes = new HashMap<>();
|
||||
|
||||
private String exceptionAttribute = DEFAULT_EXCEPTION_ATTRIBUTE;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -54,7 +54,7 @@ import org.springframework.util.CollectionUtils;
|
||||
*/
|
||||
public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping {
|
||||
|
||||
private final Map<String, Object> urlMap = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> urlMap = new LinkedHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.springframework.web.servlet.LocaleResolver;
|
||||
*/
|
||||
public class AcceptHeaderLocaleResolver implements LocaleResolver {
|
||||
|
||||
private final List<Locale> supportedLocales = new ArrayList<Locale>(4);
|
||||
private final List<Locale> supportedLocales = new ArrayList<>(4);
|
||||
|
||||
private Locale defaultLocale;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -53,7 +53,7 @@ public class UrlFilenameViewController extends AbstractUrlViewController {
|
||||
private String suffix = "";
|
||||
|
||||
/** Request URL path String --> view name String */
|
||||
private final Map<String, String> viewNameCache = new ConcurrentHashMap<String, String>(256);
|
||||
private final Map<String, String> viewNameCache = new ConcurrentHashMap<>(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.
|
||||
@@ -55,9 +55,9 @@ public class WebContentInterceptor extends WebContentGenerator implements Handle
|
||||
|
||||
private PathMatcher pathMatcher = new AntPathMatcher();
|
||||
|
||||
private Map<String, Integer> cacheMappings = new HashMap<String, Integer>();
|
||||
private Map<String, Integer> cacheMappings = new HashMap<>();
|
||||
|
||||
private Map<String, CacheControl> cacheControlMappings = new HashMap<String, CacheControl>();
|
||||
private Map<String, CacheControl> cacheControlMappings = new HashMap<>();
|
||||
|
||||
|
||||
public WebContentInterceptor() {
|
||||
|
||||
@@ -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.
|
||||
@@ -81,7 +81,7 @@ public class CompositeRequestCondition extends AbstractRequestCondition<Composit
|
||||
}
|
||||
|
||||
private List<RequestCondition<?>> unwrap() {
|
||||
List<RequestCondition<?>> result = new ArrayList<RequestCondition<?>>();
|
||||
List<RequestCondition<?>> result = new ArrayList<>();
|
||||
for (RequestConditionHolder holder : this.requestConditions) {
|
||||
result.add(holder.getCondition());
|
||||
}
|
||||
|
||||
@@ -80,13 +80,13 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition<Con
|
||||
* Private constructor accepting parsed media type expressions.
|
||||
*/
|
||||
private ConsumesRequestCondition(Collection<ConsumeMediaTypeExpression> expressions) {
|
||||
this.expressions = new ArrayList<ConsumeMediaTypeExpression>(expressions);
|
||||
this.expressions = new ArrayList<>(expressions);
|
||||
Collections.sort(this.expressions);
|
||||
}
|
||||
|
||||
|
||||
private static Set<ConsumeMediaTypeExpression> parseExpressions(String[] consumes, String[] headers) {
|
||||
Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<ConsumeMediaTypeExpression>();
|
||||
Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<>();
|
||||
if (headers != null) {
|
||||
for (String header : headers) {
|
||||
HeaderExpression expr = new HeaderExpression(header);
|
||||
@@ -110,14 +110,14 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition<Con
|
||||
* Return the contained MediaType expressions.
|
||||
*/
|
||||
public Set<MediaTypeExpression> getExpressions() {
|
||||
return new LinkedHashSet<MediaTypeExpression>(this.expressions);
|
||||
return new LinkedHashSet<>(this.expressions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the media types for this condition excluding negated expressions.
|
||||
*/
|
||||
public Set<MediaType> getConsumableMediaTypes() {
|
||||
Set<MediaType> result = new LinkedHashSet<MediaType>();
|
||||
Set<MediaType> result = new LinkedHashSet<>();
|
||||
for (ConsumeMediaTypeExpression expression : this.expressions) {
|
||||
if (!expression.isNegated()) {
|
||||
result.add(expression.getMediaType());
|
||||
@@ -180,7 +180,7 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition<Con
|
||||
catch (InvalidMediaTypeException ex) {
|
||||
return null;
|
||||
}
|
||||
Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<ConsumeMediaTypeExpression>(this.expressions);
|
||||
Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<>(this.expressions);
|
||||
for (Iterator<ConsumeMediaTypeExpression> iterator = result.iterator(); iterator.hasNext();) {
|
||||
ConsumeMediaTypeExpression expression = iterator.next();
|
||||
if (!expression.match(contentType)) {
|
||||
|
||||
@@ -57,12 +57,12 @@ public final class HeadersRequestCondition extends AbstractRequestCondition<Head
|
||||
}
|
||||
|
||||
private HeadersRequestCondition(Collection<HeaderExpression> conditions) {
|
||||
this.expressions = Collections.unmodifiableSet(new LinkedHashSet<HeaderExpression>(conditions));
|
||||
this.expressions = Collections.unmodifiableSet(new LinkedHashSet<>(conditions));
|
||||
}
|
||||
|
||||
|
||||
private static Collection<HeaderExpression> parseExpressions(String... headers) {
|
||||
Set<HeaderExpression> expressions = new LinkedHashSet<HeaderExpression>();
|
||||
Set<HeaderExpression> expressions = new LinkedHashSet<>();
|
||||
if (headers != null) {
|
||||
for (String header : headers) {
|
||||
HeaderExpression expr = new HeaderExpression(header);
|
||||
@@ -79,7 +79,7 @@ public final class HeadersRequestCondition extends AbstractRequestCondition<Head
|
||||
* Return the contained request header expressions.
|
||||
*/
|
||||
public Set<NameValueExpression<String>> getExpressions() {
|
||||
return new LinkedHashSet<NameValueExpression<String>>(this.expressions);
|
||||
return new LinkedHashSet<>(this.expressions);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,7 +98,7 @@ public final class HeadersRequestCondition extends AbstractRequestCondition<Head
|
||||
*/
|
||||
@Override
|
||||
public HeadersRequestCondition combine(HeadersRequestCondition other) {
|
||||
Set<HeaderExpression> set = new LinkedHashSet<HeaderExpression>(this.expressions);
|
||||
Set<HeaderExpression> set = new LinkedHashSet<>(this.expressions);
|
||||
set.addAll(other.expressions);
|
||||
return new HeadersRequestCondition(set);
|
||||
}
|
||||
|
||||
@@ -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,12 +48,12 @@ public final class ParamsRequestCondition extends AbstractRequestCondition<Param
|
||||
}
|
||||
|
||||
private ParamsRequestCondition(Collection<ParamExpression> conditions) {
|
||||
this.expressions = Collections.unmodifiableSet(new LinkedHashSet<ParamExpression>(conditions));
|
||||
this.expressions = Collections.unmodifiableSet(new LinkedHashSet<>(conditions));
|
||||
}
|
||||
|
||||
|
||||
private static Collection<ParamExpression> parseExpressions(String... params) {
|
||||
Set<ParamExpression> expressions = new LinkedHashSet<ParamExpression>();
|
||||
Set<ParamExpression> expressions = new LinkedHashSet<>();
|
||||
if (params != null) {
|
||||
for (String param : params) {
|
||||
expressions.add(new ParamExpression(param));
|
||||
@@ -67,7 +67,7 @@ public final class ParamsRequestCondition extends AbstractRequestCondition<Param
|
||||
* Return the contained request parameter expressions.
|
||||
*/
|
||||
public Set<NameValueExpression<String>> getExpressions() {
|
||||
return new LinkedHashSet<NameValueExpression<String>>(this.expressions);
|
||||
return new LinkedHashSet<>(this.expressions);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,7 +86,7 @@ public final class ParamsRequestCondition extends AbstractRequestCondition<Param
|
||||
*/
|
||||
@Override
|
||||
public ParamsRequestCondition combine(ParamsRequestCondition other) {
|
||||
Set<ParamExpression> set = new LinkedHashSet<ParamExpression>(this.expressions);
|
||||
Set<ParamExpression> set = new LinkedHashSet<>(this.expressions);
|
||||
set.addAll(other.expressions);
|
||||
return new ParamsRequestCondition(set);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -51,7 +51,7 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
|
||||
|
||||
private final boolean useTrailingSlashMatch;
|
||||
|
||||
private final List<String> fileExtensions = new ArrayList<String>();
|
||||
private final List<String> fileExtensions = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -126,7 +126,7 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
|
||||
if (patterns == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
Set<String> result = new LinkedHashSet<String>(patterns.size());
|
||||
Set<String> result = new LinkedHashSet<>(patterns.size());
|
||||
for (String pattern : patterns) {
|
||||
if (StringUtils.hasLength(pattern) && !pattern.startsWith("/")) {
|
||||
pattern = "/" + pattern;
|
||||
@@ -162,7 +162,7 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
|
||||
*/
|
||||
@Override
|
||||
public PatternsRequestCondition combine(PatternsRequestCondition other) {
|
||||
Set<String> result = new LinkedHashSet<String>();
|
||||
Set<String> result = new LinkedHashSet<>();
|
||||
if (!this.patterns.isEmpty() && !other.patterns.isEmpty()) {
|
||||
for (String pattern1 : this.patterns) {
|
||||
for (String pattern2 : other.patterns) {
|
||||
@@ -224,7 +224,7 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
|
||||
* @return a collection of matching patterns sorted with the closest match at the top
|
||||
*/
|
||||
public List<String> getMatchingPatterns(String lookupPath) {
|
||||
List<String> matches = new ArrayList<String>();
|
||||
List<String> matches = new ArrayList<>();
|
||||
for (String pattern : this.patterns) {
|
||||
String match = getMatchingPattern(pattern, lookupPath);
|
||||
if (match != null) {
|
||||
|
||||
@@ -89,7 +89,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
|
||||
* @param manager used to determine requested media types
|
||||
*/
|
||||
public ProducesRequestCondition(String[] produces, String[] headers, ContentNegotiationManager manager) {
|
||||
this.expressions = new ArrayList<ProduceMediaTypeExpression>(parseExpressions(produces, headers));
|
||||
this.expressions = new ArrayList<>(parseExpressions(produces, headers));
|
||||
Collections.sort(this.expressions);
|
||||
this.contentNegotiationManager = (manager != null ? manager : new ContentNegotiationManager());
|
||||
}
|
||||
@@ -98,14 +98,14 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
|
||||
* Private constructor with already parsed media type expressions.
|
||||
*/
|
||||
private ProducesRequestCondition(Collection<ProduceMediaTypeExpression> expressions, ContentNegotiationManager manager) {
|
||||
this.expressions = new ArrayList<ProduceMediaTypeExpression>(expressions);
|
||||
this.expressions = new ArrayList<>(expressions);
|
||||
Collections.sort(this.expressions);
|
||||
this.contentNegotiationManager = (manager != null ? manager : new ContentNegotiationManager());
|
||||
}
|
||||
|
||||
|
||||
private Set<ProduceMediaTypeExpression> parseExpressions(String[] produces, String[] headers) {
|
||||
Set<ProduceMediaTypeExpression> result = new LinkedHashSet<ProduceMediaTypeExpression>();
|
||||
Set<ProduceMediaTypeExpression> result = new LinkedHashSet<>();
|
||||
if (headers != null) {
|
||||
for (String header : headers) {
|
||||
HeaderExpression expr = new HeaderExpression(header);
|
||||
@@ -128,14 +128,14 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
|
||||
* Return the contained "produces" expressions.
|
||||
*/
|
||||
public Set<MediaTypeExpression> getExpressions() {
|
||||
return new LinkedHashSet<MediaTypeExpression>(this.expressions);
|
||||
return new LinkedHashSet<>(this.expressions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the contained producible media types excluding negated expressions.
|
||||
*/
|
||||
public Set<MediaType> getProducibleMediaTypes() {
|
||||
Set<MediaType> result = new LinkedHashSet<MediaType>();
|
||||
Set<MediaType> result = new LinkedHashSet<>();
|
||||
for (ProduceMediaTypeExpression expression : this.expressions) {
|
||||
if (!expression.isNegated()) {
|
||||
result.add(expression.getMediaType());
|
||||
@@ -196,7 +196,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
|
||||
catch (HttpMediaTypeException ex) {
|
||||
return null;
|
||||
}
|
||||
Set<ProduceMediaTypeExpression> result = new LinkedHashSet<ProduceMediaTypeExpression>(expressions);
|
||||
Set<ProduceMediaTypeExpression> result = new LinkedHashSet<>(expressions);
|
||||
for (Iterator<ProduceMediaTypeExpression> iterator = result.iterator(); iterator.hasNext();) {
|
||||
ProduceMediaTypeExpression expression = iterator.next();
|
||||
if (!expression.match(acceptedMediaTypes)) {
|
||||
|
||||
@@ -57,7 +57,7 @@ public final class RequestMethodsRequestCondition extends AbstractRequestConditi
|
||||
}
|
||||
|
||||
private RequestMethodsRequestCondition(Collection<RequestMethod> requestMethods) {
|
||||
this.methods = Collections.unmodifiableSet(new LinkedHashSet<RequestMethod>(requestMethods));
|
||||
this.methods = Collections.unmodifiableSet(new LinkedHashSet<>(requestMethods));
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public final class RequestMethodsRequestCondition extends AbstractRequestConditi
|
||||
*/
|
||||
@Override
|
||||
public RequestMethodsRequestCondition combine(RequestMethodsRequestCondition other) {
|
||||
Set<RequestMethod> set = new LinkedHashSet<RequestMethod>(this.methods);
|
||||
Set<RequestMethod> set = new LinkedHashSet<>(this.methods);
|
||||
set.addAll(other.methods);
|
||||
return new RequestMethodsRequestCondition(set);
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||
private Map<String, MultiValueMap<String, String>> extractMatrixVariables(
|
||||
HttpServletRequest request, Map<String, String> uriVariables) {
|
||||
|
||||
Map<String, MultiValueMap<String, String>> result = new LinkedHashMap<String, MultiValueMap<String, String>>();
|
||||
Map<String, MultiValueMap<String, String>> result = new LinkedHashMap<>();
|
||||
for (Entry<String, String> uriVar : uriVariables.entrySet()) {
|
||||
String uriVarValue = uriVar.getValue();
|
||||
|
||||
@@ -219,12 +219,12 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||
throw new HttpMediaTypeNotSupportedException(ex.getMessage());
|
||||
}
|
||||
}
|
||||
throw new HttpMediaTypeNotSupportedException(contentType, new ArrayList<MediaType>(mediaTypes));
|
||||
throw new HttpMediaTypeNotSupportedException(contentType, new ArrayList<>(mediaTypes));
|
||||
}
|
||||
|
||||
if (helper.hasProducesMismatch()) {
|
||||
Set<MediaType> mediaTypes = helper.getProducibleMediaTypes();
|
||||
throw new HttpMediaTypeNotAcceptableException(new ArrayList<MediaType>(mediaTypes));
|
||||
throw new HttpMediaTypeNotAcceptableException(new ArrayList<>(mediaTypes));
|
||||
}
|
||||
|
||||
if (helper.hasParamsMismatch()) {
|
||||
@@ -241,7 +241,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||
*/
|
||||
private static class PartialMatchHelper {
|
||||
|
||||
private final List<PartialMatch> partialMatches = new ArrayList<PartialMatch>();
|
||||
private final List<PartialMatch> partialMatches = new ArrayList<>();
|
||||
|
||||
|
||||
public PartialMatchHelper(Set<RequestMappingInfo> infos, HttpServletRequest request) {
|
||||
@@ -312,7 +312,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||
* Return declared HTTP methods.
|
||||
*/
|
||||
public Set<String> getAllowedMethods() {
|
||||
Set<String> result = new LinkedHashSet<String>();
|
||||
Set<String> result = new LinkedHashSet<>();
|
||||
for (PartialMatch match : this.partialMatches) {
|
||||
for (RequestMethod method : match.getInfo().getMethodsCondition().getMethods()) {
|
||||
result.add(method.name());
|
||||
@@ -326,7 +326,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||
* match the "methods" condition.
|
||||
*/
|
||||
public Set<MediaType> getConsumableMediaTypes() {
|
||||
Set<MediaType> result = new LinkedHashSet<MediaType>();
|
||||
Set<MediaType> result = new LinkedHashSet<>();
|
||||
for (PartialMatch match : this.partialMatches) {
|
||||
if (match.hasMethodsMatch()) {
|
||||
result.addAll(match.getInfo().getConsumesCondition().getConsumableMediaTypes());
|
||||
@@ -340,7 +340,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||
* match the "methods" and "consumes" conditions.
|
||||
*/
|
||||
public Set<MediaType> getProducibleMediaTypes() {
|
||||
Set<MediaType> result = new LinkedHashSet<MediaType>();
|
||||
Set<MediaType> result = new LinkedHashSet<>();
|
||||
for (PartialMatch match : this.partialMatches) {
|
||||
if (match.hasConsumesMatch()) {
|
||||
result.addAll(match.getInfo().getProducesCondition().getProducibleMediaTypes());
|
||||
@@ -354,7 +354,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||
* match the "methods", "consumes", and "params" conditions.
|
||||
*/
|
||||
public List<String[]> getParamConditions() {
|
||||
List<String[]> result = new ArrayList<String[]>();
|
||||
List<String[]> result = new ArrayList<>();
|
||||
for (PartialMatch match : this.partialMatches) {
|
||||
if (match.hasProducesMatch()) {
|
||||
Set<NameValueExpression<String>> set = match.getInfo().getParamsCondition().getExpressions();
|
||||
@@ -441,7 +441,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
|
||||
}
|
||||
|
||||
private static Set<HttpMethod> initAllowedHttpMethods(Set<String> declaredMethods) {
|
||||
Set<HttpMethod> result = new LinkedHashSet<HttpMethod>(declaredMethods.size());
|
||||
Set<HttpMethod> result = new LinkedHashSet<>(declaredMethods.size());
|
||||
if (declaredMethods.isEmpty()) {
|
||||
for (HttpMethod method : HttpMethod.values()) {
|
||||
if (!HttpMethod.TRACE.equals(method)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -104,11 +104,11 @@ public abstract class AbstractMessageConverterMethodArgumentResolver implements
|
||||
* by specificity via {@link MediaType#sortBySpecificity(List)}.
|
||||
*/
|
||||
private static List<MediaType> getAllSupportedMediaTypes(List<HttpMessageConverter<?>> messageConverters) {
|
||||
Set<MediaType> allSupportedMediaTypes = new LinkedHashSet<MediaType>();
|
||||
Set<MediaType> allSupportedMediaTypes = new LinkedHashSet<>();
|
||||
for (HttpMessageConverter<?> messageConverter : messageConverters) {
|
||||
allSupportedMediaTypes.addAll(messageConverter.getSupportedMediaTypes());
|
||||
}
|
||||
List<MediaType> result = new ArrayList<MediaType>(allSupportedMediaTypes);
|
||||
List<MediaType> result = new ArrayList<>(allSupportedMediaTypes);
|
||||
MediaType.sortBySpecificity(result);
|
||||
return Collections.unmodifiableList(result);
|
||||
}
|
||||
|
||||
@@ -63,12 +63,12 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
|
||||
implements HandlerMethodReturnValueHandler {
|
||||
|
||||
/* Extensions associated with the built-in message converters */
|
||||
private static final Set<String> WHITELISTED_EXTENSIONS = new HashSet<String>(Arrays.asList(
|
||||
private static final Set<String> WHITELISTED_EXTENSIONS = new HashSet<>(Arrays.asList(
|
||||
"txt", "text", "yml", "properties", "csv",
|
||||
"json", "xml", "atom", "rss",
|
||||
"png", "jpe", "jpeg", "jpg", "gif", "wbmp", "bmp"));
|
||||
|
||||
private static final Set<String> WHITELISTED_MEDIA_BASE_TYPES = new HashSet<String>(
|
||||
private static final Set<String> WHITELISTED_MEDIA_BASE_TYPES = new HashSet<>(
|
||||
Arrays.asList("audio", "image", "video"));
|
||||
|
||||
private static final MediaType MEDIA_TYPE_APPLICATION = new MediaType("application");
|
||||
@@ -87,7 +87,7 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
|
||||
|
||||
private final PathExtensionContentNegotiationStrategy pathStrategy;
|
||||
|
||||
private final Set<String> safeExtensions = new HashSet<String>();
|
||||
private final Set<String> safeExtensions = new HashSet<>();
|
||||
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
|
||||
throw new IllegalArgumentException("No converter found for return value of type: " + valueType);
|
||||
}
|
||||
|
||||
Set<MediaType> compatibleMediaTypes = new LinkedHashSet<MediaType>();
|
||||
Set<MediaType> compatibleMediaTypes = new LinkedHashSet<>();
|
||||
for (MediaType requestedType : requestedMediaTypes) {
|
||||
for (MediaType producibleType : producibleMediaTypes) {
|
||||
if (requestedType.isCompatibleWith(producibleType)) {
|
||||
@@ -203,7 +203,7 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
|
||||
return;
|
||||
}
|
||||
|
||||
List<MediaType> mediaTypes = new ArrayList<MediaType>(compatibleMediaTypes);
|
||||
List<MediaType> mediaTypes = new ArrayList<>(compatibleMediaTypes);
|
||||
MediaType.sortBySpecificityAndQuality(mediaTypes);
|
||||
|
||||
MediaType selectedMediaType = null;
|
||||
@@ -305,10 +305,10 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
|
||||
protected List<MediaType> getProducibleMediaTypes(HttpServletRequest request, Class<?> valueClass, Type declaredType) {
|
||||
Set<MediaType> mediaTypes = (Set<MediaType>) request.getAttribute(HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE);
|
||||
if (!CollectionUtils.isEmpty(mediaTypes)) {
|
||||
return new ArrayList<MediaType>(mediaTypes);
|
||||
return new ArrayList<>(mediaTypes);
|
||||
}
|
||||
else if (!this.allSupportedMediaTypes.isEmpty()) {
|
||||
List<MediaType> result = new ArrayList<MediaType>();
|
||||
List<MediaType> result = new ArrayList<>();
|
||||
for (HttpMessageConverter<?> converter : this.messageConverters) {
|
||||
if (converter instanceof GenericHttpMessageConverter && declaredType != null) {
|
||||
if (((GenericHttpMessageConverter<?>) converter).canWrite(declaredType, valueClass, null)) {
|
||||
|
||||
@@ -45,7 +45,7 @@ public class DeferredResultMethodReturnValueHandler implements AsyncHandlerMetho
|
||||
|
||||
|
||||
public DeferredResultMethodReturnValueHandler() {
|
||||
this.adapterMap = new HashMap<Class<?>, DeferredResultAdapter>(5);
|
||||
this.adapterMap = new HashMap<>(5);
|
||||
this.adapterMap.put(DeferredResult.class, new SimpleDeferredResultAdapter());
|
||||
this.adapterMap.put(ListenableFuture.class, new ListenableFutureAdapter());
|
||||
this.adapterMap.put(CompletionStage.class, new CompletionStageAdapter());
|
||||
@@ -119,7 +119,7 @@ public class DeferredResultMethodReturnValueHandler implements AsyncHandlerMetho
|
||||
@Override
|
||||
public DeferredResult<?> adaptToDeferredResult(Object returnValue) {
|
||||
Assert.isInstanceOf(ListenableFuture.class, returnValue);
|
||||
final DeferredResult<Object> result = new DeferredResult<Object>();
|
||||
final DeferredResult<Object> result = new DeferredResult<>();
|
||||
((ListenableFuture<?>) returnValue).addCallback(new ListenableFutureCallback<Object>() {
|
||||
@Override
|
||||
public void onSuccess(Object value) {
|
||||
@@ -143,7 +143,7 @@ public class DeferredResultMethodReturnValueHandler implements AsyncHandlerMetho
|
||||
@Override
|
||||
public DeferredResult<?> adaptToDeferredResult(Object returnValue) {
|
||||
Assert.isInstanceOf(CompletionStage.class, returnValue);
|
||||
final DeferredResult<Object> result = new DeferredResult<Object>();
|
||||
final DeferredResult<Object> result = new DeferredResult<>();
|
||||
@SuppressWarnings("unchecked")
|
||||
CompletionStage<?> future = (CompletionStage<?>) returnValue;
|
||||
future.handle(new BiFunction<Object, Throwable, Object>() {
|
||||
|
||||
@@ -83,25 +83,25 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce
|
||||
|
||||
private ContentNegotiationManager contentNegotiationManager = new ContentNegotiationManager();
|
||||
|
||||
private final List<Object> responseBodyAdvice = new ArrayList<Object>();
|
||||
private final List<Object> responseBodyAdvice = new ArrayList<>();
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
private final Map<Class<?>, ExceptionHandlerMethodResolver> exceptionHandlerCache =
|
||||
new ConcurrentHashMap<Class<?>, ExceptionHandlerMethodResolver>(64);
|
||||
new ConcurrentHashMap<>(64);
|
||||
|
||||
private final Map<ControllerAdviceBean, ExceptionHandlerMethodResolver> exceptionHandlerAdviceCache =
|
||||
new LinkedHashMap<ControllerAdviceBean, ExceptionHandlerMethodResolver>();
|
||||
new LinkedHashMap<>();
|
||||
|
||||
|
||||
public ExceptionHandlerExceptionResolver() {
|
||||
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
|
||||
stringHttpMessageConverter.setWriteAcceptCharset(false); // see SPR-7316
|
||||
|
||||
this.messageConverters = new ArrayList<HttpMessageConverter<?>>();
|
||||
this.messageConverters = new ArrayList<>();
|
||||
this.messageConverters.add(new ByteArrayHttpMessageConverter());
|
||||
this.messageConverters.add(stringHttpMessageConverter);
|
||||
this.messageConverters.add(new SourceHttpMessageConverter<Source>());
|
||||
this.messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce
|
||||
* and custom resolvers provided via {@link #setCustomArgumentResolvers}.
|
||||
*/
|
||||
protected List<HandlerMethodArgumentResolver> getDefaultArgumentResolvers() {
|
||||
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<HandlerMethodArgumentResolver>();
|
||||
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>();
|
||||
|
||||
// Annotation-based argument resolution
|
||||
resolvers.add(new SessionAttributeMethodArgumentResolver());
|
||||
@@ -317,7 +317,7 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce
|
||||
* custom handlers provided via {@link #setReturnValueHandlers}.
|
||||
*/
|
||||
protected List<HandlerMethodReturnValueHandler> getDefaultReturnValueHandlers() {
|
||||
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<HandlerMethodReturnValueHandler>();
|
||||
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>();
|
||||
|
||||
// Single-purpose return value types
|
||||
handlers.add(new ModelAndViewMethodReturnValueHandler());
|
||||
|
||||
@@ -124,11 +124,11 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro
|
||||
|
||||
Object body = readWithMessageConverters(webRequest, parameter, paramType);
|
||||
if (RequestEntity.class == parameter.getParameterType()) {
|
||||
return new RequestEntity<Object>(body, inputMessage.getHeaders(),
|
||||
return new RequestEntity<>(body, inputMessage.getHeaders(),
|
||||
inputMessage.getMethod(), inputMessage.getURI());
|
||||
}
|
||||
else {
|
||||
return new HttpEntity<Object>(body, inputMessage.getHeaders());
|
||||
return new HttpEntity<>(body, inputMessage.getHeaders());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro
|
||||
return entityHeaders.getVary();
|
||||
}
|
||||
List<String> entityHeadersVary = entityHeaders.getVary();
|
||||
List<String> result = new ArrayList<String>(entityHeadersVary);
|
||||
List<String> result = new ArrayList<>(entityHeadersVary);
|
||||
for (String header : responseHeaders.get(HttpHeaders.VARY)) {
|
||||
for (String existing : StringUtils.tokenizeToStringArray(header, ",")) {
|
||||
if ("*".equals(existing)) {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class MatrixVariableMapMethodArgumentResolver implements HandlerMethodArg
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
||||
String pathVariable = parameter.getParameterAnnotation(MatrixVariable.class).pathVar();
|
||||
|
||||
if (!pathVariable.equals(ValueConstants.DEFAULT_NONE)) {
|
||||
|
||||
@@ -86,7 +86,7 @@ public class MatrixVariableMethodArgumentResolver extends AbstractNamedValueMeth
|
||||
}
|
||||
else {
|
||||
boolean found = false;
|
||||
paramValues = new ArrayList<String>();
|
||||
paramValues = new ArrayList<>();
|
||||
for (MultiValueMap<String, String> params : pathParameters.values()) {
|
||||
if (params.containsKey(name)) {
|
||||
if (found) {
|
||||
|
||||
@@ -472,7 +472,7 @@ public class MvcUriComponentsBuilder {
|
||||
" does not match number of argument values " + argCount);
|
||||
}
|
||||
|
||||
final Map<String, Object> uriVars = new HashMap<String, Object>();
|
||||
final Map<String, Object> uriVars = new HashMap<>();
|
||||
for (int i = 0; i < paramCount; i++) {
|
||||
MethodParameter param = new SynthesizingMethodParameter(method, i);
|
||||
param.initParameterNameDiscovery(parameterNameDiscoverer);
|
||||
|
||||
@@ -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.
|
||||
@@ -62,7 +62,7 @@ public class PathVariableMapMethodArgumentResolver implements HandlerMethodArgum
|
||||
HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST);
|
||||
|
||||
if (!CollectionUtils.isEmpty(uriTemplateVars)) {
|
||||
return new LinkedHashMap<String, String>(uriTemplateVars);
|
||||
return new LinkedHashMap<>(uriTemplateVars);
|
||||
}
|
||||
else {
|
||||
return Collections.emptyMap();
|
||||
|
||||
@@ -111,7 +111,7 @@ public class PathVariableMethodArgumentResolver extends AbstractNamedValueMethod
|
||||
int scope = RequestAttributes.SCOPE_REQUEST;
|
||||
Map<String, Object> pathVars = (Map<String, Object>) request.getAttribute(key, scope);
|
||||
if (pathVars == null) {
|
||||
pathVars = new HashMap<String, Object>();
|
||||
pathVars = new HashMap<>();
|
||||
request.setAttribute(key, pathVars, scope);
|
||||
}
|
||||
pathVars.put(name, arg);
|
||||
|
||||
@@ -132,7 +132,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
|
||||
private List<HttpMessageConverter<?>> messageConverters;
|
||||
|
||||
private List<Object> requestResponseBodyAdvice = new ArrayList<Object>();
|
||||
private List<Object> requestResponseBodyAdvice = new ArrayList<>();
|
||||
|
||||
private WebBindingInitializer webBindingInitializer;
|
||||
|
||||
@@ -158,27 +158,27 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
|
||||
|
||||
private final Map<Class<?>, SessionAttributesHandler> sessionAttributesHandlerCache =
|
||||
new ConcurrentHashMap<Class<?>, SessionAttributesHandler>(64);
|
||||
new ConcurrentHashMap<>(64);
|
||||
|
||||
private final Map<Class<?>, Set<Method>> initBinderCache = new ConcurrentHashMap<Class<?>, Set<Method>>(64);
|
||||
private final Map<Class<?>, Set<Method>> initBinderCache = new ConcurrentHashMap<>(64);
|
||||
|
||||
private final Map<ControllerAdviceBean, Set<Method>> initBinderAdviceCache =
|
||||
new LinkedHashMap<ControllerAdviceBean, Set<Method>>();
|
||||
new LinkedHashMap<>();
|
||||
|
||||
private final Map<Class<?>, Set<Method>> modelAttributeCache = new ConcurrentHashMap<Class<?>, Set<Method>>(64);
|
||||
private final Map<Class<?>, Set<Method>> modelAttributeCache = new ConcurrentHashMap<>(64);
|
||||
|
||||
private final Map<ControllerAdviceBean, Set<Method>> modelAttributeAdviceCache =
|
||||
new LinkedHashMap<ControllerAdviceBean, Set<Method>>();
|
||||
new LinkedHashMap<>();
|
||||
|
||||
|
||||
public RequestMappingHandlerAdapter() {
|
||||
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
|
||||
stringHttpMessageConverter.setWriteAcceptCharset(false); // see SPR-7316
|
||||
|
||||
this.messageConverters = new ArrayList<HttpMessageConverter<?>>(4);
|
||||
this.messageConverters = new ArrayList<>(4);
|
||||
this.messageConverters.add(new ByteArrayHttpMessageConverter());
|
||||
this.messageConverters.add(stringHttpMessageConverter);
|
||||
this.messageConverters.add(new SourceHttpMessageConverter<Source>());
|
||||
this.messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
List<ControllerAdviceBean> beans = ControllerAdviceBean.findAnnotatedBeans(getApplicationContext());
|
||||
AnnotationAwareOrderComparator.sort(beans);
|
||||
|
||||
List<Object> requestResponseBodyAdviceBeans = new ArrayList<Object>();
|
||||
List<Object> requestResponseBodyAdviceBeans = new ArrayList<>();
|
||||
|
||||
for (ControllerAdviceBean bean : beans) {
|
||||
Set<Method> attrMethods = MethodIntrospector.selectMethods(bean.getBeanType(), MODEL_ATTRIBUTE_METHODS);
|
||||
@@ -578,7 +578,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
* and custom resolvers provided via {@link #setCustomArgumentResolvers}.
|
||||
*/
|
||||
private List<HandlerMethodArgumentResolver> getDefaultArgumentResolvers() {
|
||||
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<HandlerMethodArgumentResolver>();
|
||||
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>();
|
||||
|
||||
// Annotation-based argument resolution
|
||||
resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), false));
|
||||
@@ -625,7 +625,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
* methods including built-in and custom resolvers.
|
||||
*/
|
||||
private List<HandlerMethodArgumentResolver> getDefaultInitBinderArgumentResolvers() {
|
||||
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<HandlerMethodArgumentResolver>();
|
||||
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>();
|
||||
|
||||
// Annotation-based argument resolution
|
||||
resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), false));
|
||||
@@ -658,7 +658,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
* custom handlers provided via {@link #setReturnValueHandlers}.
|
||||
*/
|
||||
private List<HandlerMethodReturnValueHandler> getDefaultReturnValueHandlers() {
|
||||
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<HandlerMethodReturnValueHandler>();
|
||||
List<HandlerMethodReturnValueHandler> handlers = new ArrayList<>();
|
||||
|
||||
// Single-purpose return value types
|
||||
handlers.add(new ModelAndViewMethodReturnValueHandler());
|
||||
@@ -854,7 +854,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
methods = MethodIntrospector.selectMethods(handlerType, MODEL_ATTRIBUTE_METHODS);
|
||||
this.modelAttributeCache.put(handlerType, methods);
|
||||
}
|
||||
List<InvocableHandlerMethod> attrMethods = new ArrayList<InvocableHandlerMethod>();
|
||||
List<InvocableHandlerMethod> attrMethods = new ArrayList<>();
|
||||
// Global methods first
|
||||
for (Entry<ControllerAdviceBean, Set<Method>> entry : this.modelAttributeAdviceCache.entrySet()) {
|
||||
if (entry.getKey().isApplicableToBeanType(handlerType)) {
|
||||
@@ -886,7 +886,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
methods = MethodIntrospector.selectMethods(handlerType, INIT_BINDER_METHODS);
|
||||
this.initBinderCache.put(handlerType, methods);
|
||||
}
|
||||
List<InvocableHandlerMethod> initBinderMethods = new ArrayList<InvocableHandlerMethod>();
|
||||
List<InvocableHandlerMethod> initBinderMethods = new ArrayList<>();
|
||||
// Global methods first
|
||||
for (Entry<ControllerAdviceBean, Set<Method>> entry : this.initBinderAdviceCache.entrySet()) {
|
||||
if (entry.getKey().isApplicableToBeanType(handlerType)) {
|
||||
|
||||
@@ -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.
|
||||
@@ -42,9 +42,9 @@ import org.springframework.web.method.ControllerAdviceBean;
|
||||
*/
|
||||
class RequestResponseBodyAdviceChain implements RequestBodyAdvice, ResponseBodyAdvice<Object> {
|
||||
|
||||
private final List<Object> requestBodyAdvice = new ArrayList<Object>(4);
|
||||
private final List<Object> requestBodyAdvice = new ArrayList<>(4);
|
||||
|
||||
private final List<Object> responseBodyAdvice = new ArrayList<Object>(4);
|
||||
private final List<Object> responseBodyAdvice = new ArrayList<>(4);
|
||||
|
||||
|
||||
/**
|
||||
@@ -158,7 +158,7 @@ class RequestResponseBodyAdviceChain implements RequestBodyAdvice, ResponseBodyA
|
||||
if (CollectionUtils.isEmpty(availableAdvice)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<A> result = new ArrayList<A>(availableAdvice.size());
|
||||
List<A> result = new ArrayList<>(availableAdvice.size());
|
||||
for (Object advice : availableAdvice) {
|
||||
if (advice instanceof ControllerAdviceBean) {
|
||||
ControllerAdviceBean adviceBean = (ControllerAdviceBean) advice;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,7 +62,7 @@ public class ResponseBodyEmitter {
|
||||
|
||||
private final Long timeout;
|
||||
|
||||
private final Set<DataWithMediaType> earlySendAttempts = new LinkedHashSet<DataWithMediaType>(8);
|
||||
private final Set<DataWithMediaType> earlySendAttempts = new LinkedHashSet<>(8);
|
||||
|
||||
private Handler handler;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class ResponseBodyEmitterReturnValueHandler implements AsyncHandlerMethod
|
||||
public ResponseBodyEmitterReturnValueHandler(List<HttpMessageConverter<?>> messageConverters) {
|
||||
Assert.notEmpty(messageConverters, "'messageConverters' must not be empty");
|
||||
this.messageConverters = messageConverters;
|
||||
this.adapterMap = new HashMap<Class<?>, ResponseBodyEmitterAdapter>(3);
|
||||
this.adapterMap = new HashMap<>(3);
|
||||
this.adapterMap.put(ResponseBodyEmitter.class, new SimpleResponseBodyEmitterAdapter());
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class ResponseBodyEmitterReturnValueHandler implements AsyncHandlerMethod
|
||||
outputMessage.flush();
|
||||
outputMessage = new StreamingServletServerHttpResponse(outputMessage);
|
||||
|
||||
DeferredResult<?> deferredResult = new DeferredResult<Object>(emitter.getTimeout());
|
||||
DeferredResult<?> deferredResult = new DeferredResult<>(emitter.getTimeout());
|
||||
WebAsyncUtils.getAsyncManager(webRequest).startDeferredResultProcessing(deferredResult, mavContainer);
|
||||
|
||||
HttpMessageConvertingHandler handler = new HttpMessageConvertingHandler(outputMessage, deferredResult);
|
||||
|
||||
@@ -196,7 +196,7 @@ public abstract class ResponseEntityExceptionHandler {
|
||||
if (HttpStatus.INTERNAL_SERVER_ERROR.equals(status)) {
|
||||
request.setAttribute(WebUtils.ERROR_EXCEPTION_ATTRIBUTE, ex, WebRequest.SCOPE_REQUEST);
|
||||
}
|
||||
return new ResponseEntity<Object>(body, headers, status);
|
||||
return new ResponseEntity<>(body, headers, status);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -182,7 +182,7 @@ public class SseEmitter extends ResponseBodyEmitter {
|
||||
*/
|
||||
private static class SseEventBuilderImpl implements SseEventBuilder {
|
||||
|
||||
private final Set<DataWithMediaType> dataToSend = new LinkedHashSet<DataWithMediaType>(4);
|
||||
private final Set<DataWithMediaType> dataToSend = new LinkedHashSet<>(4);
|
||||
|
||||
private StringBuilder sb;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -65,7 +65,7 @@ public class AppCacheManifestTransformer extends ResourceTransformerSupport {
|
||||
private static final Log logger = LogFactory.getLog(AppCacheManifestTransformer.class);
|
||||
|
||||
|
||||
private final Map<String, SectionTransformer> sectionTransformers = new HashMap<String, SectionTransformer>();
|
||||
private final Map<String, SectionTransformer> sectionTransformers = new HashMap<>();
|
||||
|
||||
private final String fileExtension;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -54,7 +54,7 @@ public class CssLinkResourceTransformer extends ResourceTransformerSupport {
|
||||
private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
||||
|
||||
|
||||
private final List<CssLinkParser> linkParsers = new ArrayList<CssLinkParser>();
|
||||
private final List<CssLinkParser> linkParsers = new ArrayList<>();
|
||||
|
||||
|
||||
public CssLinkResourceTransformer() {
|
||||
@@ -81,7 +81,7 @@ public class CssLinkResourceTransformer extends ResourceTransformerSupport {
|
||||
byte[] bytes = FileCopyUtils.copyToByteArray(resource.getInputStream());
|
||||
String content = new String(bytes, DEFAULT_CHARSET);
|
||||
|
||||
Set<CssLinkInfo> infos = new HashSet<CssLinkInfo>(5);
|
||||
Set<CssLinkInfo> infos = new HashSet<>(5);
|
||||
for (CssLinkParser parser : this.linkParsers) {
|
||||
parser.parseLink(content, infos);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class CssLinkResourceTransformer extends ResourceTransformerSupport {
|
||||
return resource;
|
||||
}
|
||||
|
||||
List<CssLinkInfo> sortedInfos = new ArrayList<CssLinkInfo>(infos);
|
||||
List<CssLinkInfo> sortedInfos = new ArrayList<>(infos);
|
||||
Collections.sort(sortedInfos);
|
||||
|
||||
int index = 0;
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
class DefaultResourceResolverChain implements ResourceResolverChain {
|
||||
|
||||
private final List<ResourceResolver> resolvers = new ArrayList<ResourceResolver>();
|
||||
private final List<ResourceResolver> resolvers = new ArrayList<>();
|
||||
|
||||
private int index = -1;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -35,7 +35,7 @@ class DefaultResourceTransformerChain implements ResourceTransformerChain {
|
||||
|
||||
private final ResourceResolverChain resolverChain;
|
||||
|
||||
private final List<ResourceTransformer> transformers = new ArrayList<ResourceTransformer>();
|
||||
private final List<ResourceTransformer> transformers = new ArrayList<>();
|
||||
|
||||
private int index = -1;
|
||||
|
||||
|
||||
@@ -99,11 +99,11 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
||||
private static final Log logger = LogFactory.getLog(ResourceHttpRequestHandler.class);
|
||||
|
||||
|
||||
private final List<Resource> locations = new ArrayList<Resource>(4);
|
||||
private final List<Resource> locations = new ArrayList<>(4);
|
||||
|
||||
private final List<ResourceResolver> resourceResolvers = new ArrayList<ResourceResolver>(4);
|
||||
private final List<ResourceResolver> resourceResolvers = new ArrayList<>(4);
|
||||
|
||||
private final List<ResourceTransformer> resourceTransformers = new ArrayList<ResourceTransformer>(4);
|
||||
private final List<ResourceTransformer> resourceTransformers = new ArrayList<>(4);
|
||||
|
||||
private ResourceHttpMessageConverter resourceHttpMessageConverter;
|
||||
|
||||
|
||||
@@ -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,7 +55,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
|
||||
|
||||
private PathMatcher pathMatcher = new AntPathMatcher();
|
||||
|
||||
private final Map<String, ResourceHttpRequestHandler> handlerMap = new LinkedHashMap<String, ResourceHttpRequestHandler>();
|
||||
private final Map<String, ResourceHttpRequestHandler> handlerMap = new LinkedHashMap<>();
|
||||
|
||||
private boolean autodetect = true;
|
||||
|
||||
@@ -139,7 +139,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
|
||||
logger.debug("Looking for resource handler mappings");
|
||||
|
||||
Map<String, SimpleUrlHandlerMapping> map = appContext.getBeansOfType(SimpleUrlHandlerMapping.class);
|
||||
List<SimpleUrlHandlerMapping> handlerMappings = new ArrayList<SimpleUrlHandlerMapping>(map.values());
|
||||
List<SimpleUrlHandlerMapping> handlerMappings = new ArrayList<>(map.values());
|
||||
AnnotationAwareOrderComparator.sort(handlerMappings);
|
||||
|
||||
for (SimpleUrlHandlerMapping hm : handlerMappings) {
|
||||
@@ -208,7 +208,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
|
||||
logger.trace("Getting resource URL for lookup path \"" + lookupPath + "\"");
|
||||
}
|
||||
|
||||
List<String> matchingPatterns = new ArrayList<String>();
|
||||
List<String> matchingPatterns = new ArrayList<>();
|
||||
for (String pattern : this.handlerMap.keySet()) {
|
||||
if (getPathMatcher().match(pattern, lookupPath)) {
|
||||
matchingPatterns.add(pattern);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -65,7 +65,7 @@ public class VersionResourceResolver extends AbstractResourceResolver {
|
||||
private AntPathMatcher pathMatcher = new AntPathMatcher();
|
||||
|
||||
/** Map from path pattern -> VersionStrategy */
|
||||
private final Map<String, VersionStrategy> versionStrategyMap = new LinkedHashMap<String, VersionStrategy>();
|
||||
private final Map<String, VersionStrategy> versionStrategyMap = new LinkedHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ public class VersionResourceResolver extends AbstractResourceResolver {
|
||||
*/
|
||||
public VersionResourceResolver addFixedVersionStrategy(String version, String... pathPatterns) {
|
||||
List<String> patternsList = Arrays.asList(pathPatterns);
|
||||
List<String> prefixedPatterns = new ArrayList<String>(pathPatterns.length);
|
||||
List<String> prefixedPatterns = new ArrayList<>(pathPatterns.length);
|
||||
String versionPrefix = "/" + version;
|
||||
for (String pattern : patternsList) {
|
||||
prefixedPatterns.add(pattern);
|
||||
@@ -223,7 +223,7 @@ public class VersionResourceResolver extends AbstractResourceResolver {
|
||||
*/
|
||||
protected VersionStrategy getStrategyForPath(String requestPath) {
|
||||
String path = "/".concat(requestPath);
|
||||
List<String> matchingPatterns = new ArrayList<String>();
|
||||
List<String> matchingPatterns = new ArrayList<>();
|
||||
for (String pattern : this.versionStrategyMap.keySet()) {
|
||||
if (this.pathMatcher.match(pattern, path)) {
|
||||
matchingPatterns.add(pattern);
|
||||
|
||||
@@ -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.
|
||||
@@ -131,7 +131,7 @@ public abstract class AbstractFlashMapManager implements FlashMapManager {
|
||||
* Return a list of expired FlashMap instances contained in the given list.
|
||||
*/
|
||||
private List<FlashMap> getExpiredFlashMaps(List<FlashMap> allMaps) {
|
||||
List<FlashMap> result = new LinkedList<FlashMap>();
|
||||
List<FlashMap> result = new LinkedList<>();
|
||||
for (FlashMap map : allMaps) {
|
||||
if (map.isExpired()) {
|
||||
result.add(map);
|
||||
@@ -145,7 +145,7 @@ public abstract class AbstractFlashMapManager implements FlashMapManager {
|
||||
* @return a matching FlashMap or {@code null}
|
||||
*/
|
||||
private FlashMap getMatchingFlashMap(List<FlashMap> allMaps, HttpServletRequest request) {
|
||||
List<FlashMap> result = new LinkedList<FlashMap>();
|
||||
List<FlashMap> result = new LinkedList<>();
|
||||
for (FlashMap flashMap : allMaps) {
|
||||
if (isFlashMapForRequest(flashMap, request)) {
|
||||
result.add(flashMap);
|
||||
@@ -208,14 +208,14 @@ public abstract class AbstractFlashMapManager implements FlashMapManager {
|
||||
if (mutex != null) {
|
||||
synchronized (mutex) {
|
||||
List<FlashMap> allFlashMaps = retrieveFlashMaps(request);
|
||||
allFlashMaps = (allFlashMaps != null ? allFlashMaps : new CopyOnWriteArrayList<FlashMap>());
|
||||
allFlashMaps = (allFlashMaps != null ? allFlashMaps : new CopyOnWriteArrayList<>());
|
||||
allFlashMaps.add(flashMap);
|
||||
updateFlashMaps(allFlashMaps, request, response);
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<FlashMap> allFlashMaps = retrieveFlashMaps(request);
|
||||
allFlashMaps = (allFlashMaps != null ? allFlashMaps : new LinkedList<FlashMap>());
|
||||
allFlashMaps = (allFlashMaps != null ? allFlashMaps : new LinkedList<>());
|
||||
allFlashMaps.add(flashMap);
|
||||
updateFlashMaps(allFlashMaps, request, response);
|
||||
}
|
||||
|
||||
@@ -840,7 +840,7 @@ public class RequestContext {
|
||||
*/
|
||||
public Errors getErrors(String name, boolean htmlEscape) {
|
||||
if (this.errorsMap == null) {
|
||||
this.errorsMap = new HashMap<String, Errors>();
|
||||
this.errorsMap = new HashMap<>();
|
||||
}
|
||||
Errors errors = this.errorsMap.get(name);
|
||||
boolean put = false;
|
||||
|
||||
@@ -125,7 +125,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
||||
*/
|
||||
public WebContentGenerator(boolean restrictDefaultSupportedMethods) {
|
||||
if (restrictDefaultSupportedMethods) {
|
||||
this.supportedMethods = new LinkedHashSet<String>(4);
|
||||
this.supportedMethods = new LinkedHashSet<>(4);
|
||||
this.supportedMethods.add(METHOD_GET);
|
||||
this.supportedMethods.add(METHOD_HEAD);
|
||||
this.supportedMethods.add(METHOD_POST);
|
||||
@@ -149,7 +149,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
||||
*/
|
||||
public final void setSupportedMethods(String... methods) {
|
||||
if (!ObjectUtils.isEmpty(methods)) {
|
||||
this.supportedMethods = new LinkedHashSet<String>(Arrays.asList(methods));
|
||||
this.supportedMethods = new LinkedHashSet<>(Arrays.asList(methods));
|
||||
}
|
||||
else {
|
||||
this.supportedMethods = null;
|
||||
@@ -167,7 +167,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
||||
private void initAllowHeader() {
|
||||
Collection<String> allowedMethods;
|
||||
if (this.supportedMethods == null) {
|
||||
allowedMethods = new ArrayList<String>(HttpMethod.values().length - 1);
|
||||
allowedMethods = new ArrayList<>(HttpMethod.values().length - 1);
|
||||
for (HttpMethod method : HttpMethod.values()) {
|
||||
if (!HttpMethod.TRACE.equals(method)) {
|
||||
allowedMethods.add(method.name());
|
||||
@@ -178,7 +178,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
||||
allowedMethods = this.supportedMethods;
|
||||
}
|
||||
else {
|
||||
allowedMethods = new ArrayList<String>(this.supportedMethods);
|
||||
allowedMethods = new ArrayList<>(this.supportedMethods);
|
||||
allowedMethods.add(HttpMethod.OPTIONS.name());
|
||||
|
||||
}
|
||||
@@ -593,7 +593,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
||||
if (!response.containsHeader(HttpHeaders.VARY)) {
|
||||
return Arrays.asList(getVaryByRequestHeaders());
|
||||
}
|
||||
Collection<String> result = new ArrayList<String>(getVaryByRequestHeaders().length);
|
||||
Collection<String> result = new ArrayList<>(getVaryByRequestHeaders().length);
|
||||
Collections.addAll(result, getVaryByRequestHeaders());
|
||||
for (String header : response.getHeaders(HttpHeaders.VARY)) {
|
||||
for (String existing : StringUtils.tokenizeToStringArray(header, ",")) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -161,7 +161,7 @@ public class MessageTag extends HtmlEscapingAwareTag implements ArgumentAware {
|
||||
|
||||
@Override
|
||||
protected final int doStartTagInternal() throws JspException, IOException {
|
||||
this.nestedArguments = new LinkedList<Object>();
|
||||
this.nestedArguments = new LinkedList<>();
|
||||
return EVAL_BODY_INCLUDE;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -161,8 +161,8 @@ public class UrlTag extends HtmlEscapingAwareTag implements ParamAware {
|
||||
|
||||
@Override
|
||||
public int doStartTagInternal() throws JspException {
|
||||
this.params = new LinkedList<Param>();
|
||||
this.templateParams = new HashSet<String>();
|
||||
this.params = new LinkedList<>();
|
||||
this.templateParams = new HashSet<>();
|
||||
return EVAL_BODY_INCLUDE;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -397,7 +397,7 @@ public abstract class AbstractHtmlElementTag extends AbstractDataBoundFormElemen
|
||||
@Override
|
||||
public void setDynamicAttribute(String uri, String localName, Object value ) throws JspException {
|
||||
if (this.dynamicAttributes == null) {
|
||||
this.dynamicAttributes = new HashMap<String, Object>();
|
||||
this.dynamicAttributes = new HashMap<>();
|
||||
}
|
||||
if (!isValidDynamicAttribute(localName, value)) {
|
||||
throw new IllegalArgumentException(
|
||||
|
||||
@@ -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.
|
||||
@@ -170,7 +170,7 @@ public class ErrorsTag extends AbstractHtmlElementBodyTag implements BodyTag {
|
||||
*/
|
||||
@Override
|
||||
protected void exposeAttributes() throws JspException {
|
||||
List<String> errorMessages = new ArrayList<String>();
|
||||
List<String> errorMessages = new ArrayList<>();
|
||||
errorMessages.addAll(Arrays.asList(getBindStatus().getErrorMessages()));
|
||||
this.oldMessages = this.pageContext.getAttribute(MESSAGES_ATTRIBUTE, PageContext.PAGE_SCOPE);
|
||||
this.pageContext.setAttribute(MESSAGES_ATTRIBUTE, errorMessages, PageContext.PAGE_SCOPE);
|
||||
|
||||
@@ -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.
|
||||
@@ -127,7 +127,7 @@ abstract class SelectedValueComparator {
|
||||
private static boolean exhaustiveCollectionCompare(
|
||||
Collection<?> collection, Object candidateValue, BindStatus bindStatus) {
|
||||
|
||||
Map<PropertyEditor, Object> convertedValueCache = new HashMap<PropertyEditor, Object>(1);
|
||||
Map<PropertyEditor, Object> convertedValueCache = new HashMap<>(1);
|
||||
PropertyEditor editor = null;
|
||||
boolean candidateIsString = (candidateValue instanceof String);
|
||||
if (!candidateIsString) {
|
||||
|
||||
@@ -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.
|
||||
@@ -44,7 +44,7 @@ public class TagWriter {
|
||||
/**
|
||||
* Stores {@link TagStateEntry tag state}. Stack model naturally supports tag nesting.
|
||||
*/
|
||||
private final Stack<TagStateEntry> tagState = new Stack<TagStateEntry>();
|
||||
private final Stack<TagStateEntry> tagState = new Stack<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,7 +64,7 @@ public abstract class AbstractCachingViewResolver extends WebApplicationObjectSu
|
||||
private boolean cacheUnresolved = true;
|
||||
|
||||
/** Fast access cache for Views, returning already cached instances without a global lock */
|
||||
private final Map<Object, View> viewAccessCache = new ConcurrentHashMap<Object, View>(DEFAULT_CACHE_LIMIT);
|
||||
private final Map<Object, View> viewAccessCache = new ConcurrentHashMap<>(DEFAULT_CACHE_LIMIT);
|
||||
|
||||
/** Map from view key to View instance, synchronized for View creation */
|
||||
@SuppressWarnings("serial")
|
||||
|
||||
@@ -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 abstract class AbstractView extends WebApplicationObjectSupport implement
|
||||
|
||||
private String requestContextAttribute;
|
||||
|
||||
private final Map<String, Object> staticAttributes = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> staticAttributes = new LinkedHashMap<>();
|
||||
|
||||
private boolean exposePathVariables = true;
|
||||
|
||||
@@ -281,7 +281,7 @@ public abstract class AbstractView extends WebApplicationObjectSupport implement
|
||||
* flag on but do not list specific bean names for this property.
|
||||
*/
|
||||
public void setExposedContextBeanNames(String... exposedContextBeanNames) {
|
||||
this.exposedContextBeanNames = new HashSet<String>(Arrays.asList(exposedContextBeanNames));
|
||||
this.exposedContextBeanNames = new HashSet<>(Arrays.asList(exposedContextBeanNames));
|
||||
}
|
||||
|
||||
|
||||
@@ -319,7 +319,7 @@ public abstract class AbstractView extends WebApplicationObjectSupport implement
|
||||
size += (model != null ? model.size() : 0);
|
||||
size += (pathVars != null ? pathVars.size() : 0);
|
||||
|
||||
Map<String, Object> mergedModel = new LinkedHashMap<String, Object>(size);
|
||||
Map<String, Object> mergedModel = new LinkedHashMap<>(size);
|
||||
mergedModel.putAll(this.staticAttributes);
|
||||
if (pathVars != null) {
|
||||
mergedModel.putAll(pathVars);
|
||||
|
||||
@@ -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.
|
||||
@@ -177,7 +177,7 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
|
||||
Collection<ViewResolver> matchingBeans =
|
||||
BeanFactoryUtils.beansOfTypeIncludingAncestors(getApplicationContext(), ViewResolver.class).values();
|
||||
if (this.viewResolvers == null) {
|
||||
this.viewResolvers = new ArrayList<ViewResolver>(matchingBeans.size());
|
||||
this.viewResolvers = new ArrayList<>(matchingBeans.size());
|
||||
for (ViewResolver viewResolver : matchingBeans) {
|
||||
if (this != viewResolver) {
|
||||
this.viewResolvers.add(viewResolver);
|
||||
@@ -249,7 +249,7 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
|
||||
Collections.singletonList(MediaType.ALL));
|
||||
|
||||
List<MediaType> producibleMediaTypes = getProducibleMediaTypes(request);
|
||||
Set<MediaType> compatibleMediaTypes = new LinkedHashSet<MediaType>();
|
||||
Set<MediaType> compatibleMediaTypes = new LinkedHashSet<>();
|
||||
for (MediaType acceptable : acceptableMediaTypes) {
|
||||
for (MediaType producible : producibleMediaTypes) {
|
||||
if (acceptable.isCompatibleWith(producible)) {
|
||||
@@ -257,7 +257,7 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
|
||||
}
|
||||
}
|
||||
}
|
||||
List<MediaType> selectedMediaTypes = new ArrayList<MediaType>(compatibleMediaTypes);
|
||||
List<MediaType> selectedMediaTypes = new ArrayList<>(compatibleMediaTypes);
|
||||
MediaType.sortBySpecificityAndQuality(selectedMediaTypes);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Requested media types are " + selectedMediaTypes + " based on Accept header types " +
|
||||
@@ -275,7 +275,7 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
|
||||
Set<MediaType> mediaTypes = (Set<MediaType>)
|
||||
request.getAttribute(HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE);
|
||||
if (!CollectionUtils.isEmpty(mediaTypes)) {
|
||||
return new ArrayList<MediaType>(mediaTypes);
|
||||
return new ArrayList<>(mediaTypes);
|
||||
}
|
||||
else {
|
||||
return Collections.singletonList(MediaType.ALL);
|
||||
@@ -294,7 +294,7 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
|
||||
private List<View> getCandidateViews(String viewName, Locale locale, List<MediaType> requestedMediaTypes)
|
||||
throws Exception {
|
||||
|
||||
List<View> candidateViews = new ArrayList<View>();
|
||||
List<View> candidateViews = new ArrayList<>();
|
||||
for (ViewResolver viewResolver : this.viewResolvers) {
|
||||
View view = viewResolver.resolveViewName(viewName, locale);
|
||||
if (view != null) {
|
||||
|
||||
@@ -493,7 +493,7 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
|
||||
* @see #isEligibleProperty(String, Object)
|
||||
*/
|
||||
protected Map<String, Object> queryProperties(Map<String, Object> model) {
|
||||
Map<String, Object> result = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, Object> entry : model.entrySet()) {
|
||||
if (isEligibleProperty(entry.getKey(), entry.getValue())) {
|
||||
result.put(entry.getKey(), entry.getValue());
|
||||
|
||||
@@ -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.
|
||||
@@ -78,11 +78,11 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver
|
||||
|
||||
/* Locale -> BeanFactory */
|
||||
private final Map<Locale, BeanFactory> localeCache =
|
||||
new HashMap<Locale, BeanFactory>();
|
||||
new HashMap<>();
|
||||
|
||||
/* List of ResourceBundle -> BeanFactory */
|
||||
private final Map<List<ResourceBundle>, ConfigurableApplicationContext> bundleCache =
|
||||
new HashMap<List<ResourceBundle>, ConfigurableApplicationContext>();
|
||||
new HashMap<>();
|
||||
|
||||
|
||||
public void setOrder(int order) {
|
||||
@@ -220,7 +220,7 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver
|
||||
}
|
||||
|
||||
// Build list of ResourceBundle references for Locale.
|
||||
List<ResourceBundle> bundles = new LinkedList<ResourceBundle>();
|
||||
List<ResourceBundle> bundles = new LinkedList<>();
|
||||
for (String basename : this.basenames) {
|
||||
ResourceBundle bundle = getBundle(basename, locale);
|
||||
bundles.add(bundle);
|
||||
|
||||
@@ -116,7 +116,7 @@ public class UrlBasedViewResolver extends AbstractCachingViewResolver implements
|
||||
private String requestContextAttribute;
|
||||
|
||||
/** Map of static attributes, keyed by attribute name (String) */
|
||||
private final Map<String, Object> staticAttributes = new HashMap<String, Object>();
|
||||
private final Map<String, Object> staticAttributes = new HashMap<>();
|
||||
|
||||
private Boolean exposePathVariables;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -42,7 +42,7 @@ import org.springframework.web.servlet.ViewResolver;
|
||||
public class ViewResolverComposite implements ViewResolver, Ordered, InitializingBean,
|
||||
ApplicationContextAware, ServletContextAware {
|
||||
|
||||
private final List<ViewResolver> viewResolvers = new ArrayList<ViewResolver>();
|
||||
private final List<ViewResolver> viewResolvers = new ArrayList<>();
|
||||
|
||||
private int order = Ordered.LOWEST_PRECEDENCE;
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -161,7 +161,7 @@ public class GroovyMarkupConfigurer extends TemplateConfiguration
|
||||
*/
|
||||
protected ClassLoader createTemplateClassLoader() throws IOException {
|
||||
String[] paths = StringUtils.commaDelimitedListToStringArray(getResourceLoaderPath());
|
||||
List<URL> urls = new ArrayList<URL>();
|
||||
List<URL> urls = new ArrayList<>();
|
||||
for (String path : paths) {
|
||||
Resource[] resources = getApplicationContext().getResources(path);
|
||||
if (resources.length > 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.
|
||||
@@ -156,7 +156,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
|
||||
* Stores the exporter parameters passed in by the user as passed in by the user. May be keyed as
|
||||
* {@code String}s with the fully qualified name of the exporter parameter field.
|
||||
*/
|
||||
private Map<?, ?> exporterParameters = new HashMap<Object, Object>();
|
||||
private Map<?, ?> exporterParameters = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Stores the converted exporter parameters - keyed by {@code JRExporterParameter}.
|
||||
@@ -317,7 +317,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
|
||||
throw new ApplicationContextException(
|
||||
"'reportDataKey' for main report is required when specifying a value for 'subReportDataKeys'");
|
||||
}
|
||||
this.subReports = new HashMap<String, JasperReport>(this.subReportUrls.size());
|
||||
this.subReports = new HashMap<>(this.subReportUrls.size());
|
||||
for (Enumeration<?> urls = this.subReportUrls.propertyNames(); urls.hasMoreElements();) {
|
||||
String key = (String) urls.nextElement();
|
||||
String path = this.subReportUrls.getProperty(key);
|
||||
@@ -358,7 +358,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
|
||||
protected final void convertExporterParameters() {
|
||||
if (!CollectionUtils.isEmpty(this.exporterParameters)) {
|
||||
this.convertedExporterParameters =
|
||||
new HashMap<net.sf.jasperreports.engine.JRExporterParameter, Object>(this.exporterParameters.size());
|
||||
new HashMap<>(this.exporterParameters.size());
|
||||
for (Map.Entry<?, ?> entry : this.exporterParameters.entrySet()) {
|
||||
net.sf.jasperreports.engine.JRExporterParameter exporterParameter = getExporterParameter(entry.getKey());
|
||||
this.convertedExporterParameters.put(
|
||||
|
||||
@@ -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.
|
||||
@@ -96,7 +96,7 @@ public class JasperReportsMultiFormatView extends AbstractJasperReportsView {
|
||||
* with a default set of mappings.
|
||||
*/
|
||||
public JasperReportsMultiFormatView() {
|
||||
this.formatMappings = new HashMap<String, Class<? extends AbstractJasperReportsView>>(4);
|
||||
this.formatMappings = new HashMap<>(4);
|
||||
this.formatMappings.put("csv", JasperReportsCsvView.class);
|
||||
this.formatMappings.put("html", JasperReportsHtmlView.class);
|
||||
this.formatMappings.put("pdf", JasperReportsPdfView.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.
|
||||
@@ -42,7 +42,7 @@ public class JasperReportsViewResolver extends UrlBasedViewResolver {
|
||||
|
||||
private Properties headers;
|
||||
|
||||
private Map<String, Object> exporterParameters = new HashMap<String, Object>();
|
||||
private Map<String, Object> exporterParameters = new HashMap<>();
|
||||
|
||||
private DataSource jdbcDataSource;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -83,7 +83,7 @@ public class MappingJackson2JsonView extends AbstractJackson2View {
|
||||
|
||||
private boolean extractValueFromSingleKeyModel = false;
|
||||
|
||||
private Set<String> jsonpParameterNames = new LinkedHashSet<String>(Arrays.asList("jsonp", "callback"));
|
||||
private Set<String> jsonpParameterNames = new LinkedHashSet<>(Arrays.asList("jsonp", "callback"));
|
||||
|
||||
|
||||
/**
|
||||
@@ -213,7 +213,7 @@ public class MappingJackson2JsonView extends AbstractJackson2View {
|
||||
*/
|
||||
@Override
|
||||
protected Object filterModel(Map<String, Object> model) {
|
||||
Map<String, Object> result = new HashMap<String, Object>(model.size());
|
||||
Map<String, Object> result = new HashMap<>(model.size());
|
||||
Set<String> modelKeys = (!CollectionUtils.isEmpty(this.modelKeys) ? this.modelKeys : model.keySet());
|
||||
for (Map.Entry<String, Object> entry : model.entrySet()) {
|
||||
if (!(entry.getValue() instanceof BindingResult) && modelKeys.contains(entry.getKey()) &&
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ScriptTemplateView extends AbstractUrlBasedView {
|
||||
|
||||
|
||||
private static final ThreadLocal<Map<Object, ScriptEngine>> enginesHolder =
|
||||
new NamedThreadLocal<Map<Object, ScriptEngine>>("ScriptTemplateView engines");
|
||||
new NamedThreadLocal<>("ScriptTemplateView engines");
|
||||
|
||||
|
||||
private ScriptEngine engine;
|
||||
@@ -254,7 +254,7 @@ public class ScriptTemplateView extends AbstractUrlBasedView {
|
||||
if (Boolean.FALSE.equals(this.sharedEngine)) {
|
||||
Map<Object, ScriptEngine> engines = enginesHolder.get();
|
||||
if (engines == null) {
|
||||
engines = new HashMap<Object, ScriptEngine>(4);
|
||||
engines = new HashMap<>(4);
|
||||
enginesHolder.set(engines);
|
||||
}
|
||||
Object engineKey = (!ObjectUtils.isEmpty(this.scripts) ?
|
||||
|
||||
@@ -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.
|
||||
@@ -39,7 +39,7 @@ import org.springframework.web.context.WebApplicationContext;
|
||||
public class SimpleSpringPreparerFactory extends AbstractSpringPreparerFactory {
|
||||
|
||||
/** Cache of shared ViewPreparer instances: bean name -> bean instance */
|
||||
private final Map<String, ViewPreparer> sharedPreparers = new ConcurrentHashMap<String, ViewPreparer>(16);
|
||||
private final Map<String, ViewPreparer> sharedPreparers = new ConcurrentHashMap<>(16);
|
||||
|
||||
|
||||
@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.
|
||||
@@ -85,7 +85,7 @@ public class SpringWildcardServletTilesApplicationContext extends ServletApplica
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Collection<ApplicationResource> resourceList = new ArrayList<ApplicationResource>(resources.length);
|
||||
Collection<ApplicationResource> resourceList = new ArrayList<>(resources.length);
|
||||
for (Resource resource : resources) {
|
||||
try {
|
||||
URL url = resource.getURL();
|
||||
|
||||
@@ -300,7 +300,7 @@ public class TilesConfigurer implements ServletContextAware, InitializingBean, D
|
||||
@Override
|
||||
protected List<ApplicationResource> getSources(ApplicationContext applicationContext) {
|
||||
if (definitions != null) {
|
||||
List<ApplicationResource> result = new LinkedList<ApplicationResource>();
|
||||
List<ApplicationResource> result = new LinkedList<>();
|
||||
for (String definition : definitions) {
|
||||
Collection<ApplicationResource> resources = applicationContext.getResources(definition);
|
||||
if (resources != null) {
|
||||
|
||||
Reference in New Issue
Block a user