polishing

This commit is contained in:
Juergen Hoeller 2009-05-27 12:54:19 +00:00
parent 0a2f936b80
commit aaa9fc73ae
2 changed files with 12 additions and 12 deletions

View File

@ -152,7 +152,7 @@ public class DependencyDescriptor {
* Determine the declared (non-generic) type of the wrapped parameter/field. * Determine the declared (non-generic) type of the wrapped parameter/field.
* @return the declared type (never <code>null</code>) * @return the declared type (never <code>null</code>)
*/ */
public Class getDependencyType() { public Class<?> getDependencyType() {
return (this.field != null ? this.field.getType() : this.methodParameter.getParameterType()); return (this.field != null ? this.field.getType() : this.methodParameter.getParameterType());
} }
@ -160,7 +160,7 @@ public class DependencyDescriptor {
* Determine the generic element type of the wrapped Collection parameter/field, if any. * Determine the generic element type of the wrapped Collection parameter/field, if any.
* @return the generic type, or <code>null</code> if none * @return the generic type, or <code>null</code> if none
*/ */
public Class getCollectionType() { public Class<?> getCollectionType() {
return (this.field != null ? return (this.field != null ?
GenericCollectionTypeResolver.getCollectionFieldType(this.field) : GenericCollectionTypeResolver.getCollectionFieldType(this.field) :
GenericCollectionTypeResolver.getCollectionParameterType(this.methodParameter)); GenericCollectionTypeResolver.getCollectionParameterType(this.methodParameter));
@ -170,7 +170,7 @@ public class DependencyDescriptor {
* Determine the generic key type of the wrapped Map parameter/field, if any. * Determine the generic key type of the wrapped Map parameter/field, if any.
* @return the generic type, or <code>null</code> if none * @return the generic type, or <code>null</code> if none
*/ */
public Class getMapKeyType() { public Class<?> getMapKeyType() {
return (this.field != null ? return (this.field != null ?
GenericCollectionTypeResolver.getMapKeyFieldType(this.field) : GenericCollectionTypeResolver.getMapKeyFieldType(this.field) :
GenericCollectionTypeResolver.getMapKeyParameterType(this.methodParameter)); GenericCollectionTypeResolver.getMapKeyParameterType(this.methodParameter));
@ -180,7 +180,7 @@ public class DependencyDescriptor {
* Determine the generic value type of the wrapped Map parameter/field, if any. * Determine the generic value type of the wrapped Map parameter/field, if any.
* @return the generic type, or <code>null</code> if none * @return the generic type, or <code>null</code> if none
*/ */
public Class getMapValueType() { public Class<?> getMapValueType() {
return (this.field != null ? return (this.field != null ?
GenericCollectionTypeResolver.getMapValueFieldType(this.field) : GenericCollectionTypeResolver.getMapValueFieldType(this.field) :
GenericCollectionTypeResolver.getMapValueParameterType(this.methodParameter)); GenericCollectionTypeResolver.getMapValueParameterType(this.methodParameter));

View File

@ -1,5 +1,5 @@
/* /*
* 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"); * 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.
@ -139,8 +139,8 @@ public abstract class AbstractBeanDefinitionReader implements BeanDefinitionRead
public int loadBeanDefinitions(Resource[] resources) throws BeanDefinitionStoreException { public int loadBeanDefinitions(Resource[] resources) throws BeanDefinitionStoreException {
Assert.notNull(resources, "Resource array must not be null"); Assert.notNull(resources, "Resource array must not be null");
int counter = 0; int counter = 0;
for (int i = 0; i < resources.length; i++) { for (Resource resource : resources) {
counter += loadBeanDefinitions(resources[i]); counter += loadBeanDefinitions(resource);
} }
return counter; return counter;
} }
@ -164,7 +164,7 @@ public abstract class AbstractBeanDefinitionReader implements BeanDefinitionRead
* @see #loadBeanDefinitions(org.springframework.core.io.Resource) * @see #loadBeanDefinitions(org.springframework.core.io.Resource)
* @see #loadBeanDefinitions(org.springframework.core.io.Resource[]) * @see #loadBeanDefinitions(org.springframework.core.io.Resource[])
*/ */
public int loadBeanDefinitions(String location, Set actualResources) throws BeanDefinitionStoreException { public int loadBeanDefinitions(String location, Set<Resource> actualResources) throws BeanDefinitionStoreException {
ResourceLoader resourceLoader = getResourceLoader(); ResourceLoader resourceLoader = getResourceLoader();
if (resourceLoader == null) { if (resourceLoader == null) {
throw new BeanDefinitionStoreException( throw new BeanDefinitionStoreException(
@ -177,8 +177,8 @@ public abstract class AbstractBeanDefinitionReader implements BeanDefinitionRead
Resource[] resources = ((ResourcePatternResolver) resourceLoader).getResources(location); Resource[] resources = ((ResourcePatternResolver) resourceLoader).getResources(location);
int loadCount = loadBeanDefinitions(resources); int loadCount = loadBeanDefinitions(resources);
if (actualResources != null) { if (actualResources != null) {
for (int i = 0; i < resources.length; i++) { for (Resource resource : resources) {
actualResources.add(resources[i]); actualResources.add(resource);
} }
} }
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
@ -208,8 +208,8 @@ public abstract class AbstractBeanDefinitionReader implements BeanDefinitionRead
public int loadBeanDefinitions(String[] locations) throws BeanDefinitionStoreException { public int loadBeanDefinitions(String[] locations) throws BeanDefinitionStoreException {
Assert.notNull(locations, "Location array must not be null"); Assert.notNull(locations, "Location array must not be null");
int counter = 0; int counter = 0;
for (int i = 0; i < locations.length; i++) { for (String location : locations) {
counter += loadBeanDefinitions(locations[i]); counter += loadBeanDefinitions(location);
} }
return counter; return counter;
} }