Java 5 code style

This commit is contained in:
Juergen Hoeller
2008-11-25 01:29:54 +00:00
parent 1f9e63af49
commit 29657105da
71 changed files with 726 additions and 877 deletions

View File

@@ -17,7 +17,6 @@
package org.springframework.context.annotation;
import java.lang.annotation.Annotation;
import java.util.Iterator;
import java.util.Set;
import java.util.regex.Pattern;
@@ -134,8 +133,7 @@ public class ComponentScanBeanDefinitionParser implements BeanDefinitionParser {
Object source = readerContext.extractSource(element);
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), source);
for (Iterator it = beanDefinitions.iterator(); it.hasNext();) {
BeanDefinitionHolder beanDefHolder = (BeanDefinitionHolder) it.next();
for (BeanDefinitionHolder beanDefHolder : beanDefinitions) {
compositeDef.addNestedComponent(new BeanComponentDefinition(beanDefHolder));
}

View File

@@ -108,7 +108,7 @@ public abstract class AbstractApplicationEventMulticaster implements Application
* @return a Collection of ApplicationListeners
* @see org.springframework.context.ApplicationListener
*/
protected Collection getApplicationListeners() {
protected Collection<ApplicationListener> getApplicationListeners() {
return this.applicationListeners;
}

View File

@@ -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,8 +16,6 @@
package org.springframework.context.event;
import java.util.Iterator;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.task.SyncTaskExecutor;
@@ -71,8 +69,7 @@ public class SimpleApplicationEventMulticaster extends AbstractApplicationEventM
public void multicastEvent(final ApplicationEvent event) {
for (Iterator it = getApplicationListeners().iterator(); it.hasNext();) {
final ApplicationListener listener = (ApplicationListener) it.next();
for (final ApplicationListener listener : getApplicationListeners()) {
getTaskExecutor().execute(new Runnable() {
public void run() {
listener.onApplicationEvent(event);

View File

@@ -22,7 +22,6 @@ import java.io.InputStreamReader;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -112,10 +111,11 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
private ResourceLoader resourceLoader = new DefaultResourceLoader();
/** Cache to hold filename lists per Locale */
private final Map cachedFilenames = new HashMap();
private final Map<String, Map<Locale, List<String>>> cachedFilenames =
new HashMap<String, Map<Locale, List<String>>>();
/** Cache to hold already loaded properties per filename */
private final Map cachedProperties = new HashMap();
private final Map<String, PropertiesHolder> cachedProperties = new HashMap<String, PropertiesHolder>();
/** Cache to hold merged loaded properties per basename */
private final Map cachedMergedProperties = new HashMap();
@@ -271,10 +271,9 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
}
}
else {
for (int i = 0; i < this.basenames.length; i++) {
List filenames = calculateAllFilenames(this.basenames[i], locale);
for (int j = 0; j < filenames.size(); j++) {
String filename = (String) filenames.get(j);
for (String basename : this.basenames) {
List<String> filenames = calculateAllFilenames(basename, locale);
for (String filename : filenames) {
PropertiesHolder propHolder = getProperties(filename);
String result = propHolder.getProperty(code);
if (result != null) {
@@ -300,8 +299,8 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
}
}
else {
for (int i = 0; i < this.basenames.length; i++) {
List filenames = calculateAllFilenames(this.basenames[i], locale);
for (String basename : this.basenames) {
List filenames = calculateAllFilenames(basename, locale);
for (int j = 0; j < filenames.size(); j++) {
String filename = (String) filenames.get(j);
PropertiesHolder propHolder = getProperties(filename);
@@ -357,21 +356,20 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
* @see #setFallbackToSystemLocale
* @see #calculateFilenamesForLocale
*/
protected List calculateAllFilenames(String basename, Locale locale) {
protected List<String> calculateAllFilenames(String basename, Locale locale) {
synchronized (this.cachedFilenames) {
Map localeMap = (Map) this.cachedFilenames.get(basename);
Map<Locale, List<String>> localeMap = this.cachedFilenames.get(basename);
if (localeMap != null) {
List filenames = (List) localeMap.get(locale);
List<String> filenames = localeMap.get(locale);
if (filenames != null) {
return filenames;
}
}
List filenames = new ArrayList(7);
List<String> filenames = new ArrayList<String>(7);
filenames.addAll(calculateFilenamesForLocale(basename, locale));
if (this.fallbackToSystemLocale && !locale.equals(Locale.getDefault())) {
List fallbackFilenames = calculateFilenamesForLocale(basename, Locale.getDefault());
for (Iterator it = fallbackFilenames.iterator(); it.hasNext();) {
String fallbackFilename = (String) it.next();
List<String> fallbackFilenames = calculateFilenamesForLocale(basename, Locale.getDefault());
for (String fallbackFilename : fallbackFilenames) {
if (!filenames.contains(fallbackFilename)) {
// Entry for fallback locale that isn't already in filenames list.
filenames.add(fallbackFilename);
@@ -383,7 +381,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
localeMap.put(locale, filenames);
}
else {
localeMap = new HashMap();
localeMap = new HashMap<Locale, List<String>>();
localeMap.put(locale, filenames);
this.cachedFilenames.put(basename, localeMap);
}
@@ -400,8 +398,8 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
* @param locale the locale
* @return the List of filenames to check
*/
protected List calculateFilenamesForLocale(String basename, Locale locale) {
List result = new ArrayList(3);
protected List<String> calculateFilenamesForLocale(String basename, Locale locale) {
List<String> result = new ArrayList<String>(3);
String language = locale.getLanguage();
String country = locale.getCountry();
String variant = locale.getVariant();
@@ -434,7 +432,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
*/
protected PropertiesHolder getProperties(String filename) {
synchronized (this.cachedProperties) {
PropertiesHolder propHolder = (PropertiesHolder) this.cachedProperties.get(filename);
PropertiesHolder propHolder = this.cachedProperties.get(filename);
if (propHolder != null &&
(propHolder.getRefreshTimestamp() < 0 ||
propHolder.getRefreshTimestamp() > System.currentTimeMillis() - this.cacheMillis)) {
@@ -603,7 +601,8 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
private long refreshTimestamp = -1;
/** Cache to hold already generated MessageFormats per message code */
private final Map cachedMessageFormats = new HashMap();
private final Map<String, Map<Locale, MessageFormat>> cachedMessageFormats =
new HashMap<String, Map<Locale, MessageFormat>>();
public PropertiesHolder(Properties properties, long fileTimestamp) {
this.properties = properties;
@@ -641,9 +640,9 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
return null;
}
synchronized (this.cachedMessageFormats) {
Map localeMap = (Map) this.cachedMessageFormats.get(code);
Map<Locale, MessageFormat> localeMap = this.cachedMessageFormats.get(code);
if (localeMap != null) {
MessageFormat result = (MessageFormat) localeMap.get(locale);
MessageFormat result = localeMap.get(locale);
if (result != null) {
return result;
}
@@ -651,7 +650,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractMessageSource
String msg = this.properties.getProperty(code);
if (msg != null) {
if (localeMap == null) {
localeMap = new HashMap();
localeMap = new HashMap<Locale, MessageFormat>();
this.cachedMessageFormats.put(code, localeMap);
}
MessageFormat result = createMessageFormat(msg, locale);

View File

@@ -18,7 +18,6 @@ package org.springframework.context.support;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
@@ -37,12 +36,12 @@ import org.springframework.util.Assert;
public class StaticMessageSource extends AbstractMessageSource {
/** Map from 'code + locale' keys to message Strings */
private final Map messages = new HashMap();
private final Map<String, MessageFormat> messages = new HashMap<String, MessageFormat>();
@Override
protected MessageFormat resolveCode(String code, Locale locale) {
return (MessageFormat) this.messages.get(code + "_" + locale.toString());
return this.messages.get(code + "_" + locale.toString());
}
/**
@@ -65,13 +64,12 @@ public class StaticMessageSource extends AbstractMessageSource {
* Associate the given message values with the given keys as codes.
* @param messages the messages to register, with messages codes
* as keys and message texts as values
* @param locale the locale that the messages should be found within
* @param locale the locale that the messages should be found within
*/
public void addMessages(Map messages, Locale locale) {
public void addMessages(Map<String, String> messages, Locale locale) {
Assert.notNull(messages, "Messages Map must not be null");
for (Iterator it = messages.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
addMessage(entry.getKey().toString(), locale, entry.getValue().toString());
for (Map.Entry<String, String> entry : messages.entrySet()) {
addMessage(entry.getKey(), locale, entry.getValue());
}
}

View File

@@ -16,10 +16,8 @@
package org.springframework.jmx.support;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.JMException;
@@ -106,7 +104,7 @@ public class MBeanRegistrationSupport {
/**
* The beans that have been registered by this exporter.
*/
protected final Set registeredBeans = new LinkedHashSet();
protected final Set<ObjectName> registeredBeans = new LinkedHashSet<ObjectName>();
/**
* The action take when registering an MBean and finding that it already exists.
@@ -207,8 +205,8 @@ public class MBeanRegistrationSupport {
* Unregisters all beans that have been registered by an instance of this class.
*/
protected void unregisterBeans() {
for (Iterator it = this.registeredBeans.iterator(); it.hasNext();) {
doUnregister((ObjectName) it.next());
for (ObjectName objectName : this.registeredBeans) {
doUnregister(objectName);
}
this.registeredBeans.clear();
}
@@ -242,7 +240,7 @@ public class MBeanRegistrationSupport {
* Return the {@link ObjectName ObjectNames} of all registered beans.
*/
protected final ObjectName[] getRegisteredObjectNames() {
return (ObjectName[]) this.registeredBeans.toArray(new ObjectName[this.registeredBeans.size()]);
return this.registeredBeans.toArray(new ObjectName[this.registeredBeans.size()]);
}

View File

@@ -168,7 +168,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
final DefaultListableBeanFactory scriptBeanFactory = new DefaultListableBeanFactory();
/** Map from bean name String to ScriptSource object */
private final Map scriptSourceCache = new HashMap();
private final Map<String, ScriptSource> scriptSourceCache = new HashMap<String, ScriptSource>();
/**
@@ -202,9 +202,8 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
// Filter out BeanPostProcessors that are part of the AOP infrastructure,
// since those are only meant to apply to beans defined in the original factory.
for (Iterator it = this.scriptBeanFactory.getBeanPostProcessors().iterator(); it.hasNext();) {
BeanPostProcessor postProcessor = (BeanPostProcessor) it.next();
if (postProcessor instanceof AopInfrastructureBean) {
for (Iterator<BeanPostProcessor> it = this.scriptBeanFactory.getBeanPostProcessors().iterator(); it.hasNext();) {
if (it.next() instanceof AopInfrastructureBean) {
it.remove();
}
}
@@ -233,8 +232,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName;
prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName);
ScriptFactory scriptFactory =
(ScriptFactory) this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
ScriptSource scriptSource =
getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
Class[] interfaces = scriptFactory.getScriptInterfaces();
@@ -284,8 +282,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
String scriptedObjectBeanName = SCRIPTED_OBJECT_NAME_PREFIX + beanName;
prepareScriptBeans(bd, scriptFactoryBeanName, scriptedObjectBeanName);
ScriptFactory scriptFactory =
(ScriptFactory) this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
ScriptSource scriptSource =
getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
boolean isFactoryBean = false;
@@ -334,8 +331,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
this.scriptBeanFactory.registerBeanDefinition(
scriptFactoryBeanName, createScriptFactoryBeanDefinition(bd));
ScriptFactory scriptFactory =
(ScriptFactory) this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
ScriptFactory scriptFactory = this.scriptBeanFactory.getBean(scriptFactoryBeanName, ScriptFactory.class);
ScriptSource scriptSource =
getScriptSource(scriptFactoryBeanName, scriptFactory.getScriptSourceLocator());
Class[] interfaces = scriptFactory.getScriptInterfaces();
@@ -410,7 +406,7 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
*/
protected ScriptSource getScriptSource(String beanName, String scriptSourceLocator) {
synchronized (this.scriptSourceCache) {
ScriptSource scriptSource = (ScriptSource) this.scriptSourceCache.get(beanName);
ScriptSource scriptSource = this.scriptSourceCache.get(beanName);
if (scriptSource == null) {
scriptSource = convertToScriptSource(beanName, scriptSourceLocator, this.resourceLoader);
this.scriptSourceCache.put(beanName, scriptSource);
@@ -457,8 +453,8 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
protected Class createConfigInterface(BeanDefinition bd, Class[] interfaces) {
InterfaceMaker maker = new InterfaceMaker();
PropertyValue[] pvs = bd.getPropertyValues().getPropertyValues();
for (int i = 0; i < pvs.length; i++) {
String propertyName = pvs[i].getName();
for (PropertyValue pv : pvs) {
String propertyName = pv.getName();
Class propertyType = BeanUtils.findPropertyType(propertyName, interfaces);
String setterName = "set" + StringUtils.capitalize(propertyName);
Signature signature = new Signature(setterName, Type.VOID_TYPE, new Type[] {Type.getType(propertyType)});

View File

@@ -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.
@@ -17,7 +17,6 @@
package org.springframework.ui.context.support;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.commons.logging.Log;
@@ -51,7 +50,7 @@ public class ResourceBundleThemeSource implements HierarchicalThemeSource {
private String basenamePrefix = "";
/** Map from theme name to Theme instance */
private final Map themeCache = new HashMap();
private final Map<String, Theme> themeCache = new HashMap<String, Theme>();
public void setParentThemeSource(ThemeSource parent) {
@@ -60,9 +59,8 @@ public class ResourceBundleThemeSource implements HierarchicalThemeSource {
// Update existing Theme objects.
// Usually there shouldn't be any at the time of this call.
synchronized (this.themeCache) {
Iterator it = this.themeCache.values().iterator();
while (it.hasNext()) {
initParent((Theme) it.next());
for (Theme theme : this.themeCache.values()) {
initParent(theme);
}
}
}
@@ -100,7 +98,7 @@ public class ResourceBundleThemeSource implements HierarchicalThemeSource {
return null;
}
synchronized (this.themeCache) {
Theme theme = (Theme) this.themeCache.get(themeName);
Theme theme = this.themeCache.get(themeName);
if (theme == null) {
String basename = this.basenamePrefix + themeName;
MessageSource messageSource = createMessageSource(basename);

View File

@@ -21,7 +21,6 @@ import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -46,9 +45,9 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
private MessageCodesResolver messageCodesResolver = new DefaultMessageCodesResolver();
private final List errors = new LinkedList();
private final List<ObjectError> errors = new LinkedList<ObjectError>();
private final Set suppressedFields = new HashSet();
private final Set<String> suppressedFields = new HashSet<String>();
/**
@@ -146,16 +145,15 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
}
@Override
public List getAllErrors() {
public List<ObjectError> getAllErrors() {
return Collections.unmodifiableList(this.errors);
}
public List getGlobalErrors() {
List result = new LinkedList();
for (Iterator it = this.errors.iterator(); it.hasNext();) {
Object error = it.next();
if (!(error instanceof FieldError)) {
result.add(error);
public List<ObjectError> getGlobalErrors() {
List<ObjectError> result = new LinkedList<ObjectError>();
for (ObjectError objectError : this.errors) {
if (!(objectError instanceof FieldError)) {
result.add(objectError);
}
}
return Collections.unmodifiableList(result);
@@ -163,8 +161,7 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
@Override
public ObjectError getGlobalError() {
for (Iterator it = this.errors.iterator(); it.hasNext();) {
ObjectError objectError = (ObjectError) it.next();
for (ObjectError objectError : this.errors) {
if (!(objectError instanceof FieldError)) {
return objectError;
}
@@ -172,12 +169,11 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
return null;
}
public List getFieldErrors() {
List result = new LinkedList();
for (Iterator it = this.errors.iterator(); it.hasNext();) {
Object error = it.next();
if (error instanceof FieldError) {
result.add(error);
public List<FieldError> getFieldErrors() {
List<FieldError> result = new LinkedList<FieldError>();
for (ObjectError objectError : this.errors) {
if (objectError instanceof FieldError) {
result.add((FieldError) objectError);
}
}
return Collections.unmodifiableList(result);
@@ -185,23 +181,21 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
@Override
public FieldError getFieldError() {
for (Iterator it = this.errors.iterator(); it.hasNext();) {
Object error = it.next();
if (error instanceof FieldError) {
return (FieldError) error;
for (ObjectError objectError : this.errors) {
if (objectError instanceof FieldError) {
return (FieldError) objectError;
}
}
return null;
}
@Override
public List getFieldErrors(String field) {
List result = new LinkedList();
public List<FieldError> getFieldErrors(String field) {
List<FieldError> result = new LinkedList<FieldError>();
String fixedField = fixedField(field);
for (Iterator it = this.errors.iterator(); it.hasNext();) {
Object error = it.next();
if (error instanceof FieldError && isMatchingFieldError(fixedField, (FieldError) error)) {
result.add(error);
for (ObjectError objectError : this.errors) {
if (objectError instanceof FieldError && isMatchingFieldError(fixedField, (FieldError) objectError)) {
result.add((FieldError) objectError);
}
}
return Collections.unmodifiableList(result);
@@ -210,12 +204,11 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
@Override
public FieldError getFieldError(String field) {
String fixedField = fixedField(field);
for (Iterator it = this.errors.iterator(); it.hasNext();) {
Object error = it.next();
if (error instanceof FieldError) {
FieldError fe = (FieldError) error;
if (isMatchingFieldError(fixedField, fe)) {
return fe;
for (ObjectError objectError : this.errors) {
if (objectError instanceof FieldError) {
FieldError fieldError = (FieldError) objectError;
if (isMatchingFieldError(fixedField, fieldError)) {
return fieldError;
}
}
}
@@ -223,17 +216,12 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
}
public Object getFieldValue(String field) {
FieldError fe = getFieldError(field);
FieldError fieldError = getFieldError(field);
// Use rejected value in case of error, current bean property value else.
Object value = null;
if (fe != null) {
value = fe.getRejectedValue();
}
else {
value = getActualFieldValue(fixedField(field));
}
Object value = (fieldError != null ? fieldError.getRejectedValue() :
getActualFieldValue(fixedField(field)));
// Apply formatting, but not on binding failures like type mismatches.
if (fe == null || !fe.isBindingFailure()) {
if (fieldError == null || !fieldError.isBindingFailure()) {
value = formatFieldValue(field, value);
}
return value;
@@ -277,8 +265,8 @@ public abstract class AbstractBindingResult extends AbstractErrors implements Bi
* @see org.springframework.web.servlet.tags.BindTag
* @see org.springframework.web.servlet.mvc.SimpleFormController
*/
public Map getModel() {
Map model = new HashMap(2);
public Map<String, Object> getModel() {
Map<String, Object> model = new HashMap<String, Object>(2);
// Errors instance, even if no errors.
model.put(MODEL_KEY_PREFIX + getObjectName(), this);
// Mapping from name to target object.

View File

@@ -75,7 +75,7 @@ public interface BindingResult extends Errors {
* @see org.springframework.web.servlet.tags.BindTag
* @see org.springframework.web.servlet.mvc.SimpleFormController
*/
Map getModel();
Map<String, Object> getModel();
/**
* Extract the raw field value for the given field.

View File

@@ -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.
@@ -18,7 +18,6 @@ package org.springframework.validation;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.springframework.util.StringUtils;
@@ -121,19 +120,17 @@ public class DefaultMessageCodesResolver implements MessageCodesResolver, Serial
* @return the list of codes
*/
public String[] resolveMessageCodes(String errorCode, String objectName, String field, Class fieldType) {
List codeList = new ArrayList();
List fieldList = new ArrayList();
List<String> codeList = new ArrayList<String>();
List<String> fieldList = new ArrayList<String>();
buildFieldList(field, fieldList);
for (Iterator it = fieldList.iterator(); it.hasNext();) {
String fieldInList = (String) it.next();
for (String fieldInList : fieldList) {
codeList.add(postProcessMessageCode(errorCode + CODE_SEPARATOR + objectName + CODE_SEPARATOR + fieldInList));
}
int dotIndex = field.lastIndexOf('.');
if (dotIndex != -1) {
buildFieldList(field.substring(dotIndex + 1), fieldList);
}
for (Iterator it = fieldList.iterator(); it.hasNext();) {
String fieldInList = (String) it.next();
for (String fieldInList : fieldList) {
codeList.add(postProcessMessageCode(errorCode + CODE_SEPARATOR + fieldInList));
}
if (fieldType != null) {
@@ -147,7 +144,7 @@ public class DefaultMessageCodesResolver implements MessageCodesResolver, Serial
* Add both keyed and non-keyed entries for the supplied <code>field</code>
* to the supplied field list.
*/
protected void buildFieldList(String field, List fieldList) {
protected void buildFieldList(String field, List<String> fieldList) {
fieldList.add(field);
String plainField = field;
int keyIndex = plainField.lastIndexOf('[');

View File

@@ -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.
@@ -194,7 +194,7 @@ public interface Errors {
* Get all errors, both global and field ones.
* @return List of {@link ObjectError} instances
*/
List getAllErrors();
List<ObjectError> getAllErrors();
/**
* Are there any global errors?
@@ -214,7 +214,7 @@ public interface Errors {
* Get all global errors.
* @return List of ObjectError instances
*/
List getGlobalErrors();
List<ObjectError> getGlobalErrors();
/**
* Get the <i>first</i> global error, if any.
@@ -240,7 +240,7 @@ public interface Errors {
* Get all errors associated with a field.
* @return a List of {@link FieldError} instances
*/
List getFieldErrors();
List<FieldError> getFieldErrors();
/**
* Get the <i>first</i> error associated with a field, if any.
@@ -269,7 +269,7 @@ public interface Errors {
* @param field the field name
* @return a List of {@link FieldError} instances
*/
List getFieldErrors(String field);
List<FieldError> getFieldErrors(String field);
/**
* Get the first error associated with the given field, if any.