提交 77ad22e3 编写于 作者: A Arjen Poutsma

Added @Override and @Deprecated annotations to context module

上级 b4b169c9
......@@ -128,6 +128,7 @@ public class ContextSingletonBeanFactoryLocator extends SingletonBeanFactoryLoca
* <p>The default implementation simply builds a
* {@link org.springframework.context.support.ClassPathXmlApplicationContext}.
*/
@Override
protected BeanFactory createDefinition(String resourceLocation, String factoryKey) {
return new ClassPathXmlApplicationContext(new String[] {resourceLocation}, false);
}
......@@ -136,6 +137,7 @@ public class ContextSingletonBeanFactoryLocator extends SingletonBeanFactoryLoca
* Overrides the default method to refresh the ApplicationContext, invoking
* {@link ConfigurableApplicationContext#refresh ConfigurableApplicationContext.refresh()}.
*/
@Override
protected void initializeDefinition(BeanFactory groupDef) {
if (groupDef instanceof ConfigurableApplicationContext) {
((ConfigurableApplicationContext) groupDef).refresh();
......@@ -146,6 +148,7 @@ public class ContextSingletonBeanFactoryLocator extends SingletonBeanFactoryLoca
* Overrides the default method to operate on an ApplicationContext, invoking
* {@link ConfigurableApplicationContext#refresh ConfigurableApplicationContext.close()}.
*/
@Override
protected void destroyDefinition(BeanFactory groupDef, String selector) {
if (groupDef instanceof ConfigurableApplicationContext) {
if (logger.isTraceEnabled()) {
......
......@@ -271,6 +271,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
}
@Override
public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, Class beanType, String beanName) {
super.postProcessMergedBeanDefinition(beanDefinition, beanType, beanName);
if (beanType != null) {
......@@ -508,6 +509,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
super(member, pd);
}
@Override
protected void initAnnotation(AnnotatedElement ae) {
Resource resource = ae.getAnnotation(Resource.class);
String resourceName = resource.name();
......@@ -553,6 +555,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
super(member, pd);
}
@Override
protected void initAnnotation(AnnotatedElement ae) {
WebServiceRef resource = ae.getAnnotation(WebServiceRef.class);
String resourceName = resource.name();
......@@ -639,6 +642,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
super(member, pd);
}
@Override
protected void initAnnotation(AnnotatedElement ae) {
EJB resource = ae.getAnnotation(EJB.class);
String resourceBeanName = resource.beanName();
......@@ -704,6 +708,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
this.lookupType = lookupType;
}
@Override
public Class getDependencyType() {
return this.lookupType;
}
......
......@@ -32,10 +32,12 @@ import org.springframework.util.StringUtils;
*/
abstract class AbstractPropertyLoadingBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
@Override
protected boolean shouldGenerateId() {
return true;
}
@Override
protected void doParse(Element element, BeanDefinitionBuilder builder) {
String location = element.getAttribute("location");
if (StringUtils.hasLength(location)) {
......
......@@ -48,6 +48,7 @@ class LoadTimeWeaverBeanDefinitionParser extends AbstractSingleBeanDefinitionPar
"org.springframework.context.weaving.AspectJWeavingEnabler";
@Override
protected String getBeanClassName(Element element) {
if (element.hasAttribute(WEAVER_CLASS_ATTRIBUTE)) {
return element.getAttribute(WEAVER_CLASS_ATTRIBUTE);
......@@ -55,10 +56,12 @@ class LoadTimeWeaverBeanDefinitionParser extends AbstractSingleBeanDefinitionPar
return DEFAULT_LOAD_TIME_WEAVER_CLASS_NAME;
}
@Override
protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) {
return ConfigurableApplicationContext.LOAD_TIME_WEAVER_BEAN_NAME;
}
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
builder.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
......
......@@ -54,10 +54,12 @@ class MBeanExportBeanDefinitionParser extends AbstractBeanDefinitionParser {
private static final String REGISTRATION_REPLACE_EXISTING = "replaceExisting";
@Override
protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) {
return MBEAN_EXPORTER_BEAN_NAME;
}
@Override
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
String beanClassName = (JdkVersion.isAtLeastJava15() ?
"org.springframework.jmx.export.annotation.AnnotationMBeanExporter" :
......
......@@ -55,11 +55,13 @@ class MBeanServerBeanDefinitionParser extends AbstractBeanDefinitionParser {
"com.ibm.websphere.management.AdminServiceFactory", MBeanServerBeanDefinitionParser.class.getClassLoader());
@Override
protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) {
String id = element.getAttribute(ID_ATTRIBUTE);
return (StringUtils.hasText(id) ? id : MBEAN_SERVER_BEAN_NAME);
}
@Override
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
String agentId = element.getAttribute(AGENT_ID_ATTRIBUTE);
if (StringUtils.hasText(agentId)) {
......
......@@ -28,6 +28,7 @@ import org.springframework.beans.factory.config.PropertyOverrideConfigurer;
*/
class PropertyOverrideBeanDefinitionParser extends AbstractPropertyLoadingBeanDefinitionParser {
@Override
protected Class getBeanClass(Element element) {
return PropertyOverrideConfigurer.class;
}
......
......@@ -28,6 +28,7 @@ import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
*/
class PropertyPlaceholderBeanDefinitionParser extends AbstractPropertyLoadingBeanDefinitionParser {
@Override
protected Class getBeanClass(Element element) {
return PropertyPlaceholderConfigurer.class;
}
......
......@@ -46,6 +46,7 @@ public class SimpleLocaleContext implements LocaleContext {
return this.locale;
}
@Override
public String toString() {
return this.locale.toString();
}
......
......@@ -760,6 +760,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
if (this.shutdownHook == null) {
// No shutdown hook registered yet.
this.shutdownHook = new Thread() {
@Override
public void run() {
doClose();
}
......@@ -1153,6 +1154,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
/**
* Return information about this context.
*/
@Override
public String toString() {
StringBuffer sb = new StringBuffer(getId());
sb.append(": display name [").append(getDisplayName());
......
......@@ -272,6 +272,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
* @return the rendered default message (with resolved arguments)
* @see #formatMessage(String, Object[], java.util.Locale)
*/
@Override
protected String renderDefaultMessage(String defaultMessage, Object[] args, Locale locale) {
return formatMessage(defaultMessage, args, locale);
}
......@@ -285,6 +286,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
* @param locale the locale to resolve through
* @return an array of arguments with any MessageSourceResolvables resolved
*/
@Override
protected Object[] resolveArguments(Object[] args, Locale locale) {
if (args == null) {
return new Object[0];
......
......@@ -112,6 +112,7 @@ public abstract class AbstractRefreshableApplicationContext extends AbstractAppl
* bean factory, shutting down the previous bean factory (if any) and
* initializing a fresh bean factory for the next phase of the context's lifecycle.
*/
@Override
protected final void refreshBeanFactory() throws BeansException {
if (hasBeanFactory()) {
destroyBeans();
......@@ -131,6 +132,7 @@ public abstract class AbstractRefreshableApplicationContext extends AbstractAppl
}
}
@Override
protected final void closeBeanFactory() {
synchronized (this.beanFactoryMonitor) {
this.beanFactory = null;
......@@ -147,6 +149,7 @@ public abstract class AbstractRefreshableApplicationContext extends AbstractAppl
}
}
@Override
public final ConfigurableListableBeanFactory getBeanFactory() {
synchronized (this.beanFactoryMonitor) {
if (this.beanFactory == null) {
......
......@@ -124,6 +124,7 @@ public abstract class AbstractRefreshableConfigApplicationContext extends Abstra
}
@Override
public void setId(String id) {
super.setId(id);
this.setIdCalled = true;
......
......@@ -65,6 +65,7 @@ public abstract class AbstractXmlApplicationContext extends AbstractRefreshableC
* @see #initBeanDefinitionReader
* @see #loadBeanDefinitions
*/
@Override
protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException {
// Create a new XmlBeanDefinitionReader for the given BeanFactory.
XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory);
......
......@@ -198,6 +198,7 @@ public class ClassPathXmlApplicationContext extends AbstractXmlApplicationContex
}
@Override
protected Resource[] getConfigResources() {
return this.configResources;
}
......
......@@ -58,6 +58,7 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart
super(parent);
}
@Override
public Class loadClass(String name) throws ClassNotFoundException {
return new ContextOverridingClassLoader(getParent()).loadClass(name);
}
......@@ -77,6 +78,7 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart
super(parent);
}
@Override
protected boolean isEligibleForOverriding(String className) {
if (isExcluded(className) || ContextTypeMatchClassLoader.this.isExcluded(className)) {
return false;
......@@ -92,6 +94,7 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart
return true;
}
@Override
protected Class loadClassForOverriding(String name) throws ClassNotFoundException {
byte[] bytes = (byte[]) bytesCache.get(name);
if (bytes == null) {
......
......@@ -134,11 +134,13 @@ public class DefaultMessageSourceResolvable implements MessageSourceResolvable,
* resolvable content through <code>resolvableToString()</code>.
* @see #resolvableToString()
*/
@Override
public String toString() {
return getClass().getName() + ": " + resolvableToString();
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -152,6 +154,7 @@ public class DefaultMessageSourceResolvable implements MessageSourceResolvable,
ObjectUtils.nullSafeEquals(getDefaultMessage(), otherResolvable.getDefaultMessage());
}
@Override
public int hashCode() {
int hashCode = ObjectUtils.nullSafeHashCode(getCodes());
hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(getArguments());
......
......@@ -151,6 +151,7 @@ public class FileSystemXmlApplicationContext extends AbstractXmlApplicationConte
* @return Resource handle
* @see org.springframework.web.context.support.XmlWebApplicationContext#getResourceByPath
*/
@Override
protected Resource getResourceByPath(String path) {
if (path != null && path.startsWith("/")) {
path = path.substring(1);
......
......@@ -139,6 +139,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
* the parent of the internal BeanFactory accordingly.
* @see org.springframework.beans.factory.config.ConfigurableBeanFactory#setParentBeanFactory
*/
@Override
public void setParent(ApplicationContext parent) {
super.setParent(parent);
this.beanFactory.setParentBeanFactory(getInternalParentBeanFactory());
......@@ -172,6 +173,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
* falling back to the default superclass behavior else.
* @see #setResourceLoader
*/
@Override
public Resource getResource(String location) {
if (this.resourceLoader != null) {
return this.resourceLoader.getResource(location);
......@@ -185,6 +187,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
* default superclass behavior else.
* @see #setResourceLoader
*/
@Override
public Resource[] getResources(String locationPattern) throws IOException {
if (this.resourceLoader instanceof ResourcePatternResolver) {
return ((ResourcePatternResolver) this.resourceLoader).getResources(locationPattern);
......@@ -202,6 +205,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
* to register beans through our public methods (or the BeanFactory's).
* @see #registerBeanDefinition
*/
@Override
protected final void refreshBeanFactory() throws IllegalStateException {
if (this.refreshed) {
throw new IllegalStateException(
......@@ -214,6 +218,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
* Do nothing: We hold a single internal BeanFactory that will never
* get released.
*/
@Override
protected final void closeBeanFactory() {
}
......@@ -221,6 +226,7 @@ public class GenericApplicationContext extends AbstractApplicationContext implem
* Return the single internal BeanFactory held by this context
* (as ConfigurableListableBeanFactory).
*/
@Override
public final ConfigurableListableBeanFactory getBeanFactory() {
return this.beanFactory;
}
......
......@@ -69,6 +69,7 @@ public class MessageSourceResourceBundle extends ResourceBundle {
* This implementation resolves the code in the MessageSource.
* Returns <code>null</code> if the message could not be resolved.
*/
@Override
protected Object handleGetObject(String code) {
try {
return this.messageSource.getMessage(code, null, this.locale);
......@@ -82,6 +83,7 @@ public class MessageSourceResourceBundle extends ResourceBundle {
* This implementation returns <code>null</code>, as a MessageSource does
* not allow for enumerating the defined message codes.
*/
@Override
public Enumeration getKeys() {
return null;
}
......@@ -90,6 +92,7 @@ public class MessageSourceResourceBundle extends ResourceBundle {
* This implementation exposes the specified Locale for introspection
* through the standard <code>ResourceBundle.getLocale()</code> method.
*/
@Override
public Locale getLocale() {
return this.locale;
}
......
......@@ -261,6 +261,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
* Resolves the given message code as key in the retrieved bundle files,
* returning the value found in the bundle as-is (without MessageFormat parsing).
*/
@Override
protected String resolveCodeWithoutArguments(String code, Locale locale) {
if (this.cacheMillis < 0) {
PropertiesHolder propHolder = getMergedProperties(locale);
......@@ -289,6 +290,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
* Resolves the given message code as key in the retrieved bundle files,
* using a cached MessageFormat instance per message code.
*/
@Override
protected MessageFormat resolveCode(String code, Locale locale) {
if (this.cacheMillis < 0) {
PropertiesHolder propHolder = getMergedProperties(locale);
......@@ -580,6 +582,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
}
@Override
public String toString() {
return getClass().getName() + ": basenames=[" + StringUtils.arrayToCommaDelimitedString(this.basenames) + "]";
}
......
......@@ -161,6 +161,7 @@ public class ResourceBundleMessageSource extends AbstractMessageSource implement
* Resolves the given message code as key in the registered resource bundles,
* returning the value found in the bundle as-is (without MessageFormat parsing).
*/
@Override
protected String resolveCodeWithoutArguments(String code, Locale locale) {
String result = null;
for (int i = 0; result == null && i < this.basenames.length; i++) {
......@@ -176,6 +177,7 @@ public class ResourceBundleMessageSource extends AbstractMessageSource implement
* Resolves the given message code as key in the registered resource bundles,
* using a cached MessageFormat instance per message code.
*/
@Override
protected MessageFormat resolveCode(String code, Locale locale) {
MessageFormat messageFormat = null;
for (int i = 0; messageFormat == null && i < this.basenames.length; i++) {
......@@ -298,6 +300,7 @@ public class ResourceBundleMessageSource extends AbstractMessageSource implement
/**
* Show the configuration of this MessageSource.
*/
@Override
public String toString() {
return getClass().getName() + ": basenames=[" +
StringUtils.arrayToCommaDelimitedString(this.basenames) + "]";
......
......@@ -66,6 +66,7 @@ public class ResourceMapFactoryBean extends PropertiesFactoryBean implements Res
}
@Override
public Class getObjectType() {
return Map.class;
}
......@@ -73,6 +74,7 @@ public class ResourceMapFactoryBean extends PropertiesFactoryBean implements Res
/**
* Create the Map instance, populated with keys and Resource values.
*/
@Override
protected Object createInstance() throws IOException {
Map resourceMap = new HashMap();
Properties props = mergeProperties();
......
......@@ -40,6 +40,7 @@ public class StaticMessageSource extends AbstractMessageSource {
private final Map messages = new HashMap();
@Override
protected MessageFormat resolveCode(String code, Locale locale) {
return (MessageFormat) this.messages.get(code + "_" + locale.toString());
}
......@@ -75,6 +76,7 @@ public class StaticMessageSource extends AbstractMessageSource {
}
@Override
public String toString() {
return getClass().getName() + ": " + this.messages;
}
......
......@@ -83,6 +83,7 @@ public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbI
this.refreshHomeOnConnectFailure = refreshHomeOnConnectFailure;
}
@Override
protected boolean isHomeRefreshable() {
return this.refreshHomeOnConnectFailure;
}
......@@ -94,6 +95,7 @@ public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbI
* @see #setHomeInterface
* @see javax.rmi.PortableRemoteObject#narrow
*/
@Override
protected Object lookup() throws NamingException {
Object homeObject = super.lookup();
if (this.homeInterface != null) {
......@@ -111,6 +113,7 @@ public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbI
/**
* Check for EJB3-style home object that serves as EJB component directly.
*/
@Override
protected Method getCreateMethod(Object home) throws EjbAccessException {
if (this.homeAsComponent) {
return null;
......@@ -132,6 +135,7 @@ public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbI
* @see #doInvoke
* @see #refreshAndRetry
*/
@Override
public Object invokeInContext(MethodInvocation invocation) throws Throwable {
try {
return doInvoke(invocation);
......
......@@ -101,6 +101,7 @@ public abstract class AbstractSlsbInvokerInterceptor extends JndiObjectLocator
* @see #setLookupHomeOnStartup
* @see #refreshHome
*/
@Override
public void afterPropertiesSet() throws NamingException {
super.afterPropertiesSet();
if (this.lookupHomeOnStartup) {
......
......@@ -60,6 +60,7 @@ public class LocalSlsbInvokerInterceptor extends AbstractSlsbInvokerInterceptor
* {@link #releaseSessionBeanInstance} to change EJB instance creation,
* for example to hold a single shared EJB instance.
*/
@Override
public Object invokeInContext(MethodInvocation invocation) throws Throwable {
Object ejb = null;
try {
......@@ -104,6 +105,7 @@ public class LocalSlsbInvokerInterceptor extends AbstractSlsbInvokerInterceptor
/**
* Check for EJB3-style home object that serves as EJB component directly.
*/
@Override
protected Method getCreateMethod(Object home) throws EjbAccessException {
if (this.homeAsComponent) {
return null;
......
......@@ -81,6 +81,7 @@ public class LocalStatelessSessionProxyFactoryBean extends LocalSlsbInvokerInter
this.beanClassLoader = classLoader;
}
@Override
public void afterPropertiesSet() throws NamingException {
super.afterPropertiesSet();
if (this.businessInterface == null) {
......
......@@ -91,6 +91,7 @@ public class SimpleRemoteSlsbInvokerInterceptor extends AbstractRemoteSlsbInvoke
* {@link #releaseSessionBeanInstance} to change EJB instance creation,
* for example to hold a single shared EJB component instance.
*/
@Override
protected Object doInvoke(MethodInvocation invocation) throws Throwable {
Object ejb = null;
try {
......@@ -157,6 +158,7 @@ public class SimpleRemoteSlsbInvokerInterceptor extends AbstractRemoteSlsbInvoke
/**
* Reset the cached session bean instance, if necessary.
*/
@Override
protected void refreshHome() throws NamingException {
super.refreshHome();
if (this.cacheSessionBean) {
......
......@@ -95,6 +95,7 @@ public class SimpleRemoteStatelessSessionProxyFactoryBean extends SimpleRemoteSl
this.beanClassLoader = classLoader;
}
@Override
public void afterPropertiesSet() throws NamingException {
super.afterPropertiesSet();
if (this.businessInterface == null) {
......
......@@ -42,10 +42,12 @@ abstract class AbstractJndiLocatingBeanDefinitionParser extends AbstractSimpleBe
public static final String JNDI_ENVIRONMENT = "jndiEnvironment";
@Override
protected boolean isEligibleAttribute(String attributeName) {
return (super.isEligibleAttribute(attributeName) && !ENVIRONMENT_REF.equals(attributeName));
}
@Override
protected void postProcess(BeanDefinitionBuilder definitionBuilder, Element element) {
Object envValue = DomUtils.getChildElementValueByTagName(element, ENVIRONMENT);
if (envValue != null) {
......
......@@ -42,15 +42,18 @@ class JndiLookupBeanDefinitionParser extends AbstractJndiLocatingBeanDefinitionP
public static final String DEFAULT_OBJECT = "defaultObject";
@Override
protected Class getBeanClass(Element element) {
return JndiObjectFactoryBean.class;
}
@Override
protected boolean isEligibleAttribute(String attributeName) {
return (super.isEligibleAttribute(attributeName) &&
!DEFAULT_VALUE.equals(attributeName) && !DEFAULT_REF.equals(attributeName));
}
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
super.doParse(element, parserContext, builder);
......
......@@ -31,6 +31,7 @@ import org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean;
*/
class LocalStatelessSessionBeanDefinitionParser extends AbstractJndiLocatingBeanDefinitionParser {
@Override
protected String getBeanClassName(Element element) {
return "org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean";
}
......
......@@ -31,6 +31,7 @@ import org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBe
*/
class RemoteStatelessSessionBeanDefinitionParser extends AbstractJndiLocatingBeanDefinitionParser {
@Override
protected String getBeanClassName(Element element) {
return "org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean";
}
......
......@@ -54,6 +54,7 @@ public abstract class AbstractStatefulSessionBean extends AbstractSessionBean {
* removed via a call to <code>unloadBeanFactory()</code> from
* the <code>ejbPassivate()</code> implementation.
*/
@Override
protected void loadBeanFactory() throws BeansException {
super.loadBeanFactory();
}
......@@ -66,6 +67,7 @@ public abstract class AbstractStatefulSessionBean extends AbstractSessionBean {
* must also be called from <code>ejbPassivate()</code>, with a corresponding
* call to <code>loadBeanFactory()</code> from <code>ejbActivate()</code>.
*/
@Override
protected void unloadBeanFactory() throws FatalBeanException {
super.unloadBeanFactory();
}
......
......@@ -182,6 +182,7 @@ public class InstrumentationLoadTimeWeaver implements LoadTimeWeaver {
loader, className, classBeingRedefined, protectionDomain, classfileBuffer);
}
@Override
public String toString() {
return "FilteringClassFileTransformer for: " + this.targetTransformer.toString();
}
......
......@@ -93,6 +93,7 @@ public class ShadowingClassLoader extends DecoratingClassLoader {
}
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if (shouldShadow(name)) {
Class cls = this.classCache.get(name);
......@@ -134,6 +135,7 @@ public class ShadowingClassLoader extends DecoratingClassLoader {
* @return whether the specified class is excluded
* @deprecated in favor of {@link #isEligibleForShadowing}
*/
@Deprecated
protected boolean isClassNameExcludedFromShadowing(String className) {
return false;
}
......@@ -180,14 +182,17 @@ public class ShadowingClassLoader extends DecoratingClassLoader {
}
@Override
public URL getResource(String name) {
return this.enclosingClassLoader.getResource(name);
}
@Override
public InputStream getResourceAsStream(String name) {
return this.enclosingClassLoader.getResourceAsStream(name);
}
@Override
public Enumeration<URL> getResources(String name) throws IOException {
return this.enclosingClassLoader.getResources(name);
}
......
......@@ -584,6 +584,7 @@ public class MBeanClientInterceptor
this.parameterTypes = (parameterTypes != null ? parameterTypes : new Class[0]);
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
......@@ -592,6 +593,7 @@ public class MBeanClientInterceptor
return (this.name.equals(otherKey.name) && Arrays.equals(this.parameterTypes, otherKey.parameterTypes));
}
@Override
public int hashCode() {
return this.name.hashCode();
}
......
......@@ -69,6 +69,7 @@ public class MBeanProxyFactoryBean extends MBeanClientInterceptor
this.proxyInterface = proxyInterface;
}
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = classLoader;
}
......@@ -77,6 +78,7 @@ public class MBeanProxyFactoryBean extends MBeanClientInterceptor
* Checks that the <code>proxyInterface</code> has been specified and then
* generates the proxy for the target MBean.
*/
@Override
public void afterPropertiesSet() throws MBeanServerNotFoundException, MBeanInfoRetrievalException {
super.afterPropertiesSet();
......
......@@ -1001,6 +1001,7 @@ public class MBeanExporter extends MBeanRegistrationSupport
* callback.
* @param objectName the <code>ObjectName</code> of the registered MBean
*/
@Override
protected void onRegister(ObjectName objectName) {
notifyListenersOfRegistration(objectName);
}
......@@ -1015,6 +1016,7 @@ public class MBeanExporter extends MBeanRegistrationSupport
* callback.
* @param objectName the <code>ObjectName</code> of the unregistered MBean
*/
@Override
protected void onUnregister(ObjectName objectName) {
notifyListenersOfUnregistration(objectName);
}
......@@ -1083,6 +1085,7 @@ public class MBeanExporter extends MBeanRegistrationSupport
this.objectName = objectName;
}
@Override
protected void postProcessTargetObject(Object targetObject) {
injectNotificationPublisherIfNecessary(targetObject, this.modelMBean, this.objectName);
}
......
......@@ -66,6 +66,7 @@ public class SpringModelMBean extends RequiredModelMBean {
/**
* Sets managed resource to expose and stores its {@link ClassLoader}.
*/
@Override
public void setManagedResource(Object managedResource, String managedResourceType)
throws MBeanException, InstanceNotFoundException, InvalidTargetObjectTypeException {
......@@ -79,6 +80,7 @@ public class SpringModelMBean extends RequiredModelMBean {
* managed resources {@link ClassLoader} before allowing the invocation to occur.
* @see javax.management.modelmbean.ModelMBean#invoke
*/
@Override
public Object invoke(String opName, Object[] opArgs, String[] sig)
throws MBeanException, ReflectionException {
......@@ -97,6 +99,7 @@ public class SpringModelMBean extends RequiredModelMBean {
* managed resources {@link ClassLoader} before allowing the invocation to occur.
* @see javax.management.modelmbean.ModelMBean#getAttribute
*/
@Override
public Object getAttribute(String attrName)
throws AttributeNotFoundException, MBeanException, ReflectionException {
......@@ -115,6 +118,7 @@ public class SpringModelMBean extends RequiredModelMBean {
* managed resources {@link ClassLoader} before allowing the invocation to occur.
* @see javax.management.modelmbean.ModelMBean#getAttributes
*/
@Override
public AttributeList getAttributes(String[] attrNames) {
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
try {
......@@ -131,6 +135,7 @@ public class SpringModelMBean extends RequiredModelMBean {
* managed resources {@link ClassLoader} before allowing the invocation to occur.
* @see javax.management.modelmbean.ModelMBean#setAttribute
*/
@Override
public void setAttribute(Attribute attribute)
throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
......@@ -149,6 +154,7 @@ public class SpringModelMBean extends RequiredModelMBean {
* managed resources {@link ClassLoader} before allowing the invocation to occur.
* @see javax.management.modelmbean.ModelMBean#setAttributes
*/
@Override
public AttributeList setAttributes(AttributeList attributes) {
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
try {
......
......@@ -65,6 +65,7 @@ public abstract class AbstractConfigurableMBeanInfoAssembler extends AbstractRef
}
@Override
protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) {
ModelMBeanNotificationInfo[] result = null;
......
......@@ -249,6 +249,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
* @throws JMException in case of errors
* @see #populateAttributeDescriptor
*/
@Override
protected ModelMBeanAttributeInfo[] getAttributeInfo(Object managedBean, String beanKey) throws JMException {
PropertyDescriptor[] props = BeanUtils.getPropertyDescriptors(getClassToExpose(managedBean));
List infos = new ArrayList();
......@@ -302,6 +303,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
* @return the operation metadata
* @see #populateOperationDescriptor
*/
@Override
protected ModelMBeanOperationInfo[] getOperationInfo(Object managedBean, String beanKey) {
Method[] methods = getClassToExpose(managedBean).getMethods();
List infos = new ArrayList();
......@@ -478,6 +480,7 @@ public abstract class AbstractReflectiveMBeanInfoAssembler extends AbstractMBean
* @see #setDefaultCurrencyTimeLimit(Integer)
* @see #applyDefaultCurrencyTimeLimit(javax.management.Descriptor)
*/
@Override
protected void populateMBeanDescriptor(Descriptor descriptor, Object managedBean, String beanKey) {
applyDefaultCurrencyTimeLimit(descriptor);
}
......
......@@ -165,6 +165,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
* @return <code>true</code> if the <code>Method</code> is declared in one of the
* configured interfaces, otherwise <code>false</code>.
*/
@Override
protected boolean includeReadAttribute(Method method, String beanKey) {
return isPublicInInterface(method, beanKey);
}
......@@ -178,6 +179,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
* @return <code>true</code> if the <code>Method</code> is declared in one of the
* configured interfaces, otherwise <code>false</code>.
*/
@Override
protected boolean includeWriteAttribute(Method method, String beanKey) {
return isPublicInInterface(method, beanKey);
}
......@@ -191,6 +193,7 @@ public class InterfaceBasedMBeanInfoAssembler extends AbstractConfigurableMBeanI
* @return <code>true</code> if the <code>Method</code> is declared in one of the
* configured interfaces, otherwise <code>false</code>.
*/
@Override
protected boolean includeOperation(Method method, String beanKey) {
return isPublicInInterface(method, beanKey);
}
......
......@@ -102,6 +102,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* Throws an IllegalArgumentException if it encounters a JDK dynamic proxy.
* Metadata can only be read from target classes and CGLIB proxies!
*/
@Override
protected void checkManagedBean(Object managedBean) throws IllegalArgumentException {
if (AopUtils.isJdkDynamicProxy(managedBean)) {
throw new IllegalArgumentException(
......@@ -126,6 +127,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* @param beanKey the key associated with the MBean in the beans map
* @return whether the method has the appropriate metadata
*/
@Override
protected boolean includeReadAttribute(Method method, String beanKey) {
return hasManagedAttribute(method);
}
......@@ -136,6 +138,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* @param beanKey the key associated with the MBean in the beans map
* @return whether the method has the appropriate metadata
*/
@Override
protected boolean includeWriteAttribute(Method method, String beanKey) {
return hasManagedAttribute(method);
}
......@@ -146,6 +149,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* @param beanKey the key associated with the MBean in the beans map
* @return whether the method has the appropriate metadata
*/
@Override
protected boolean includeOperation(Method method, String beanKey) {
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
if (pd != null) {
......@@ -176,6 +180,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* Reads managed resource description from the source level metadata.
* Returns an empty <code>String</code> if no description can be found.
*/
@Override
protected String getDescription(Object managedBean, String beanKey) {
ManagedResource mr = this.attributeSource.getManagedResource(getClassToExpose(managedBean));
return (mr != null ? mr.getDescription() : "");
......@@ -186,6 +191,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* descriptor. Attempts to create the description using metadata from either
* the getter or setter attributes, otherwise uses the property name.
*/
@Override
protected String getAttributeDescription(PropertyDescriptor propertyDescriptor, String beanKey) {
Method readMethod = propertyDescriptor.getReadMethod();
Method writeMethod = propertyDescriptor.getWriteMethod();
......@@ -208,6 +214,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* Retrieves the description for the supplied <code>Method</code> from the
* metadata. Uses the method name is no description is present in the metadata.
*/
@Override
protected String getOperationDescription(Method method, String beanKey) {
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
if (pd != null) {
......@@ -231,6 +238,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* attributes attached to a method. Returns an empty array of <code>MBeanParameterInfo</code>
* if no attributes are found.
*/
@Override
protected MBeanParameterInfo[] getOperationParameters(Method method, String beanKey) {
ManagedOperationParameter[] params = this.attributeSource.getManagedOperationParameters(method);
if (params == null || params.length == 0) {
......@@ -253,6 +261,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* Reads the {@link ManagedNotification} metadata from the <code>Class</code> of the managed resource
* and generates and returns the corresponding {@link ModelMBeanNotificationInfo} metadata.
*/
@Override
protected ModelMBeanNotificationInfo[] getNotificationInfo(Object managedBean, String beanKey) {
ManagedNotification[] notificationAttributes =
this.attributeSource.getManagedNotifications(getClassToExpose(managedBean));
......@@ -273,6 +282,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* <code>persistPolicy</code>, <code>persistPeriod</code>, <code>persistLocation</code>
* and <code>persistName</code> descriptor fields if they are present in the metadata.
*/
@Override
protected void populateMBeanDescriptor(Descriptor desc, Object managedBean, String beanKey) {
ManagedResource mr = this.attributeSource.getManagedResource(getClassToExpose(managedBean));
if (mr == null) {
......@@ -309,6 +319,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* <code>default</code>, <code>persistPolicy</code> and <code>persistPeriod</code>
* descriptor fields if they are present in the metadata.
*/
@Override
protected void populateAttributeDescriptor(Descriptor desc, Method getter, Method setter, String beanKey) {
ManagedAttribute gma =
(getter == null) ? ManagedAttribute.EMPTY : this.attributeSource.getManagedAttribute(getter);
......@@ -335,6 +346,7 @@ public class MetadataMBeanInfoAssembler extends AbstractReflectiveMBeanInfoAssem
* to the attribute descriptor. Specifically, adds the <code>currencyTimeLimit</code>
* descriptor field if it is present in the metadata.
*/
@Override
protected void populateOperationDescriptor(Descriptor desc, Method method, String beanKey) {
ManagedOperation mo = this.attributeSource.getManagedOperation(method);
if (mo != null) {
......
......@@ -89,14 +89,17 @@ public class MethodExclusionMBeanInfoAssembler extends AbstractConfigurableMBean
}
@Override
protected boolean includeReadAttribute(Method method, String beanKey) {
return isNotIgnored(method, beanKey);
}
@Override
protected boolean includeWriteAttribute(Method method, String beanKey) {
return isNotIgnored(method, beanKey);
}
@Override
protected boolean includeOperation(Method method, String beanKey) {
return isNotIgnored(method, beanKey);
}
......
......@@ -93,14 +93,17 @@ public class MethodNameBasedMBeanInfoAssembler extends AbstractConfigurableMBean
}
@Override
protected boolean includeReadAttribute(Method method, String beanKey) {
return isMatch(method, beanKey);
}
@Override
protected boolean includeWriteAttribute(Method method, String beanKey) {
return isMatch(method, beanKey);
}
@Override
protected boolean includeOperation(Method method, String beanKey) {
return isMatch(method, beanKey);
}
......
......@@ -32,6 +32,7 @@ public class SimpleReflectiveMBeanInfoAssembler extends AbstractConfigurableMBea
/**
* Always returns <code>true</code>.
*/
@Override
protected boolean includeReadAttribute(Method method, String beanKey) {
return true;
}
......@@ -39,6 +40,7 @@ public class SimpleReflectiveMBeanInfoAssembler extends AbstractConfigurableMBea
/**
* Always returns <code>true</code>.
*/
@Override
protected boolean includeWriteAttribute(Method method, String beanKey) {
return true;
}
......@@ -46,6 +48,7 @@ public class SimpleReflectiveMBeanInfoAssembler extends AbstractConfigurableMBea
/**
* Always returns <code>true</code>.
*/
@Override
protected boolean includeOperation(Method method, String beanKey) {
return true;
}
......
......@@ -149,6 +149,7 @@ public class ConnectorServerFactoryBean extends MBeanRegistrationSupport
if (this.threaded) {
// Start the connector server asynchronously (in a separate thread).
Thread connectorThread = new Thread() {
@Override
public void run() {
try {
connectorServer.start();
......
......@@ -174,10 +174,12 @@ public class MBeanServerConnectionFactoryBean
*/
private class JMXConnectorLazyInitTargetSource extends AbstractLazyCreationTargetSource {
@Override
protected Object createObject() throws Exception {
return JMXConnectorFactory.connect(serviceUrl, environment);
}
@Override
public Class getTargetClass() {
return JMXConnector.class;
}
......@@ -189,10 +191,12 @@ public class MBeanServerConnectionFactoryBean
*/
private class MBeanServerConnectionLazyInitTargetSource extends AbstractLazyCreationTargetSource {
@Override
protected Object createObject() throws Exception {
return connector.getMBeanServerConnection();
}
@Override
public Class getTargetClass() {
return MBeanServerConnection.class;
}
......
......@@ -153,6 +153,7 @@ public class NotificationListenerHolder {
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -167,6 +168,7 @@ public class NotificationListenerHolder {
ObjectUtils.nullSafeEquals(this.mappedObjectNames, otherNlh.mappedObjectNames));
}
@Override
public int hashCode() {
int hashCode = ObjectUtils.nullSafeHashCode(this.notificationListener);
hashCode = 29 * hashCode + ObjectUtils.nullSafeHashCode(this.notificationFilter);
......
......@@ -163,6 +163,7 @@ public class JndiObjectFactoryBean extends JndiObjectLocator implements FactoryB
/**
* Look up the JNDI object and store it.
*/
@Override
public void afterPropertiesSet() throws IllegalArgumentException, NamingException {
super.afterPropertiesSet();
......
......@@ -90,6 +90,7 @@ public class JndiObjectTargetSource extends JndiObjectLocator implements TargetS
this.cache = cache;
}
@Override
public void afterPropertiesSet() throws NamingException {
super.afterPropertiesSet();
if (this.lookupOnStartup) {
......
......@@ -32,6 +32,7 @@ public class JndiTemplateEditor extends PropertyEditorSupport {
private final PropertiesEditor propertiesEditor = new PropertiesEditor();
@Override
public void setAsText(String text) throws IllegalArgumentException {
if (text == null) {
throw new IllegalArgumentException("JndiTemplate cannot be created from null string");
......
......@@ -83,6 +83,7 @@ public class CodebaseAwareObjectInputStream extends ConfigurableObjectInputStrea
}
@Override
protected Class resolveFallbackIfPossible(String className, ClassNotFoundException ex)
throws IOException, ClassNotFoundException {
......@@ -94,6 +95,7 @@ public class CodebaseAwareObjectInputStream extends ConfigurableObjectInputStrea
return RMIClassLoader.loadClass(this.codebaseUrl, className);
}
@Override
protected ClassLoader getFallbackClassLoader() throws IOException {
return RMIClassLoader.getClassLoader(this.codebaseUrl);
}
......
......@@ -167,6 +167,7 @@ public class JndiRmiClientInterceptor extends JndiObjectLocator implements Metho
}
@Override
public void afterPropertiesSet() throws NamingException {
super.afterPropertiesSet();
prepare();
......
......@@ -72,6 +72,7 @@ public class JndiRmiProxyFactoryBean extends JndiRmiClientInterceptor implements
this.beanClassLoader = classLoader;
}
@Override
public void afterPropertiesSet() throws NamingException {
super.afterPropertiesSet();
if (getServiceInterface() == null) {
......
......@@ -66,6 +66,7 @@ public abstract class RmiBasedExporter extends RemoteInvocationBasedExporter {
* Redefined here to be visible to RmiInvocationWrapper.
* Simply delegates to the corresponding superclass method.
*/
@Override
protected Object invoke(RemoteInvocation invocation, Object targetObject)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
......
......@@ -129,6 +129,7 @@ public class RmiClientInterceptor extends RemoteInvocationBasedAccessor
}
@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();
prepare();
......@@ -405,6 +406,7 @@ public class RmiClientInterceptor extends RemoteInvocationBasedAccessor
*/
private static class DummyURLStreamHandler extends URLStreamHandler {
@Override
protected URLConnection openConnection(URL url) throws IOException {
throw new UnsupportedOperationException();
}
......
......@@ -65,6 +65,7 @@ public abstract class RmiClientInterceptorUtils {
* will be automatically converted to Spring's RemoteAccessException.
* @deprecated as of Spring 2.5, in favor of {@link #invokeRemoteMethod}
*/
@Deprecated
public static Object invoke(MethodInvocation invocation, Remote stub, String serviceName) throws Throwable {
try {
return invokeRemoteMethod(invocation, stub);
......@@ -86,6 +87,7 @@ public abstract class RmiClientInterceptorUtils {
* letting reflection exceptions through as-is.
* @deprecated as of Spring 2.5, in favor of {@link #invokeRemoteMethod}
*/
@Deprecated
public static Object doInvoke(MethodInvocation invocation, Remote stub) throws InvocationTargetException {
return invokeRemoteMethod(invocation, stub);
}
......
......@@ -63,6 +63,7 @@ public class RmiProxyFactoryBean extends RmiClientInterceptor implements Factory
private Object serviceProxy;
@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();
if (getServiceInterface() == null) {
......
......@@ -206,6 +206,7 @@ public class RemoteInvocation implements Serializable {
}
@Override
public String toString() {
return "RemoteInvocation: method name '" + this.methodName + "'; parameter types " +
ClassUtils.classNamesToString(this.parameterTypes);
......
......@@ -224,6 +224,7 @@ public class ThreadPoolTaskExecutor extends CustomizableThreadFactory
this.waitForTasksToCompleteOnShutdown = waitForJobsToCompleteOnShutdown;
}
@Override
public void setThreadNamePrefix(String threadNamePrefix) {
super.setThreadNamePrefix(threadNamePrefix);
this.threadNamePrefixSet = true;
......
......@@ -223,6 +223,7 @@ public class ThreadPoolTaskExecutor extends CustomizableThreadFactory
this.waitForTasksToCompleteOnShutdown = waitForJobsToCompleteOnShutdown;
}
@Override
public void setThreadNamePrefix(String threadNamePrefix) {
super.setThreadNamePrefix(threadNamePrefix);
this.threadNamePrefixSet = true;
......
......@@ -62,6 +62,7 @@ public class MethodInvokingRunnable extends ArgumentConvertingMethodInvoker
this.beanClassLoader = classLoader;
}
@Override
protected Class resolveClassName(String className) throws ClassNotFoundException {
return ClassUtils.forName(className, this.beanClassLoader);
}
......
......@@ -61,6 +61,7 @@ public class DelegatingTimerTask extends TimerTask {
* Delegates execution to the underlying Runnable, catching any exception
* or error thrown in order to continue scheduled execution.
*/
@Override
public void run() {
try {
this.delegate.run();
......
......@@ -48,6 +48,7 @@ public class MethodInvokingTimerTaskFactoryBean extends MethodInvokingRunnable i
private TimerTask timerTask;
@Override
public void afterPropertiesSet() throws ClassNotFoundException, NoSuchMethodException {
super.afterPropertiesSet();
this.timerTask = new DelegatingTimerTask(this);
......
......@@ -131,6 +131,7 @@ public class TimerFactoryBean implements FactoryBean, BeanNameAware, Initializin
* Can be overridden in subclasses to provide custom Timer subclasses.
* @deprecated as of Spring 2.0.1, in favor of {@link #createTimer(String, boolean)}
*/
@Deprecated
protected Timer createTimer(boolean daemon) {
return null;
}
......
......@@ -184,6 +184,7 @@ public class BshScriptFactory implements ScriptFactory, BeanClassLoaderAware {
}
@Override
public String toString() {
return "BshScriptFactory: script source locator [" + this.scriptSourceLocator + "]";
}
......
......@@ -96,6 +96,7 @@ class ScriptBeanDefinitionParser extends AbstractBeanDefinitionParser {
* Parses the dynamic object element and returns the resulting bean definition.
* Registers a {@link ScriptFactoryPostProcessor} if needed.
*/
@Override
protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {
// Resolve the script source.
String value = resolveScriptSource(element, parserContext.getReaderContext());
......@@ -209,6 +210,7 @@ class ScriptBeanDefinitionParser extends AbstractBeanDefinitionParser {
/**
* Scripted beans may be anonymous as well.
*/
@Override
protected boolean shouldGenerateIdAsFallback() {
return true;
}
......
......@@ -262,6 +262,7 @@ public class GroovyScriptFactory implements ScriptFactory, BeanFactoryAware, Bea
}
@Override
public String toString() {
return "GroovyScriptFactory: script source locator [" + this.scriptSourceLocator + "]";
}
......
......@@ -119,6 +119,7 @@ public class JRubyScriptFactory implements ScriptFactory, BeanClassLoaderAware {
}
@Override
public String toString() {
return "JRubyScriptFactory: script source locator [" + this.scriptSourceLocator + "]";
}
......
......@@ -66,6 +66,7 @@ public class RefreshableScriptTargetSource extends BeanFactoryRefreshableTargetS
* ScriptFactory's <code>requiresScriptedObjectRefresh</code> method.
* @see ScriptFactory#requiresScriptedObjectRefresh(ScriptSource)
*/
@Override
protected boolean requiresRefresh() {
return this.scriptFactory.requiresScriptedObjectRefresh(this.scriptSource);
}
......@@ -73,6 +74,7 @@ public class RefreshableScriptTargetSource extends BeanFactoryRefreshableTargetS
/**
* Obtain a fresh target object, retrieving a FactoryBean if necessary.
*/
@Override
protected Object obtainFreshBean(BeanFactory beanFactory, String beanName) {
return super.obtainFreshBean(beanFactory,
(this.isFactoryBean ? BeanFactory.FACTORY_BEAN_PREFIX + beanName : beanName));
......
......@@ -124,6 +124,7 @@ public class ResourceScriptSource implements ScriptSource {
}
@Override
public String toString() {
return this.resource.toString();
}
......
......@@ -219,6 +219,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
}
@Override
public Class predictBeanType(Class beanClass, String beanName) {
// We only apply special treatment to ScriptFactory implementations here.
if (!ScriptFactory.class.isAssignableFrom(beanClass)) {
......@@ -271,6 +272,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
return null;
}
@Override
public Object postProcessBeforeInstantiation(Class beanClass, String beanName) {
// We only apply special treatment to ScriptFactory implementations here.
if (!ScriptFactory.class.isAssignableFrom(beanClass)) {
......
......@@ -82,6 +82,7 @@ public class StaticScriptSource implements ScriptSource {
}
@Override
public String toString() {
return "static script" + (this.className != null ? " [" + this.className + "]" : "");
}
......
......@@ -150,6 +150,7 @@ public class ModelMap extends LinkedHashMap {
/**
* @deprecated as of Spring 2.5, in favor of {@link #addAttribute(String, Object)}
*/
@Deprecated
public ModelMap addObject(String modelName, Object modelObject) {
return addAttribute(modelName, modelObject);
}
......@@ -157,6 +158,7 @@ public class ModelMap extends LinkedHashMap {
/**
* @deprecated as of Spring 2.5, in favor of {@link #addAttribute(Object)}
*/
@Deprecated
public ModelMap addObject(Object modelObject) {
return addAttribute(modelObject);
}
......@@ -164,6 +166,7 @@ public class ModelMap extends LinkedHashMap {
/**
* @deprecated as of Spring 2.5, in favor of {@link #addAllAttributes(Collection)}
*/
@Deprecated
public ModelMap addAllObjects(Collection objects) {
return addAllAttributes(objects);
}
......@@ -171,6 +174,7 @@ public class ModelMap extends LinkedHashMap {
/**
* @deprecated as of Spring 2.5, in favor of {@link #addAllAttributes(Map)}
*/
@Deprecated
public ModelMap addAllObjects(Map objects) {
return addAllAttributes(objects);
}
......
......@@ -135,14 +135,17 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
}
@Override
public boolean hasErrors() {
return !this.errors.isEmpty();
}
@Override
public int getErrorCount() {
return this.errors.size();
}
@Override
public List getAllErrors() {
return Collections.unmodifiableList(this.errors);
}
......@@ -158,6 +161,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
return Collections.unmodifiableList(result);
}
@Override
public ObjectError getGlobalError() {
for (Iterator it = this.errors.iterator(); it.hasNext();) {
ObjectError objectError = (ObjectError) it.next();
......@@ -179,6 +183,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
return Collections.unmodifiableList(result);
}
@Override
public FieldError getFieldError() {
for (Iterator it = this.errors.iterator(); it.hasNext();) {
Object error = it.next();
......@@ -189,6 +194,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
return null;
}
@Override
public List getFieldErrors(String field) {
List result = new LinkedList();
String fixedField = fixedField(field);
......@@ -201,6 +207,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
return Collections.unmodifiableList(result);
}
@Override
public FieldError getFieldError(String field) {
String fixedField = fixedField(field);
for (Iterator it = this.errors.iterator(); it.hasNext();) {
......@@ -238,6 +245,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
* the type from a descriptor, even for <code>null</code> values.
* @see #getActualFieldValue
*/
@Override
public Class getFieldType(String field) {
Object value = getActualFieldValue(fixedField(field));
if (value != null) {
......@@ -329,6 +337,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -342,6 +351,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
getAllErrors().equals(otherResult.getAllErrors()));
}
@Override
public int hashCode() {
return getObjectName().hashCode() * 29 + getTarget().hashCode();
}
......
......@@ -210,6 +210,7 @@ public abstract class AbstractErrors implements Errors, Serializable {
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer(getClass().getName());
sb.append(": ").append(getErrorCount()).append(" errors");
......
......@@ -51,6 +51,7 @@ public abstract class AbstractPropertyBindingResult extends AbstractBindingResul
* Returns the underlying PropertyAccessor.
* @see #getPropertyAccessor()
*/
@Override
public PropertyEditorRegistry getPropertyEditorRegistry() {
return getPropertyAccessor();
}
......@@ -59,6 +60,7 @@ public abstract class AbstractPropertyBindingResult extends AbstractBindingResul
* Returns the canonical property name.
* @see org.springframework.beans.PropertyAccessorUtils#canonicalPropertyName
*/
@Override
protected String canonicalFieldName(String field) {
return PropertyAccessorUtils.canonicalPropertyName(field);
}
......@@ -67,6 +69,7 @@ public abstract class AbstractPropertyBindingResult extends AbstractBindingResul
* Determines the field type from the property type.
* @see #getPropertyAccessor()
*/
@Override
public Class getFieldType(String field) {
return getPropertyAccessor().getPropertyType(fixedField(field));
}
......@@ -75,6 +78,7 @@ public abstract class AbstractPropertyBindingResult extends AbstractBindingResul
* Fetches the field value from the PropertyAccessor.
* @see #getPropertyAccessor()
*/
@Override
protected Object getActualFieldValue(String field) {
return getPropertyAccessor().getPropertyValue(field);
}
......@@ -83,6 +87,7 @@ public abstract class AbstractPropertyBindingResult extends AbstractBindingResul
* Formats the field value based on registered PropertyEditors.
* @see #getCustomEditor
*/
@Override
protected Object formatFieldValue(String field, Object value) {
PropertyEditor customEditor = getCustomEditor(field);
if (customEditor != null) {
......
......@@ -58,6 +58,7 @@ public class BeanPropertyBindingResult extends AbstractPropertyBindingResult imp
}
@Override
public final Object getTarget() {
return this.target;
}
......@@ -67,6 +68,7 @@ public class BeanPropertyBindingResult extends AbstractPropertyBindingResult imp
* Creates a new one if none existed before.
* @see #createBeanWrapper()
*/
@Override
public final ConfigurablePropertyAccessor getPropertyAccessor() {
if (this.beanWrapper == null) {
this.beanWrapper = createBeanWrapper();
......
......@@ -48,6 +48,7 @@ public class BindException extends Exception implements BindingResult {
* @deprecated in favor of <code>BindingResult.MODEL_KEY_PREFIX</code>
* @see BindingResult#MODEL_KEY_PREFIX
*/
@Deprecated
public static final String ERROR_KEY_PREFIX = BindException.class.getName() + ".";
......@@ -243,14 +244,17 @@ public class BindException extends Exception implements BindingResult {
/**
* Returns diagnostic information about the errors held in this object.
*/
@Override
public String getMessage() {
return this.bindingResult.toString();
}
@Override
public boolean equals(Object other) {
return (this == other || this.bindingResult.equals(other));
}
@Override
public int hashCode() {
return this.bindingResult.hashCode();
}
......
......@@ -264,6 +264,7 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
* to create a BindException instance if still needed.
* @see #getBindingResult()
*/
@Deprecated
public BindException getErrors() {
if (this.bindException == null) {
this.bindException = new BindException(getBindingResult());
......
......@@ -52,6 +52,7 @@ public class DirectFieldBindingResult extends AbstractPropertyBindingResult {
}
@Override
public final Object getTarget() {
return this.target;
}
......@@ -61,6 +62,7 @@ public class DirectFieldBindingResult extends AbstractPropertyBindingResult {
* Creates a new one if none existed before.
* @see #createDirectFieldAccessor()
*/
@Override
public final ConfigurablePropertyAccessor getPropertyAccessor() {
if (this.directFieldAccessor == null) {
this.directFieldAccessor = createDirectFieldAccessor();
......
......@@ -96,11 +96,13 @@ public class FieldError extends ObjectError {
}
@Override
public String toString() {
return "Field error in object '" + getObjectName() + "' on field '" + this.field +
"': rejected value [" + this.rejectedValue + "]; " + resolvableToString();
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -114,6 +116,7 @@ public class FieldError extends ObjectError {
isBindingFailure() == otherError.isBindingFailure();
}
@Override
public int hashCode() {
int hashCode = super.hashCode();
hashCode = 29 * hashCode + getField().hashCode();
......
......@@ -54,10 +54,12 @@ public class MapBindingResult extends AbstractBindingResult implements Serializa
return this.target;
}
@Override
public final Object getTarget() {
return this.target;
}
@Override
protected Object getActualFieldValue(String field) {
return this.target.get(field);
}
......
......@@ -67,10 +67,12 @@ public class ObjectError extends DefaultMessageSourceResolvable {
}
@Override
public String toString() {
return "Error in object '" + this.objectName + "': " + resolvableToString();
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
......@@ -82,6 +84,7 @@ public class ObjectError extends DefaultMessageSourceResolvable {
return getObjectName().equals(otherError.getObjectName());
}
@Override
public int hashCode() {
return super.hashCode() * 29 + getObjectName().hashCode();
}
......
......@@ -36,11 +36,13 @@ import org.springframework.validation.BindingResult;
*/
public class BindingAwareModelMap extends ExtendedModelMap {
@Override
public Object put(Object key, Object value) {
removeBindingResultIfNecessary(key, value);
return super.put(key, value);
}
@Override
public void putAll(Map map) {
for (Map.Entry entry : (Set<Map.Entry>) map.entrySet()) {
removeBindingResultIfNecessary(entry.getKey(), entry.getValue());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册