Java 5 code style
This commit is contained in:
@@ -481,7 +481,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||
private PropertyTokenHolder getPropertyNameTokens(String propertyName) {
|
||||
PropertyTokenHolder tokens = new PropertyTokenHolder();
|
||||
String actualName = null;
|
||||
List keys = new ArrayList(2);
|
||||
List<String> keys = new ArrayList<String>(2);
|
||||
int searchIndex = 0;
|
||||
while (searchIndex != -1) {
|
||||
int keyStart = propertyName.indexOf(PROPERTY_KEY_PREFIX, searchIndex);
|
||||
|
||||
@@ -129,10 +129,10 @@ final class PropertyMatches {
|
||||
* @param maxDistance the maximum distance to accept
|
||||
*/
|
||||
private String[] calculateMatches(PropertyDescriptor[] propertyDescriptors, int maxDistance) {
|
||||
List candidates = new ArrayList();
|
||||
for (int i = 0; i < propertyDescriptors.length; i++) {
|
||||
if (propertyDescriptors[i].getWriteMethod() != null) {
|
||||
String possibleAlternative = propertyDescriptors[i].getName();
|
||||
List<String> candidates = new ArrayList<String>();
|
||||
for (PropertyDescriptor pd : propertyDescriptors) {
|
||||
if (pd.getWriteMethod() != null) {
|
||||
String possibleAlternative = pd.getName();
|
||||
if (calculateStringDistance(this.propertyName, possibleAlternative) <= maxDistance) {
|
||||
candidates.add(possibleAlternative);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class PropertyOverrideConfigurer extends PropertyResourceConfigurer {
|
||||
private boolean ignoreInvalidKeys = false;
|
||||
|
||||
/** Contains names of beans that have overrides */
|
||||
private Set beanNames = Collections.synchronizedSet(new HashSet());
|
||||
private Set<String> beanNames = Collections.synchronizedSet(new HashSet<String>());
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,8 +73,8 @@ public class BeanComponentDefinition extends BeanDefinitionHolder implements Com
|
||||
|
||||
|
||||
private void findInnerBeanDefinitionsAndBeanReferences(BeanDefinition beanDefinition) {
|
||||
List innerBeans = new ArrayList();
|
||||
List references = new ArrayList();
|
||||
List<BeanDefinition> innerBeans = new ArrayList<BeanDefinition>();
|
||||
List<BeanReference> references = new ArrayList<BeanReference>();
|
||||
PropertyValues propertyValues = beanDefinition.getPropertyValues();
|
||||
for (int i = 0; i < propertyValues.getPropertyValues().length; i++) {
|
||||
PropertyValue propertyValue = propertyValues.getPropertyValues()[i];
|
||||
@@ -83,14 +83,14 @@ public class BeanComponentDefinition extends BeanDefinitionHolder implements Com
|
||||
innerBeans.add(((BeanDefinitionHolder) value).getBeanDefinition());
|
||||
}
|
||||
else if (value instanceof BeanDefinition) {
|
||||
innerBeans.add(value);
|
||||
innerBeans.add((BeanDefinition) value);
|
||||
}
|
||||
else if (value instanceof BeanReference) {
|
||||
references.add(value);
|
||||
references.add((BeanReference) value);
|
||||
}
|
||||
}
|
||||
this.innerBeanDefinitions = (BeanDefinition[]) innerBeans.toArray(new BeanDefinition[innerBeans.size()]);
|
||||
this.beanReferences = (BeanReference[]) references.toArray(new BeanReference[references.size()]);
|
||||
this.innerBeanDefinitions = innerBeans.toArray(new BeanDefinition[innerBeans.size()]);
|
||||
this.beanReferences = references.toArray(new BeanReference[references.size()]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
* Copyright 2002-2008 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.
|
||||
@@ -36,7 +36,7 @@ public class CompositeComponentDefinition extends AbstractComponentDefinition {
|
||||
|
||||
private final Object source;
|
||||
|
||||
private final List nestedComponents = new LinkedList();
|
||||
private final List<ComponentDefinition> nestedComponents = new LinkedList<ComponentDefinition>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -74,8 +74,7 @@ public class CompositeComponentDefinition extends AbstractComponentDefinition {
|
||||
* @return the array of nested components, or an empty array if none
|
||||
*/
|
||||
public ComponentDefinition[] getNestedComponents() {
|
||||
return (ComponentDefinition[])
|
||||
this.nestedComponents.toArray(new ComponentDefinition[this.nestedComponents.size()]);
|
||||
return this.nestedComponents.toArray(new ComponentDefinition[this.nestedComponents.size()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2008 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.
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.beans.factory.serviceloader;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
@@ -36,10 +35,9 @@ public class ServiceListFactoryBean extends AbstractServiceLoaderBasedFactoryBea
|
||||
|
||||
@Override
|
||||
protected Object getObjectToExpose(ServiceLoader serviceLoader) {
|
||||
List result = new LinkedList();
|
||||
Iterator it = serviceLoader.iterator();
|
||||
while (it.hasNext()) {
|
||||
result.add(it.next());
|
||||
List<Object> result = new LinkedList<Object>();
|
||||
for (Object loaderObject : serviceLoader) {
|
||||
result.add(loaderObject);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ class BeanDefinitionValueResolver {
|
||||
* For each element in the ManagedList, resolve reference if necessary.
|
||||
*/
|
||||
private List resolveManagedList(Object argName, List<?> ml) {
|
||||
List resolved = new ArrayList(ml.size());
|
||||
List<Object> resolved = new ArrayList<Object>(ml.size());
|
||||
for (int i = 0; i < ml.size(); i++) {
|
||||
resolved.add(
|
||||
resolveValueIfNecessary(
|
||||
@@ -309,7 +309,7 @@ class BeanDefinitionValueResolver {
|
||||
* For each element in the ManagedList, resolve reference if necessary.
|
||||
*/
|
||||
private Set resolveManagedSet(Object argName, Set<?> ms) {
|
||||
Set resolved = new LinkedHashSet(ms.size());
|
||||
Set<Object> resolved = new LinkedHashSet<Object>(ms.size());
|
||||
int i = 0;
|
||||
for (Object m : ms) {
|
||||
resolved.add(resolveValueIfNecessary(
|
||||
@@ -323,7 +323,7 @@ class BeanDefinitionValueResolver {
|
||||
* For each element in the ManagedMap, resolve reference if necessary.
|
||||
*/
|
||||
private Map resolveManagedMap(Object argName, Map<?, ?> mm) {
|
||||
Map resolved = new LinkedHashMap(mm.size());
|
||||
Map<Object, Object> resolved = new LinkedHashMap<Object, Object>(mm.size());
|
||||
for (Map.Entry entry : mm.entrySet()) {
|
||||
Object resolvedKey = resolveValueIfNecessary(argName, entry.getKey());
|
||||
Object resolvedValue = resolveValueIfNecessary(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2008 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.
|
||||
@@ -35,13 +35,10 @@ import org.springframework.util.ObjectUtils;
|
||||
* @since 1.1
|
||||
*/
|
||||
public class ReplaceOverride extends MethodOverride {
|
||||
|
||||
|
||||
private final String methodReplacerBeanName;
|
||||
|
||||
/**
|
||||
* List of String. Identifying signatures.
|
||||
*/
|
||||
private List typeIdentifiers = new LinkedList();
|
||||
|
||||
private List<String> typeIdentifiers = new LinkedList<String>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -90,8 +87,8 @@ public class ReplaceOverride extends MethodOverride {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < this.typeIdentifiers.size(); i++) {
|
||||
String identifier = (String) this.typeIdentifiers.get(i);
|
||||
if (method.getParameterTypes()[i].getName().indexOf(identifier) == -1) {
|
||||
String identifier = this.typeIdentifiers.get(i);
|
||||
if (!method.getParameterTypes()[i].getName().contains(identifier)) {
|
||||
// This parameter cannot match.
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -45,11 +45,11 @@ import org.springframework.beans.factory.config.ConstructorArgumentValues;
|
||||
*/
|
||||
public class RootBeanDefinition extends AbstractBeanDefinition {
|
||||
|
||||
private final Set externallyManagedConfigMembers = Collections.synchronizedSet(new HashSet());
|
||||
private final Set<Member> externallyManagedConfigMembers = Collections.synchronizedSet(new HashSet<Member>());
|
||||
|
||||
private final Set externallyManagedInitMethods = Collections.synchronizedSet(new HashSet());
|
||||
private final Set<String> externallyManagedInitMethods = Collections.synchronizedSet(new HashSet<String>());
|
||||
|
||||
private final Set externallyManagedDestroyMethods = Collections.synchronizedSet(new HashSet());
|
||||
private final Set<String> externallyManagedDestroyMethods = Collections.synchronizedSet(new HashSet<String>());
|
||||
|
||||
/** Package-visible field for caching the resolved constructor or factory method */
|
||||
volatile Object resolvedConstructorOrFactoryMethod;
|
||||
|
||||
@@ -238,7 +238,7 @@ public class BeanDefinitionParserDelegate {
|
||||
/**
|
||||
* Stores all used bean names so we can enforce uniqueness on a per file basis.
|
||||
*/
|
||||
private final Set usedNames = new HashSet();
|
||||
private final Set<String> usedNames = new HashSet<String>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -366,7 +366,7 @@ public class BeanDefinitionParserDelegate {
|
||||
String id = ele.getAttribute(ID_ATTRIBUTE);
|
||||
String nameAttr = ele.getAttribute(NAME_ATTRIBUTE);
|
||||
|
||||
List aliases = new ArrayList();
|
||||
List<String> aliases = new ArrayList<String>();
|
||||
if (StringUtils.hasLength(nameAttr)) {
|
||||
String[] nameArr = StringUtils.tokenizeToStringArray(nameAttr, BEAN_NAME_DELIMITERS);
|
||||
aliases.addAll(Arrays.asList(nameArr));
|
||||
|
||||
@@ -170,12 +170,12 @@ public class DefaultBeanDefinitionDocumentReader implements BeanDefinitionDocume
|
||||
|
||||
if (ResourcePatternUtils.isUrl(location)) {
|
||||
try {
|
||||
Set actualResources = new LinkedHashSet(4);
|
||||
Set<Resource> actualResources = new LinkedHashSet<Resource> (4);
|
||||
int importCount = getReaderContext().getReader().loadBeanDefinitions(location, actualResources);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Imported " + importCount + " bean definitions from URL location [" + location + "]");
|
||||
}
|
||||
Resource[] actResArray = (Resource[]) actualResources.toArray(new Resource[actualResources.size()]);
|
||||
Resource[] actResArray = actualResources.toArray(new Resource[actualResources.size()]);
|
||||
getReaderContext().fireImportProcessed(location, actResArray, extractSource(ele));
|
||||
}
|
||||
catch (BeanDefinitionStoreException ex) {
|
||||
|
||||
Reference in New Issue
Block a user