Polishing

This commit is contained in:
Juergen Hoeller
2013-10-27 21:26:16 +01:00
parent 44f79f95a7
commit 094ff8883d
2 changed files with 10 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -61,7 +61,7 @@ public class TypedStringValue implements BeanMetadataElement {
* @param value the String value * @param value the String value
* @param targetType the type to convert to * @param targetType the type to convert to
*/ */
public TypedStringValue(String value, Class targetType) { public TypedStringValue(String value, Class<?> targetType) {
setValue(value); setValue(value);
setTargetType(targetType); setTargetType(targetType);
} }
@@ -101,7 +101,7 @@ public class TypedStringValue implements BeanMetadataElement {
* for example in BeanFactoryPostProcessors. * for example in BeanFactoryPostProcessors.
* @see PropertyPlaceholderConfigurer * @see PropertyPlaceholderConfigurer
*/ */
public void setTargetType(Class targetType) { public void setTargetType(Class<?> targetType) {
Assert.notNull(targetType, "'targetType' must not be null"); Assert.notNull(targetType, "'targetType' must not be null");
this.targetType = targetType; this.targetType = targetType;
} }
@@ -109,7 +109,7 @@ public class TypedStringValue implements BeanMetadataElement {
/** /**
* Return the type to convert to. * Return the type to convert to.
*/ */
public Class getTargetType() { public Class<?> getTargetType() {
Object targetTypeValue = this.targetType; Object targetTypeValue = this.targetType;
if (!(targetTypeValue instanceof Class)) { if (!(targetTypeValue instanceof Class)) {
throw new IllegalStateException("Typed String value does not carry a resolved target type"); throw new IllegalStateException("Typed String value does not carry a resolved target type");
@@ -153,11 +153,11 @@ public class TypedStringValue implements BeanMetadataElement {
* @return the resolved type to convert to * @return the resolved type to convert to
* @throws ClassNotFoundException if the type cannot be resolved * @throws ClassNotFoundException if the type cannot be resolved
*/ */
public Class resolveTargetType(ClassLoader classLoader) throws ClassNotFoundException { public Class<?> resolveTargetType(ClassLoader classLoader) throws ClassNotFoundException {
if (this.targetType == null) { if (this.targetType == null) {
return null; return null;
} }
Class resolvedClass = ClassUtils.forName(getTargetTypeName(), classLoader); Class<?> resolvedClass = ClassUtils.forName(getTargetTypeName(), classLoader);
this.targetType = resolvedClass; this.targetType = resolvedClass;
return resolvedClass; return resolvedClass;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -128,7 +128,7 @@ class BeanDefinitionValueResolver {
else if (value instanceof ManagedArray) { else if (value instanceof ManagedArray) {
// May need to resolve contained runtime references. // May need to resolve contained runtime references.
ManagedArray array = (ManagedArray) value; ManagedArray array = (ManagedArray) value;
Class elementType = array.resolvedElementType; Class<?> elementType = array.resolvedElementType;
if (elementType == null) { if (elementType == null) {
String elementTypeName = array.getElementTypeName(); String elementTypeName = array.getElementTypeName();
if (StringUtils.hasText(elementTypeName)) { if (StringUtils.hasText(elementTypeName)) {
@@ -271,7 +271,7 @@ class BeanDefinitionValueResolver {
Object innerBean = this.beanFactory.createBean(actualInnerBeanName, mbd, null); Object innerBean = this.beanFactory.createBean(actualInnerBeanName, mbd, null);
this.beanFactory.registerContainedBean(actualInnerBeanName, this.beanName); this.beanFactory.registerContainedBean(actualInnerBeanName, this.beanName);
if (innerBean instanceof FactoryBean) { if (innerBean instanceof FactoryBean) {
boolean synthetic = (mbd != null && mbd.isSynthetic()); boolean synthetic = mbd.isSynthetic();
return this.beanFactory.getObjectFromFactoryBean((FactoryBean) innerBean, actualInnerBeanName, !synthetic); return this.beanFactory.getObjectFromFactoryBean((FactoryBean) innerBean, actualInnerBeanName, !synthetic);
} }
else { else {
@@ -335,7 +335,7 @@ class BeanDefinitionValueResolver {
/** /**
* For each element in the managed array, resolve reference if necessary. * For each element in the managed array, resolve reference if necessary.
*/ */
private Object resolveManagedArray(Object argName, List<?> ml, Class elementType) { private Object resolveManagedArray(Object argName, List<?> ml, Class<?> elementType) {
Object resolved = Array.newInstance(elementType, ml.size()); Object resolved = Array.newInstance(elementType, ml.size());
for (int i = 0; i < ml.size(); i++) { for (int i = 0; i < ml.size(); i++) {
Array.set(resolved, i, Array.set(resolved, i,