From 4973f9387a7b5e5341c912e525c7dae1aeed217c Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Thu, 23 Oct 2008 08:36:52 +0000 Subject: [PATCH] Removed deprecated code --- .../org/springframework/beans/BeanUtils.java | 2 + .../springframework/beans/BeanWrapper.java | 1 + .../beans/BeanWrapperImpl.java | 1 + .../config/ConfigurableBeanFactory.java | 1 + .../support/AbstractBeanDefinition.java | 3 + .../support/BeanDefinitionBuilder.java | 5 + .../factory/support/BeanDefinitionReader.java | 1 + .../support/BeanDefinitionReaderUtils.java | 1 + .../factory/support/RootBeanDefinition.java | 2 + .../factory/xml/NamespaceHandlerSupport.java | 2 + .../factory/xml/XmlBeanDefinitionParser.java | 1 + .../factory/xml/XmlBeanDefinitionReader.java | 2 + .../support/PagedListSourceProvider.java | 48 ----- .../support/RefreshablePagedListHolder.java | 180 ------------------ 14 files changed, 22 insertions(+), 228 deletions(-) delete mode 100644 org.springframework.beans/src/main/java/org/springframework/beans/support/PagedListSourceProvider.java delete mode 100644 org.springframework.beans/src/main/java/org/springframework/beans/support/RefreshablePagedListHolder.java diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/BeanUtils.java b/org.springframework.beans/src/main/java/org/springframework/beans/BeanUtils.java index 6519c7d5f6c..d41cb645aa1 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/BeanUtils.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/BeanUtils.java @@ -465,6 +465,7 @@ public abstract class BeanUtils { * @deprecated as of Spring 2.0, in favor of ClassUtils.isAssignable * @see org.springframework.util.ClassUtils#isAssignable(Class, Class) */ + @Deprecated public static boolean isAssignable(Class targetType, Class valueType) { return ClassUtils.isAssignable(targetType, valueType); } @@ -479,6 +480,7 @@ public abstract class BeanUtils { * @deprecated as of Spring 2.0, in favor of ClassUtils.isAssignableValue * @see org.springframework.util.ClassUtils#isAssignableValue(Class, Object) */ + @Deprecated public static boolean isAssignable(Class type, Object value) { return ClassUtils.isAssignableValue(type, value); } diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapper.java b/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapper.java index fcc51555557..3a294a66c38 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapper.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapper.java @@ -58,6 +58,7 @@ public interface BeanWrapper extends ConfigurablePropertyAccessor { * @deprecated as of Spring 2.5, * in favor of recreating a BeanWrapper per target instance */ + @Deprecated void setWrappedInstance(Object obj); /** diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java b/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java index 214d145ae4f..6c956eba5d5 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java @@ -352,6 +352,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra * @deprecated in favor of convertIfNecessary * @see #convertIfNecessary(Object, Class) */ + @Deprecated public Object doTypeConversionIfNecessary(Object value, Class requiredType) throws TypeMismatchException { return convertIfNecessary(value, requiredType, null); } diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/ConfigurableBeanFactory.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/ConfigurableBeanFactory.java index c84c9b6a728..a3f514482a9 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/ConfigurableBeanFactory.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/ConfigurableBeanFactory.java @@ -155,6 +155,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single * @deprecated as of Spring 2.0.7, in favor of {@link #addPropertyEditorRegistrar} * and {@link #registerCustomEditor(Class, Class)} */ + @Deprecated void registerCustomEditor(Class requiredType, PropertyEditor propertyEditor); /** diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java index 99881725083..9ae49e81e3c 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java @@ -187,6 +187,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess * @param original the original bean definition to copy from * @deprecated since Spring 2.5, in favor of {@link #AbstractBeanDefinition(BeanDefinition)} */ + @Deprecated protected AbstractBeanDefinition(AbstractBeanDefinition original) { this((BeanDefinition) original); } @@ -241,6 +242,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess * definition (assumably the child). * @deprecated since Spring 2.5, in favor of {@link #overrideFrom(BeanDefinition)} */ + @Deprecated public void overrideFrom(AbstractBeanDefinition other) { overrideFrom((BeanDefinition) other); } @@ -422,6 +424,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess * @see #SCOPE_SINGLETON * @see #SCOPE_PROTOTYPE */ + @Deprecated public void setSingleton(boolean singleton) { this.scope = (singleton ? SCOPE_SINGLETON : SCOPE_PROTOTYPE); this.singleton = singleton; diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java index febba86600e..8edd245ccaf 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java @@ -172,6 +172,7 @@ public class BeanDefinitionBuilder { * @deprecated since Spring 2.5, in favor of preparing this on the * {@link #getRawBeanDefinition() raw BeanDefinition object} */ + @Deprecated public BeanDefinitionBuilder setFactoryBean(String factoryBean, String factoryMethod) { this.beanDefinition.setFactoryBeanName(factoryBean); this.beanDefinition.setFactoryMethodName(factoryMethod); @@ -183,6 +184,7 @@ public class BeanDefinitionBuilder { * and all additions are at the present point. * @deprecated since Spring 2.5, in favor of {@link #addConstructorArgValue} */ + @Deprecated public BeanDefinitionBuilder addConstructorArg(Object value) { return addConstructorArgValue(value); } @@ -253,6 +255,7 @@ public class BeanDefinitionBuilder { * as alternative to {@link #setScope}. * @deprecated since Spring 2.5, in favor of {@link #setScope} */ + @Deprecated public BeanDefinitionBuilder setSingleton(boolean singleton) { this.beanDefinition.setSingleton(singleton); return this; @@ -318,6 +321,7 @@ public class BeanDefinitionBuilder { * @deprecated since Spring 2.5, in favor of preparing this on the * {@link #getRawBeanDefinition() raw BeanDefinition object} */ + @Deprecated public BeanDefinitionBuilder setSource(Object source) { this.beanDefinition.setSource(source); return this; @@ -328,6 +332,7 @@ public class BeanDefinitionBuilder { * @deprecated since Spring 2.5, in favor of preparing this on the * {@link #getRawBeanDefinition() raw BeanDefinition object} */ + @Deprecated public BeanDefinitionBuilder setResourceDescription(String resourceDescription) { this.beanDefinition.setResourceDescription(resourceDescription); return this; diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReader.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReader.java index c23ae3e0b31..7c808122676 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReader.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReader.java @@ -44,6 +44,7 @@ public interface BeanDefinitionReader { * encapsulating the methods that are relevant for bean definition handling. * @deprecated in favor of the uniformly named {@link #getRegistry()} */ + @Deprecated BeanDefinitionRegistry getBeanFactory(); /** diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReaderUtils.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReaderUtils.java index 09e79c3b849..96efab1690b 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReaderUtils.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionReaderUtils.java @@ -59,6 +59,7 @@ public class BeanDefinitionReaderUtils { * @deprecated in favor of createBeanDefinition(String, String, ClassLoader) * @see #createBeanDefinition(String, String, ClassLoader) */ + @Deprecated public static AbstractBeanDefinition createBeanDefinition( String className, String parentName, ConstructorArgumentValues cargs, MutablePropertyValues pvs, ClassLoader classLoader) throws ClassNotFoundException { diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java index eedba0089c5..413db71343c 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/RootBeanDefinition.java @@ -102,6 +102,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition { * @param singleton the singleton status of the bean * @deprecated since Spring 2.5, in favor of {@link #setScope} */ + @Deprecated public RootBeanDefinition(Class beanClass, boolean singleton) { super(); setBeanClass(beanClass); @@ -156,6 +157,7 @@ public class RootBeanDefinition extends AbstractBeanDefinition { * @param singleton the singleton status of the bean * @deprecated since Spring 2.5, in favor of {@link #setScope} */ + @Deprecated public RootBeanDefinition(Class beanClass, MutablePropertyValues pvs, boolean singleton) { super(null, pvs); setBeanClass(beanClass); 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 360b05cb1d2..51825dcf4d9 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 @@ -87,6 +87,7 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler { * 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) { @@ -136,6 +137,7 @@ public abstract class NamespaceHandlerSupport implements NamespaceHandler { * 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) { diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionParser.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionParser.java index de1a0621b4e..b4dbe0a2901 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionParser.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionParser.java @@ -37,6 +37,7 @@ import org.springframework.core.io.Resource; * @see BeanDefinitionDocumentReader * @see XmlBeanDefinitionReader#setParserClass */ +@Deprecated public interface XmlBeanDefinitionParser { /** diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java index a1db6369be1..de802a6784f 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java @@ -158,6 +158,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader { * @deprecated as of Spring 2.0: superseded by "validationMode" * @see #setValidationMode */ + @Deprecated public void setValidating(boolean validating) { this.validationMode = (validating ? VALIDATION_AUTO : VALIDATION_NONE); } @@ -276,6 +277,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader { * @see #setDocumentReaderClass * @see XmlBeanDefinitionParser */ + @Deprecated public void setParserClass(Class parserClass) { if (this.parserClass == null || !XmlBeanDefinitionParser.class.isAssignableFrom(parserClass)) { throw new IllegalArgumentException("'parserClass' must be an XmlBeanDefinitionParser"); diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/support/PagedListSourceProvider.java b/org.springframework.beans/src/main/java/org/springframework/beans/support/PagedListSourceProvider.java deleted file mode 100644 index dee1d50354b..00000000000 --- a/org.springframework.beans/src/main/java/org/springframework/beans/support/PagedListSourceProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * 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, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.beans.support; - -import java.util.List; -import java.util.Locale; - -/** - * Callback that provides the source for a reloadable List. - * Used by {@link RefreshablePagedListHolder}. - * - * @author Jean-Pierre Pawlak - * @author Juergen Hoeller - * @deprecated as of Spring 2.5, to be removed in Spring 3.0 - * @see org.springframework.beans.support.RefreshablePagedListHolder#setSourceProvider - */ -public interface PagedListSourceProvider { - - /** - * Load the List for the given Locale and filter settings. - * The filter object can be of any custom class, preferably a bean - * for easy data binding from a request. An instance will simply - * get passed through to this callback method. - * @param locale Locale that the List should be loaded for, - * or null if not locale-specific - * @param filter object representing filter settings, - * or null if no filter options are used - * @return the loaded List - * @see org.springframework.beans.support.RefreshablePagedListHolder#setLocale - * @see org.springframework.beans.support.RefreshablePagedListHolder#setFilter - */ - List loadList(Locale locale, Object filter); - -} diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/support/RefreshablePagedListHolder.java b/org.springframework.beans/src/main/java/org/springframework/beans/support/RefreshablePagedListHolder.java deleted file mode 100644 index 3d1d908caf2..00000000000 --- a/org.springframework.beans/src/main/java/org/springframework/beans/support/RefreshablePagedListHolder.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * 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, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.beans.support; - -import java.util.Locale; - -import org.springframework.beans.BeanUtils; - -/** - * RefreshablePagedListHolder is a PagedListHolder subclass with reloading capabilities. - * It automatically re-requests the List from the source provider, in case of Locale or - * filter changes. - * - *

Data binding works just like with PagedListHolder. The locale can be specified in - * Locale's toString syntax, e.g. "locale=en_US". The filter object can be of any - * custom class, preferably a bean for easy data binding from a request. An instance - * will simply get passed through to PagedListSourceProvider.loadList. - * A filter property can be specified via "filter.myFilterProperty", for example. - * - *

The scenario in the controller could be: - * - * RefreshablePagedListHolder holder = request.getSession("mySessionAttr");
- * if (holder == null) {
- * holder = new RefreshablePagedListHolder();
- * holder.setSourceProvider(new MyAnonymousOrEmbeddedSourceProvider());
- * holder.setFilter(new MyAnonymousOrEmbeddedFilter());
- * request.getSession().setAttribute("mySessionAttr", holder);
- * }
- * holder.refresh(false); - * BindException ex = BindUtils.bind(request, listHolder, "myModelAttr");
- * return ModelAndView("myViewName", ex.getModel());
- *
- * ...
- *
- * private class MyAnonymousOrEmbeddedSourceProvider implements PagedListSourceProvider {
- * public List loadList(Locale locale, Object filter) {
- * MyAnonymousOrEmbeddedFilter filter = (MyAnonymousOrEmbeddedFilter) filter; - * }
- *
- * private class MyAnonymousOrEmbeddedFilter {
- * private String name = "";
- * public String getName() {
- * return name; - * public void setName(String name) {
- * this.name = name;
- * }
- * }
- *
- * - * @author Jean-Pierre Pawlak - * @author Juergen Hoeller - * @since 24.05.2003 - * @deprecated as of Spring 2.5, to be removed in Spring 3.0 - * @see org.springframework.beans.support.PagedListSourceProvider - * @see org.springframework.beans.propertyeditors.LocaleEditor - */ -public class RefreshablePagedListHolder extends PagedListHolder { - - private PagedListSourceProvider sourceProvider; - - private Locale locale; - - private Locale localeUsed; - - private Object filter; - - private Object filterUsed; - - - /** - * Create a new list holder. - * You'll need to set a source provider to be able to use the holder. - * @see #setSourceProvider - */ - public RefreshablePagedListHolder() { - super(); - } - - /** - * Create a new list holder with the given source provider. - */ - public RefreshablePagedListHolder(PagedListSourceProvider sourceProvider) { - super(); - this.sourceProvider = sourceProvider; - } - - - /** - * Set the callback class for reloading the List when necessary. - * If the list is definitely not modifiable, i.e. not locale aware - * and no filtering, use PagedListHolder. - * @see org.springframework.beans.support.PagedListHolder - */ - public void setSourceProvider(PagedListSourceProvider sourceProvider) { - this.sourceProvider = sourceProvider; - } - - /** - * Return the callback class for reloading the List when necessary. - */ - public PagedListSourceProvider getSourceProvider() { - return this.sourceProvider; - } - - /** - * Set the Locale that the source provider should use for loading the list. - * This can either be populated programmatically (e.g. with the request locale), - * or via binding (using Locale's toString syntax, e.g. "locale=en_US"). - * @param locale the current Locale, or null - */ - public void setLocale(Locale locale) { - this.locale = locale; - } - - /** - * Return the Locale that the source provider should use for loading the list. - * @return the current Locale, or null - */ - public Locale getLocale() { - return this.locale; - } - - /** - * Set the filter object that the source provider should use for loading the list. - * This will typically be a bean, for easy data binding. - * @param filter the filter object, or null - */ - public void setFilter(Object filter) { - this.filter = filter; - } - - /** - * Return the filter that the source provider should use for loading the list. - * @return the current filter, or null - */ - public Object getFilter() { - return this.filter; - } - - - /** - * Reload the underlying list from the source provider if necessary - * (i.e. if the locale and/or the filter has changed), and resort it. - * @param force whether a reload should be performed in any case - */ - public void refresh(boolean force) { - if (this.sourceProvider != null && (force || - (this.locale != null && !this.locale.equals(this.localeUsed)) || - (this.filter != null && !this.filter.equals(this.filterUsed)))) { - setSource(this.sourceProvider.loadList(this.locale, this.filter)); - if (this.filter != null && !this.filter.equals(this.filterUsed)) { - this.setPage(0); - } - this.localeUsed = this.locale; - if (this.filter != null) { - this.filterUsed = BeanUtils.instantiateClass(this.filter.getClass()); - BeanUtils.copyProperties(this.filter, this.filterUsed); - } - } - resort(); - } - -}