Java 5 code style

This commit is contained in:
Juergen Hoeller
2008-11-27 17:35:44 +00:00
parent b0790bf5e7
commit 85661c6882
49 changed files with 353 additions and 477 deletions

View File

@@ -72,7 +72,7 @@ public abstract class GenericPortletBean extends GenericPortlet {
* Set of required properties (Strings) that must be supplied as
* config parameters to this portlet.
*/
private final Set requiredProperties = new HashSet();
private final Set<String> requiredProperties = new HashSet<String>();
/**
@@ -174,11 +174,11 @@ public abstract class GenericPortletBean extends GenericPortlet {
* we can't accept default values
* @throws PortletException if any required properties are missing
*/
private PortletConfigPropertyValues(PortletConfig config, Set requiredProperties)
private PortletConfigPropertyValues(PortletConfig config, Set<String> requiredProperties)
throws PortletException {
Set missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ?
new HashSet(requiredProperties) : null;
Set<String> missingProps = (requiredProperties != null && !requiredProperties.isEmpty()) ?
new HashSet<String>(requiredProperties) : null;
Enumeration en = config.getInitParameterNames();
while (en.hasMoreElements()) {

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,6 +17,7 @@
package org.springframework.web.portlet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.util.CollectionUtils;
@@ -36,7 +37,7 @@ public class HandlerExecutionChain {
private HandlerInterceptor[] interceptors;
private List interceptorList;
private List<HandlerInterceptor> interceptorList;
/**
@@ -57,7 +58,7 @@ public class HandlerExecutionChain {
if (handler instanceof HandlerExecutionChain) {
HandlerExecutionChain originalChain = (HandlerExecutionChain) handler;
this.handler = originalChain.getHandler();
this.interceptorList = new ArrayList();
this.interceptorList = new ArrayList<HandlerInterceptor>();
CollectionUtils.mergeArrayIntoCollection(originalChain.getInterceptors(), this.interceptorList);
CollectionUtils.mergeArrayIntoCollection(interceptors, this.interceptorList);
}
@@ -84,20 +85,16 @@ public class HandlerExecutionChain {
public void addInterceptors(HandlerInterceptor[] interceptors) {
if (interceptors != null) {
initInterceptorList();
for (int i = 0; i < interceptors.length; i++) {
this.interceptorList.add(interceptors[i]);
}
this.interceptorList.addAll(Arrays.asList(interceptors));
}
}
private void initInterceptorList() {
if (this.interceptorList == null) {
this.interceptorList = new ArrayList();
this.interceptorList = new ArrayList<HandlerInterceptor>();
}
if (this.interceptors != null) {
for (int i = 0; i < this.interceptors.length; i++) {
this.interceptorList.add(this.interceptors[i]);
}
this.interceptorList.addAll(Arrays.asList(this.interceptors));
this.interceptors = null;
}
}
@@ -108,10 +105,18 @@ public class HandlerExecutionChain {
*/
public HandlerInterceptor[] getInterceptors() {
if (this.interceptors == null && this.interceptorList != null) {
this.interceptors = (HandlerInterceptor[])
this.interceptorList.toArray(new HandlerInterceptor[this.interceptorList.size()]);
this.interceptors = this.interceptorList.toArray(new HandlerInterceptor[this.interceptorList.size()]);
}
return this.interceptors;
}
/**
* Delegates to the handler's <code>toString()</code>.
*/
@Override
public String toString() {
return String.valueOf(this.handler);
}
}

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.
@@ -49,7 +49,7 @@ public abstract class AbstractHandlerMapping extends ApplicationObjectSupport
private Object defaultHandler;
private final List interceptors = new ArrayList();
private final List<Object> interceptors = new ArrayList<Object>();
private boolean applyWebRequestInterceptorsToRenderPhaseOnly = true;