diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandlerSupport.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandlerSupport.java index 51825dcf4d9..ae1e28e3d17 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandlerSupport.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/NamespaceHandlerSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,19 +46,22 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler { * Stores the {@link BeanDefinitionParser} implementations keyed by the * local name of the {@link Element Elements} they handle. */ - private final Map parsers = new HashMap(); + private final Map parsers = + new HashMap(); /** * Stores the {@link BeanDefinitionDecorator} implementations keyed by the * local name of the {@link Element Elements} they handle. */ - private final Map decorators = new HashMap(); + private final Map decorators = + new HashMap(); /** - * Stores the {@link BeanDefinitionParser} implementations keyed by the local + * Stores the {@link BeanDefinitionDecorator} implementations keyed by the local * name of the {@link Attr Attrs} they handle. */ - private final Map attributeDecorators = new HashMap(); + private final Map attributeDecorators = + new HashMap(); /** @@ -74,7 +77,7 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler { * the local name of the supplied {@link Element}. */ private BeanDefinitionParser findParserForElement(Element element, ParserContext parserContext) { - BeanDefinitionParser parser = (BeanDefinitionParser) this.parsers.get(element.getLocalName()); + BeanDefinitionParser parser = this.parsers.get(element.getLocalName()); if (parser == null) { parserContext.getReaderContext().fatal( "Cannot locate BeanDefinitionParser for element [" + element.getLocalName() + "]", element); @@ -82,21 +85,6 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler { return parser; } - /** - * Locate the {@link BeanDefinitionParser} from the register implementations using - * the local name of the supplied {@link Element}. - * @deprecated as of Spring 2.0.2; there should be no need to call this directly. - */ - @Deprecated - protected final BeanDefinitionParser findParserForElement(Element element) { - BeanDefinitionParser parser = (BeanDefinitionParser) this.parsers.get(element.getLocalName()); - if (parser == null) { - throw new IllegalStateException( - "Cannot locate BeanDefinitionParser for element [" + element.getLocalName() + "]"); - } - return parser; - } - /** * Decorates the supplied {@link Node} by delegating to the {@link BeanDefinitionDecorator} that * is registered to handle that {@link Node}. @@ -115,10 +103,10 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler { private BeanDefinitionDecorator findDecoratorForNode(Node node, ParserContext parserContext) { BeanDefinitionDecorator decorator = null; if (node instanceof Element) { - decorator = (BeanDefinitionDecorator) this.decorators.get(node.getLocalName()); + decorator = this.decorators.get(node.getLocalName()); } else if (node instanceof Attr) { - decorator = (BeanDefinitionDecorator) this.attributeDecorators.get(node.getLocalName()); + decorator = this.attributeDecorators.get(node.getLocalName()); } else { parserContext.getReaderContext().fatal( @@ -131,32 +119,6 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler { return decorator; } - /** - * Locate the {@link BeanDefinitionParser} from the register implementations using - * the local name of the supplied {@link Node}. Supports both {@link Element Elements} - * and {@link Attr Attrs}. - * @deprecated as of Spring 2.0.2; there should be no need to call this directly. - */ - @Deprecated - protected final BeanDefinitionDecorator findDecoratorForNode(Node node) { - BeanDefinitionDecorator decorator = null; - if (node instanceof Element) { - decorator = (BeanDefinitionDecorator) this.decorators.get(node.getLocalName()); - } - else if (node instanceof Attr) { - decorator = (BeanDefinitionDecorator) this.attributeDecorators.get(node.getLocalName()); - } - else { - throw new IllegalStateException( - "Cannot decorate based on Nodes of type [" + node.getClass().getName() + "]"); - } - if (decorator == null) { - throw new IllegalStateException("Cannot locate BeanDefinitionDecorator for " + - (node instanceof Element ? "element" : "attribute") + " [" + node.getLocalName() + "]"); - } - return decorator; - } - /** * Subclasses can call this to register the supplied {@link BeanDefinitionParser} to @@ -172,8 +134,8 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler { * handle the specified element. The element name is the local (non-namespace qualified) * name. */ - protected final void registerBeanDefinitionDecorator(String elementName, BeanDefinitionDecorator decorator) { - this.decorators.put(elementName, decorator); + protected final void registerBeanDefinitionDecorator(String elementName, BeanDefinitionDecorator dec) { + this.decorators.put(elementName, dec); } /** @@ -181,10 +143,8 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler { * handle the specified attribute. The attribute name is the local (non-namespace qualified) * name. */ - protected final void registerBeanDefinitionDecoratorForAttribute( - String attributeName, BeanDefinitionDecorator decorator) { - - this.attributeDecorators.put(attributeName, decorator); + protected final void registerBeanDefinitionDecoratorForAttribute(String attrName, BeanDefinitionDecorator dec) { + this.attributeDecorators.put(attrName, dec); } }