From aaa9fc73ae5a13e8dc91a07858428def68a05fd3 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 27 May 2009 12:54:19 +0000 Subject: [PATCH] polishing --- .../factory/config/DependencyDescriptor.java | 8 ++++---- .../support/AbstractBeanDefinitionReader.java | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java index 9eec915cd62..2c64c60637b 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java @@ -152,7 +152,7 @@ public class DependencyDescriptor { * Determine the declared (non-generic) type of the wrapped parameter/field. * @return the declared type (never null) */ - public Class getDependencyType() { + public Class getDependencyType() { 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. * @return the generic type, or null if none */ - public Class getCollectionType() { + public Class getCollectionType() { return (this.field != null ? GenericCollectionTypeResolver.getCollectionFieldType(this.field) : GenericCollectionTypeResolver.getCollectionParameterType(this.methodParameter)); @@ -170,7 +170,7 @@ public class DependencyDescriptor { * Determine the generic key type of the wrapped Map parameter/field, if any. * @return the generic type, or null if none */ - public Class getMapKeyType() { + public Class getMapKeyType() { return (this.field != null ? GenericCollectionTypeResolver.getMapKeyFieldType(this.field) : GenericCollectionTypeResolver.getMapKeyParameterType(this.methodParameter)); @@ -180,7 +180,7 @@ public class DependencyDescriptor { * Determine the generic value type of the wrapped Map parameter/field, if any. * @return the generic type, or null if none */ - public Class getMapValueType() { + public Class getMapValueType() { return (this.field != null ? GenericCollectionTypeResolver.getMapValueFieldType(this.field) : GenericCollectionTypeResolver.getMapValueParameterType(this.methodParameter)); diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java index be2ccba23c0..8d434d18562 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinitionReader.java @@ -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"); * 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 { Assert.notNull(resources, "Resource array must not be null"); int counter = 0; - for (int i = 0; i < resources.length; i++) { - counter += loadBeanDefinitions(resources[i]); + for (Resource resource : resources) { + counter += loadBeanDefinitions(resource); } 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[]) */ - public int loadBeanDefinitions(String location, Set actualResources) throws BeanDefinitionStoreException { + public int loadBeanDefinitions(String location, Set actualResources) throws BeanDefinitionStoreException { ResourceLoader resourceLoader = getResourceLoader(); if (resourceLoader == null) { throw new BeanDefinitionStoreException( @@ -177,8 +177,8 @@ public abstract class AbstractBeanDefinitionReader implements BeanDefinitionRead Resource[] resources = ((ResourcePatternResolver) resourceLoader).getResources(location); int loadCount = loadBeanDefinitions(resources); if (actualResources != null) { - for (int i = 0; i < resources.length; i++) { - actualResources.add(resources[i]); + for (Resource resource : resources) { + actualResources.add(resource); } } if (logger.isDebugEnabled()) { @@ -208,8 +208,8 @@ public abstract class AbstractBeanDefinitionReader implements BeanDefinitionRead public int loadBeanDefinitions(String[] locations) throws BeanDefinitionStoreException { Assert.notNull(locations, "Location array must not be null"); int counter = 0; - for (int i = 0; i < locations.length; i++) { - counter += loadBeanDefinitions(locations[i]); + for (String location : locations) { + counter += loadBeanDefinitions(location); } return counter; }