Polishing
This commit is contained in:
parent
46e0484bf8
commit
852212d0c5
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -36,20 +36,21 @@ import org.springframework.beans.factory.parsing.ReaderEventListener;
|
||||||
*/
|
*/
|
||||||
public class CollectingReaderEventListener implements ReaderEventListener {
|
public class CollectingReaderEventListener implements ReaderEventListener {
|
||||||
|
|
||||||
private final List defaults = new LinkedList();
|
private final List<DefaultsDefinition> defaults = new LinkedList<>();
|
||||||
|
|
||||||
private final Map componentDefinitions = new LinkedHashMap<>(8);
|
private final Map<String, ComponentDefinition> componentDefinitions = new LinkedHashMap<>(8);
|
||||||
|
|
||||||
private final Map aliasMap = new LinkedHashMap<>(8);
|
private final Map<String, List<AliasDefinition>> aliasMap = new LinkedHashMap<>(8);
|
||||||
|
|
||||||
|
private final List<ImportDefinition> imports = new LinkedList<>();
|
||||||
|
|
||||||
private final List imports = new LinkedList();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
|
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
|
||||||
this.defaults.add(defaultsDefinition);
|
this.defaults.add(defaultsDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getDefaults() {
|
public List<DefaultsDefinition> getDefaults() {
|
||||||
return Collections.unmodifiableList(this.defaults);
|
return Collections.unmodifiableList(this.defaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,27 +60,27 @@ public class CollectingReaderEventListener implements ReaderEventListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ComponentDefinition getComponentDefinition(String name) {
|
public ComponentDefinition getComponentDefinition(String name) {
|
||||||
return (ComponentDefinition) this.componentDefinitions.get(name);
|
return this.componentDefinitions.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ComponentDefinition[] getComponentDefinitions() {
|
public ComponentDefinition[] getComponentDefinitions() {
|
||||||
Collection collection = this.componentDefinitions.values();
|
Collection<ComponentDefinition> collection = this.componentDefinitions.values();
|
||||||
return (ComponentDefinition[]) collection.toArray(new ComponentDefinition[collection.size()]);
|
return collection.toArray(new ComponentDefinition[collection.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void aliasRegistered(AliasDefinition aliasDefinition) {
|
public void aliasRegistered(AliasDefinition aliasDefinition) {
|
||||||
List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName());
|
List<AliasDefinition> aliases = this.aliasMap.get(aliasDefinition.getBeanName());
|
||||||
if (aliases == null) {
|
if (aliases == null) {
|
||||||
aliases = new ArrayList();
|
aliases = new ArrayList<>();
|
||||||
this.aliasMap.put(aliasDefinition.getBeanName(), aliases);
|
this.aliasMap.put(aliasDefinition.getBeanName(), aliases);
|
||||||
}
|
}
|
||||||
aliases.add(aliasDefinition);
|
aliases.add(aliasDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getAliases(String beanName) {
|
public List<AliasDefinition> getAliases(String beanName) {
|
||||||
List aliases = (List) this.aliasMap.get(beanName);
|
List<AliasDefinition> aliases = this.aliasMap.get(beanName);
|
||||||
return aliases == null ? null : Collections.unmodifiableList(aliases);
|
return (aliases != null ? Collections.unmodifiableList(aliases) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,7 +88,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
|
||||||
this.imports.add(importDefinition);
|
this.imports.add(importDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getImports() {
|
public List<ImportDefinition> getImports() {
|
||||||
return Collections.unmodifiableList(this.imports);
|
return Collections.unmodifiableList(this.imports);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -702,9 +702,9 @@ final class HierarchicalUriComponents extends UriComponents {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return getPath().hashCode();
|
return getPath().hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a path backed by a string list (i.e. path segments).
|
* Represents a path backed by a string list (i.e. path segments).
|
||||||
*/
|
*/
|
||||||
|
@ -883,6 +883,7 @@ final class HierarchicalUriComponents extends UriComponents {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private static class QueryUriTemplateVariables implements UriTemplateVariables {
|
private static class QueryUriTemplateVariables implements UriTemplateVariables {
|
||||||
|
|
||||||
private final UriTemplateVariables delegate;
|
private final UriTemplateVariables delegate;
|
||||||
|
|
|
@ -20,7 +20,6 @@ import java.io.IOException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
@ -224,7 +223,7 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
||||||
if (this.contentNegotiationManager == null) {
|
if (this.contentNegotiationManager == null) {
|
||||||
this.contentNegotiationManager = initContentNegotiationManager();
|
this.contentNegotiationManager = initContentNegotiationManager();
|
||||||
}
|
}
|
||||||
if ( this.resourceHttpMessageConverter == null) {
|
if (this.resourceHttpMessageConverter == null) {
|
||||||
this.resourceHttpMessageConverter = new ResourceHttpMessageConverter();
|
this.resourceHttpMessageConverter = new ResourceHttpMessageConverter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue