Skip to content

Commit 582c564

Browse files
committed
removed deprecated methods
1 parent 3d1a709 commit 582c564

File tree

1 file changed

+15
-55
lines changed

1 file changed

+15
-55
lines changed

org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandlerSupport.java

Lines changed: 15 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2007 the original author or authors.
2+
* Copyright 2002-2008 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,19 +46,22 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler {
4646
* Stores the {@link BeanDefinitionParser} implementations keyed by the
4747
* local name of the {@link Element Elements} they handle.
4848
*/
49-
private final Map parsers = new HashMap();
49+
private final Map<String, BeanDefinitionParser> parsers =
50+
new HashMap<String, BeanDefinitionParser>();
5051

5152
/**
5253
* Stores the {@link BeanDefinitionDecorator} implementations keyed by the
5354
* local name of the {@link Element Elements} they handle.
5455
*/
55-
private final Map decorators = new HashMap();
56+
private final Map<String, BeanDefinitionDecorator> decorators =
57+
new HashMap<String, BeanDefinitionDecorator>();
5658

5759
/**
58-
* Stores the {@link BeanDefinitionParser} implementations keyed by the local
60+
* Stores the {@link BeanDefinitionDecorator} implementations keyed by the local
5961
* name of the {@link Attr Attrs} they handle.
6062
*/
61-
private final Map attributeDecorators = new HashMap();
63+
private final Map<String, BeanDefinitionDecorator> attributeDecorators =
64+
new HashMap<String, BeanDefinitionDecorator>();
6265

6366

6467
/**
@@ -74,29 +77,14 @@ public final BeanDefinition parse(Element element, ParserContext parserContext)
7477
* the local name of the supplied {@link Element}.
7578
*/
7679
private BeanDefinitionParser findParserForElement(Element element, ParserContext parserContext) {
77-
BeanDefinitionParser parser = (BeanDefinitionParser) this.parsers.get(element.getLocalName());
80+
BeanDefinitionParser parser = this.parsers.get(element.getLocalName());
7881
if (parser == null) {
7982
parserContext.getReaderContext().fatal(
8083
"Cannot locate BeanDefinitionParser for element [" + element.getLocalName() + "]", element);
8184
}
8285
return parser;
8386
}
8487

85-
/**
86-
* Locate the {@link BeanDefinitionParser} from the register implementations using
87-
* the local name of the supplied {@link Element}.
88-
* @deprecated as of Spring 2.0.2; there should be no need to call this directly.
89-
*/
90-
@Deprecated
91-
protected final BeanDefinitionParser findParserForElement(Element element) {
92-
BeanDefinitionParser parser = (BeanDefinitionParser) this.parsers.get(element.getLocalName());
93-
if (parser == null) {
94-
throw new IllegalStateException(
95-
"Cannot locate BeanDefinitionParser for element [" + element.getLocalName() + "]");
96-
}
97-
return parser;
98-
}
99-
10088
/**
10189
* Decorates the supplied {@link Node} by delegating to the {@link BeanDefinitionDecorator} that
10290
* is registered to handle that {@link Node}.
@@ -115,10 +103,10 @@ public final BeanDefinitionHolder decorate(
115103
private BeanDefinitionDecorator findDecoratorForNode(Node node, ParserContext parserContext) {
116104
BeanDefinitionDecorator decorator = null;
117105
if (node instanceof Element) {
118-
decorator = (BeanDefinitionDecorator) this.decorators.get(node.getLocalName());
106+
decorator = this.decorators.get(node.getLocalName());
119107
}
120108
else if (node instanceof Attr) {
121-
decorator = (BeanDefinitionDecorator) this.attributeDecorators.get(node.getLocalName());
109+
decorator = this.attributeDecorators.get(node.getLocalName());
122110
}
123111
else {
124112
parserContext.getReaderContext().fatal(
@@ -131,32 +119,6 @@ else if (node instanceof Attr) {
131119
return decorator;
132120
}
133121

134-
/**
135-
* Locate the {@link BeanDefinitionParser} from the register implementations using
136-
* the local name of the supplied {@link Node}. Supports both {@link Element Elements}
137-
* and {@link Attr Attrs}.
138-
* @deprecated as of Spring 2.0.2; there should be no need to call this directly.
139-
*/
140-
@Deprecated
141-
protected final BeanDefinitionDecorator findDecoratorForNode(Node node) {
142-
BeanDefinitionDecorator decorator = null;
143-
if (node instanceof Element) {
144-
decorator = (BeanDefinitionDecorator) this.decorators.get(node.getLocalName());
145-
}
146-
else if (node instanceof Attr) {
147-
decorator = (BeanDefinitionDecorator) this.attributeDecorators.get(node.getLocalName());
148-
}
149-
else {
150-
throw new IllegalStateException(
151-
"Cannot decorate based on Nodes of type [" + node.getClass().getName() + "]");
152-
}
153-
if (decorator == null) {
154-
throw new IllegalStateException("Cannot locate BeanDefinitionDecorator for " +
155-
(node instanceof Element ? "element" : "attribute") + " [" + node.getLocalName() + "]");
156-
}
157-
return decorator;
158-
}
159-
160122

161123
/**
162124
* Subclasses can call this to register the supplied {@link BeanDefinitionParser} to
@@ -172,19 +134,17 @@ protected final void registerBeanDefinitionParser(String elementName, BeanDefini
172134
* handle the specified element. The element name is the local (non-namespace qualified)
173135
* name.
174136
*/
175-
protected final void registerBeanDefinitionDecorator(String elementName, BeanDefinitionDecorator decorator) {
176-
this.decorators.put(elementName, decorator);
137+
protected final void registerBeanDefinitionDecorator(String elementName, BeanDefinitionDecorator dec) {
138+
this.decorators.put(elementName, dec);
177139
}
178140

179141
/**
180142
* Subclasses can call this to register the supplied {@link BeanDefinitionDecorator} to
181143
* handle the specified attribute. The attribute name is the local (non-namespace qualified)
182144
* name.
183145
*/
184-
protected final void registerBeanDefinitionDecoratorForAttribute(
185-
String attributeName, BeanDefinitionDecorator decorator) {
186-
187-
this.attributeDecorators.put(attributeName, decorator);
146+
protected final void registerBeanDefinitionDecoratorForAttribute(String attrName, BeanDefinitionDecorator dec) {
147+
this.attributeDecorators.put(attrName, dec);
188148
}
189149

190150
}

0 commit comments

Comments
 (0)