From a6124793fc44779b569fbbba6fd4ec8804b56558 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 5 May 2009 09:36:53 +0000 Subject: [PATCH] polishing --- .../ConfigurationClassPostProcessor.java | 4 ++-- .../support/ContextTypeMatchClassLoader.java | 4 ++-- .../jmx/export/MBeanExporter.java | 1 + .../springframework/validation/Validator.java | 24 +++++++++---------- .../context/config/spring-context-2.5.xsd | 20 ++++++++-------- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java b/org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java index d53ddd6a6cf..c3628affbc5 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java @@ -123,7 +123,7 @@ public class ConfigurationClassPostProcessor implements BeanFactoryPostProcessor * Build and validate a configuration model based on the registry of * {@link Configuration} classes. */ - protected void processConfigBeanDefinitions(BeanDefinitionRegistry registry) { + public void processConfigBeanDefinitions(BeanDefinitionRegistry registry) { Set configCandidates = new LinkedHashSet(); for (String beanName : registry.getBeanDefinitionNames()) { BeanDefinition beanDef = registry.getBeanDefinition(beanName); @@ -206,7 +206,7 @@ public class ConfigurationClassPostProcessor implements BeanFactoryPostProcessor * Candidate status is determined by BeanDefinition attribute metadata. * @see ConfigurationClassEnhancer */ - protected void enhanceConfigurationClasses(ConfigurableListableBeanFactory beanFactory) { + public void enhanceConfigurationClasses(ConfigurableListableBeanFactory beanFactory) { Map configBeanDefs = new LinkedHashMap(); for (String beanName : beanFactory.getBeanDefinitionNames()) { BeanDefinition beanDef = beanFactory.getBeanDefinition(beanName); diff --git a/org.springframework.context/src/main/java/org/springframework/context/support/ContextTypeMatchClassLoader.java b/org.springframework.context/src/main/java/org/springframework/context/support/ContextTypeMatchClassLoader.java index d31a79c0962..9570bcb0d5f 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/support/ContextTypeMatchClassLoader.java +++ b/org.springframework.context/src/main/java/org/springframework/context/support/ContextTypeMatchClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -86,7 +86,7 @@ class ContextTypeMatchClassLoader extends DecoratingClassLoader implements Smart ReflectionUtils.makeAccessible(findLoadedClassMethod); ClassLoader parent = getParent(); while (parent != null) { - if (ReflectionUtils.invokeMethod(findLoadedClassMethod, parent, new Object[] {className}) != null) { + if (ReflectionUtils.invokeMethod(findLoadedClassMethod, parent, className) != null) { return false; } parent = parent.getParent(); diff --git a/org.springframework.context/src/main/java/org/springframework/jmx/export/MBeanExporter.java b/org.springframework.context/src/main/java/org/springframework/jmx/export/MBeanExporter.java index b137668f48f..b44cf0bd33a 100644 --- a/org.springframework.context/src/main/java/org/springframework/jmx/export/MBeanExporter.java +++ b/org.springframework.context/src/main/java/org/springframework/jmx/export/MBeanExporter.java @@ -760,6 +760,7 @@ public class MBeanExporter extends MBeanRegistrationSupport * @param bean the original bean instance * @return the adapted MBean, or null if not possible */ + @SuppressWarnings("unchecked") protected DynamicMBean adaptMBeanIfPossible(Object bean) throws JMException { Class targetClass = AopUtils.getTargetClass(bean); if (targetClass != bean.getClass()) { diff --git a/org.springframework.context/src/main/java/org/springframework/validation/Validator.java b/org.springframework.context/src/main/java/org/springframework/validation/Validator.java index 563d55e39a4..4ae10e00870 100644 --- a/org.springframework.context/src/main/java/org/springframework/validation/Validator.java +++ b/org.springframework.context/src/main/java/org/springframework/validation/Validator.java @@ -1,12 +1,12 @@ /* - * Copyright 2002-2007 the original author or authors. - * + * Copyright 2002-2009 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. @@ -18,21 +18,21 @@ package org.springframework.validation; /** * A validator for application-specific objects. - * + * *

This interface is totally divorced from any infrastructure * or context; that is to say it is not coupled to validating * only objects in the web tier, the data-access tier, or the * whatever-tier. As such it is amenable to being used in any layer * of an application, and supports the encapsulation of validation * logic as first-class citizens in their own right. - * + * *

Find below a simple but complete Validator * implementation, which validates that the various {@link String} * properties of a UserLogin instance are not empty * (that is they are not null and do not consist * wholly of whitespace), and that any password that is present is * at least 'MINIMUM_PASSWORD_LENGTH' characters in length. - * + * *

 public class UserLoginValidator implements Validator {
  * 
  *    private static final int MINIMUM_PASSWORD_LENGTH = 6;
@@ -53,17 +53,17 @@ package org.springframework.validation;
  *       }
  *    }
  * }
- * + * *

See also the Spring reference manual for a fuller discussion of * the Validator interface and it's role in a enterprise * application. - * + * * @author Rod Johnson * @see Errors * @see ValidationUtils */ public interface Validator { - + /** * Can this {@link Validator} {@link #validate(Object, Errors) validate} * instances of the supplied clazz? @@ -77,8 +77,8 @@ public interface Validator { * {@link #validate(Object, Errors) validate} instances of the * supplied clazz */ - boolean supports(Class clazz); - + boolean supports(Class clazz); + /** * Validate the supplied target object, which must be * of a {@link Class} for which the {@link #supports(Class)} method diff --git a/org.springframework.context/src/main/resources/org/springframework/context/config/spring-context-2.5.xsd b/org.springframework.context/src/main/resources/org/springframework/context/config/spring-context-2.5.xsd index 542eade52b4..fb8b1d6cc92 100644 --- a/org.springframework.context/src/main/resources/org/springframework/context/config/spring-context-2.5.xsd +++ b/org.springframework.context/src/main/resources/org/springframework/context/config/spring-context-2.5.xsd @@ -20,8 +20,8 @@ @@ -155,23 +155,22 @@ @@ -184,7 +183,8 @@ @@ -197,8 +197,8 @@