polishing

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2100 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller 2009-10-13 20:59:10 +00:00
parent 3f2884910a
commit fd54577c86
6 changed files with 94 additions and 77 deletions

View File

@ -136,8 +136,7 @@ public class PropertyBatchUpdateException extends BeansException {
if (exType.isInstance(this)) {
return true;
}
for (int i = 0; i < this.propertyAccessExceptions.length; i++) {
PropertyAccessException pae = this.propertyAccessExceptions[i];
for (PropertyAccessException pae : this.propertyAccessExceptions) {
if (pae.contains(exType)) {
return true;
}

View File

@ -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.
@ -74,6 +74,7 @@ public class CustomScopeConfigurer implements BeanFactoryPostProcessor, BeanClas
}
@SuppressWarnings("unchecked")
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
if (this.scopes != null) {
for (Map.Entry<String, Object> entry : this.scopes.entrySet()) {

View File

@ -426,10 +426,10 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
if (System.getSecurityManager() != null) {
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() {
return Boolean.valueOf(((factoryBean instanceof SmartFactoryBean && ((SmartFactoryBean) factoryBean).isPrototype()) ||
!factoryBean.isSingleton()));
return ((factoryBean instanceof SmartFactoryBean && ((SmartFactoryBean) factoryBean).isPrototype()) ||
!factoryBean.isSingleton());
}
}, getAccessControlContext()).booleanValue();
}, getAccessControlContext());
}
else {
return ((factoryBean instanceof SmartFactoryBean && ((SmartFactoryBean) factoryBean).isPrototype()) ||
@ -1015,9 +1015,8 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
if (!this.customEditors.isEmpty()) {
for (Map.Entry<Class, Class<? extends PropertyEditor>> entry : this.customEditors.entrySet()) {
Class requiredType = entry.getKey();
Class editorClass = entry.getValue();
registry.registerCustomEditor(requiredType,
(PropertyEditor) BeanUtils.instantiateClass(editorClass));
Class<? extends PropertyEditor> editorClass = entry.getValue();
registry.registerCustomEditor(requiredType, BeanUtils.instantiateClass(editorClass));
}
}
}
@ -1196,10 +1195,8 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
if (mbd.hasBeanClass()) {
return mbd.getBeanClass();
}
if (System.getSecurityManager() != null) {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Class>() {
public Class run() throws Exception {
return doResolveBeanClass(mbd, typesToMatch);
}
@ -1211,10 +1208,10 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
}
catch (PrivilegedActionException pae) {
ClassNotFoundException ex = (ClassNotFoundException) pae.getException();
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), (ClassNotFoundException) ex);
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), ex);
}
catch (ClassNotFoundException ex) {
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), (ClassNotFoundException) ex);
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), ex);
}
catch (LinkageError err) {
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), err);

View File

@ -518,8 +518,8 @@ public class BeanDefinitionParserDelegate {
}
else if (ele.hasAttribute(SINGLETON_ATTRIBUTE)) {
// Spring 1.x "singleton" attribute
bd.setScope(TRUE_VALUE.equals(ele.getAttribute(SINGLETON_ATTRIBUTE)) ? BeanDefinition.SCOPE_SINGLETON
: BeanDefinition.SCOPE_PROTOTYPE);
bd.setScope(TRUE_VALUE.equals(ele.getAttribute(SINGLETON_ATTRIBUTE)) ?
BeanDefinition.SCOPE_SINGLETON : BeanDefinition.SCOPE_PROTOTYPE);
}
else if (containingBean != null) {
// Take default from containing bean in case of an inner bean definition.

View File

@ -1,3 +1,19 @@
/*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.jmx.export.annotation;
import java.lang.annotation.Documented;
@ -13,7 +29,6 @@ import org.springframework.jmx.support.MetricType;
* property as JMX attribute, with added Descriptor properties to indicate that
* it is a metric. Only valid when used on a JavaBean getter.
*
*
* @author Jennifer Hickey
* @since 3.0
* @see org.springframework.jmx.export.metadata.ManagedMetric

View File

@ -1,3 +1,19 @@
/*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.jmx.export.metadata;
import org.springframework.jmx.support.MetricType;
@ -25,100 +41,89 @@ public class ManagedMetric extends AbstractJmxAttribute {
private String unit = "";
/**
*
*@return The category of this metric (ex. throughput, performance, utilization)
*/
public String getCategory() {
return category;
}
/**
*
* @return A display name for this metric
*/
public String getDisplayName() {
return displayName;
}
/**
*
* @return A description of how this metric's values change over time
*/
public MetricType getMetricType() {
return metricType;
}
/**
*
* @return The persist period for this metric
*/
public int getPersistPeriod() {
return persistPeriod;
}
/**
*
* @return The persist policy for this metric
*/
public String getPersistPolicy() {
return persistPolicy;
}
/**
*
* @return The expected unit of measurement values
*/
public String getUnit() {
return unit;
}
/**
*
* @param category The category of this metric (ex. throughput, performance, utilization)
* The category of this metric (ex. throughput, performance, utilization).
*/
public void setCategory(String category) {
this.category = category;
}
/**
*
* @param displayName A display name for this metric
* The category of this metric (ex. throughput, performance, utilization).
*/
public String getCategory() {
return this.category;
}
/**
* A display name for this metric.
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
/**
*
* @param metricType A description of how this metric's values change over time
* A display name for this metric.
*/
public String getDisplayName() {
return this.displayName;
}
/**
* A description of how this metric's values change over time.
*/
public void setMetricType(MetricType metricType) {
this.metricType = metricType;
}
/**
*
* @param persistPeriod The persist period for this metric
* A description of how this metric's values change over time.
*/
public MetricType getMetricType() {
return this.metricType;
}
/**
* The persist period for this metric.
*/
public void setPersistPeriod(int persistPeriod) {
this.persistPeriod = persistPeriod;
}
/**
*
* @param persistPolicy The persist policy for this metric
* The persist period for this metric.
*/
public int getPersistPeriod() {
return this.persistPeriod;
}
/**
* The persist policy for this metric.
*/
public void setPersistPolicy(String persistPolicy) {
this.persistPolicy = persistPolicy;
}
/**
*
* @param unit The expected unit of measurement values
* The persist policy for this metric.
*/
public String getPersistPolicy() {
return this.persistPolicy;
}
/**
* The expected unit of measurement values.
*/
public void setUnit(String unit) {
this.unit = unit;
}
/**
* The expected unit of measurement values.
*/
public String getUnit() {
return this.unit;
}
}