Java 5 code style
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@342 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
parent
a0dfb69aaa
commit
e4ce547934
|
|
@ -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,6 +16,7 @@
|
|||
|
||||
package org.springframework.aop.aspectj;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -30,7 +31,6 @@ import org.aspectj.weaver.tools.PointcutParser;
|
|||
import org.aspectj.weaver.tools.PointcutPrimitive;
|
||||
|
||||
import org.springframework.core.ParameterNameDiscoverer;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
|
@ -118,8 +118,6 @@ import org.springframework.util.StringUtils;
|
|||
*/
|
||||
public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscoverer {
|
||||
|
||||
private static final String ANNOTATION_CLASS_NAME = "java.lang.annotation.Annotation";
|
||||
|
||||
private static final String THIS_JOIN_POINT = "thisJoinPoint";
|
||||
private static final String THIS_JOIN_POINT_STATIC_PART = "thisJoinPointStaticPart";
|
||||
|
||||
|
|
@ -133,10 +131,8 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
private static final int STEP_REFERENCE_PCUT_BINDING = 7;
|
||||
private static final int STEP_FINISHED = 8;
|
||||
|
||||
private static final Set singleValuedAnnotationPcds = new HashSet();
|
||||
private static final Set nonReferencePointcutTokens = new HashSet();
|
||||
|
||||
private static Class annotationClass;
|
||||
private static final Set<String> singleValuedAnnotationPcds = new HashSet<String>();
|
||||
private static final Set<String> nonReferencePointcutTokens = new HashSet<String>();
|
||||
|
||||
|
||||
static {
|
||||
|
|
@ -157,15 +153,6 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
nonReferencePointcutTokens.add("and");
|
||||
nonReferencePointcutTokens.add("or");
|
||||
nonReferencePointcutTokens.add("not");
|
||||
|
||||
try {
|
||||
annotationClass = ClassUtils.forName(ANNOTATION_CLASS_NAME,
|
||||
AspectJAdviceParameterNameDiscoverer.class.getClassLoader());
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
// Running on < JDK 1.5, this is OK...
|
||||
annotationClass = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -192,8 +179,6 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
|
||||
private int numberOfRemainingUnboundArguments;
|
||||
|
||||
private int algorithmicStep = STEP_JOIN_POINT_BINDING;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new discoverer that attempts to discover parameter names
|
||||
|
|
@ -241,7 +226,6 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
this.argumentTypes = method.getParameterTypes();
|
||||
this.numberOfRemainingUnboundArguments = this.argumentTypes.length;
|
||||
this.parameterNameBindings = new String[this.numberOfRemainingUnboundArguments];
|
||||
this.algorithmicStep = STEP_JOIN_POINT_BINDING;
|
||||
|
||||
int minimumNumberUnboundArgs = 0;
|
||||
if (this.returningName != null) {
|
||||
|
|
@ -256,8 +240,9 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
}
|
||||
|
||||
try {
|
||||
while ((this.numberOfRemainingUnboundArguments > 0) && (this.algorithmicStep < STEP_FINISHED)) {
|
||||
switch (this.algorithmicStep++) {
|
||||
int algorithmicStep = STEP_JOIN_POINT_BINDING;
|
||||
while ((this.numberOfRemainingUnboundArguments > 0) && algorithmicStep < STEP_FINISHED) {
|
||||
switch (algorithmicStep++) {
|
||||
case STEP_JOIN_POINT_BINDING:
|
||||
if (!maybeBindThisJoinPoint()) {
|
||||
maybeBindThisJoinPointStaticPart();
|
||||
|
|
@ -282,7 +267,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
maybeBindReferencePointcutParameter();
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unknown algorithmic step: " + (this.algorithmicStep - 1));
|
||||
throw new IllegalStateException("Unknown algorithmic step: " + (algorithmicStep - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -429,7 +414,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
* <p>Some more support from AspectJ in doing this exercise would be nice... :)
|
||||
*/
|
||||
private void maybeBindAnnotationsFromPointcutExpression() {
|
||||
List varNames = new ArrayList();
|
||||
List<String> varNames = new ArrayList<String>();
|
||||
String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
String toMatch = tokens[i];
|
||||
|
|
@ -458,7 +443,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
/**
|
||||
* Match the given list of extracted variable names to argument slots.
|
||||
*/
|
||||
private void bindAnnotationsFromVarNames(List varNames) {
|
||||
private void bindAnnotationsFromVarNames(List<String> varNames) {
|
||||
if (!varNames.isEmpty()) {
|
||||
// we have work to do...
|
||||
int numAnnotationSlots = countNumberOfUnboundAnnotationArguments();
|
||||
|
|
@ -470,7 +455,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
else if (numAnnotationSlots == 1) {
|
||||
if (varNames.size() == 1) {
|
||||
// it's a match
|
||||
findAndBind(annotationClass, (String) varNames.get(0));
|
||||
findAndBind(Annotation.class, varNames.get(0));
|
||||
}
|
||||
else {
|
||||
// multiple candidate vars, but only one slot
|
||||
|
|
@ -495,8 +480,8 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
if (Character.isJavaIdentifierStart(candidateToken.charAt(0)) &&
|
||||
Character.isLowerCase(candidateToken.charAt(0))) {
|
||||
char[] tokenChars = candidateToken.toCharArray();
|
||||
for (int i = 0; i < tokenChars.length; i++) {
|
||||
if (!Character.isJavaIdentifierPart(tokenChars[i])) {
|
||||
for (char tokenChar : tokenChars) {
|
||||
if (!Character.isJavaIdentifierPart(tokenChar)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -511,11 +496,10 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
* Given an args pointcut body (could be <code>args</code> or <code>at_args</code>),
|
||||
* add any candidate variable names to the given list.
|
||||
*/
|
||||
private void maybeExtractVariableNamesFromArgs(String argsSpec, List varNames) {
|
||||
private void maybeExtractVariableNamesFromArgs(String argsSpec, List<String> varNames) {
|
||||
if (argsSpec == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String[] tokens = StringUtils.tokenizeToStringArray(argsSpec, ",");
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
tokens[i] = StringUtils.trimWhitespace(tokens[i]);
|
||||
|
|
@ -536,7 +520,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
+ " unbound args at this(),target(),args() binding stage, with no way to determine between them");
|
||||
}
|
||||
|
||||
List varNames = new ArrayList();
|
||||
List<String> varNames = new ArrayList<String>();
|
||||
String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
if (tokens[i].equals("this") ||
|
||||
|
|
@ -553,12 +537,11 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
else if (tokens[i].equals("args") || tokens[i].startsWith("args(")) {
|
||||
PointcutBody body = getPointcutBody(tokens, i);
|
||||
i += body.numTokensConsumed;
|
||||
List candidateVarNames = new ArrayList();
|
||||
List<String> candidateVarNames = new ArrayList<String>();
|
||||
maybeExtractVariableNamesFromArgs(body.text, candidateVarNames);
|
||||
// we may have found some var names that were bound in previous primitive args binding step,
|
||||
// filter them out...
|
||||
for (Iterator iter = candidateVarNames.iterator(); iter.hasNext();) {
|
||||
String varName = (String) iter.next();
|
||||
for (String varName : candidateVarNames) {
|
||||
if (!alreadyBound(varName)) {
|
||||
varNames.add(varName);
|
||||
}
|
||||
|
|
@ -574,7 +557,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
else if (varNames.size() == 1) {
|
||||
for (int j = 0; j < this.parameterNameBindings.length; j++) {
|
||||
if (isUnbound(j)) {
|
||||
bindParameterName(j, (String) varNames.get(0));
|
||||
bindParameterName(j, varNames.get(0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -588,7 +571,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
+ " unbound args at reference pointcut binding stage, with no way to determine between them");
|
||||
}
|
||||
|
||||
List varNames = new ArrayList();
|
||||
List<String> varNames = new ArrayList<String>();
|
||||
String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
String toMatch = tokens[i];
|
||||
|
|
@ -634,7 +617,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
else if (varNames.size() == 1) {
|
||||
for (int j = 0; j < this.parameterNameBindings.length; j++) {
|
||||
if (isUnbound(j)) {
|
||||
bindParameterName(j, (String) varNames.get(0));
|
||||
bindParameterName(j, varNames.get(0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -700,7 +683,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
}
|
||||
if (numUnboundPrimitives == 1) {
|
||||
// Look for arg variable and bind it if we find exactly one...
|
||||
List varNames = new ArrayList();
|
||||
List<String> varNames = new ArrayList<String>();
|
||||
String[] tokens = StringUtils.tokenizeToStringArray(this.pointcutExpression, " ");
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
if (tokens[i].equals("args") || tokens[i].startsWith("args(")) {
|
||||
|
|
@ -751,14 +734,9 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
|
|||
}
|
||||
|
||||
private int countNumberOfUnboundAnnotationArguments() {
|
||||
if (annotationClass == null) {
|
||||
// We're running on a JDK < 1.5
|
||||
return 0;
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < this.argumentTypes.length; i++) {
|
||||
if (isUnbound(i) && isSubtypeOf(annotationClass, i)) {
|
||||
if (isUnbound(i) && isSubtypeOf(Annotation.class, i)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -19,15 +19,14 @@ package org.springframework.aop.config;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator;
|
||||
import org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator;
|
||||
import org.springframework.aop.framework.autoproxy.InfrastructureAdvisorAutoProxyCreator;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.beans.factory.support.RootBeanDefinition;
|
||||
import org.springframework.core.JdkVersion;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Utility class for handling registration of AOP auto-proxy creators.
|
||||
|
|
@ -52,26 +51,18 @@ public abstract class AopConfigUtils {
|
|||
public static final String AUTO_PROXY_CREATOR_BEAN_NAME =
|
||||
"org.springframework.aop.config.internalAutoProxyCreator";
|
||||
|
||||
/**
|
||||
* The class name of the <code>AnnotationAwareAspectJAutoProxyCreator</code> class.
|
||||
* Only available with AspectJ and Java 5.
|
||||
*/
|
||||
private static final String ASPECTJ_ANNOTATION_AUTO_PROXY_CREATOR_CLASS_NAME =
|
||||
"org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator";
|
||||
|
||||
|
||||
/**
|
||||
* Stores the auto proxy creator classes in escalation order.
|
||||
*/
|
||||
private static final List APC_PRIORITY_LIST = new ArrayList();
|
||||
private static final List<Class> APC_PRIORITY_LIST = new ArrayList<Class>();
|
||||
|
||||
/**
|
||||
* Setup the escalation list.
|
||||
*/
|
||||
static {
|
||||
APC_PRIORITY_LIST.add(InfrastructureAdvisorAutoProxyCreator.class.getName());
|
||||
APC_PRIORITY_LIST.add(AspectJAwareAdvisorAutoProxyCreator.class.getName());
|
||||
APC_PRIORITY_LIST.add(ASPECTJ_ANNOTATION_AUTO_PROXY_CREATOR_CLASS_NAME);
|
||||
APC_PRIORITY_LIST.add(InfrastructureAdvisorAutoProxyCreator.class);
|
||||
APC_PRIORITY_LIST.add(AspectJAwareAdvisorAutoProxyCreator.class);
|
||||
APC_PRIORITY_LIST.add(AnnotationAwareAspectJAutoProxyCreator.class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -96,8 +87,7 @@ public abstract class AopConfigUtils {
|
|||
}
|
||||
|
||||
public static BeanDefinition registerAspectJAnnotationAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry, Object source) {
|
||||
Class cls = getAspectJAnnotationAutoProxyCreatorClassIfPossible();
|
||||
return registerOrEscalateApcAsRequired(cls, registry, source);
|
||||
return registerOrEscalateApcAsRequired(AnnotationAwareAspectJAutoProxyCreator.class, registry, source);
|
||||
}
|
||||
|
||||
public static void forceAutoProxyCreatorToUseClassProxying(BeanDefinitionRegistry registry) {
|
||||
|
|
@ -114,7 +104,7 @@ public abstract class AopConfigUtils {
|
|||
BeanDefinition apcDefinition = registry.getBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME);
|
||||
if (!cls.getName().equals(apcDefinition.getBeanClassName())) {
|
||||
int currentPriority = findPriorityForClass(apcDefinition.getBeanClassName());
|
||||
int requiredPriority = findPriorityForClass(cls.getName());
|
||||
int requiredPriority = findPriorityForClass(cls);
|
||||
if (currentPriority < requiredPriority) {
|
||||
apcDefinition.setBeanClassName(cls.getName());
|
||||
}
|
||||
|
|
@ -123,32 +113,20 @@ public abstract class AopConfigUtils {
|
|||
}
|
||||
RootBeanDefinition beanDefinition = new RootBeanDefinition(cls);
|
||||
beanDefinition.setSource(source);
|
||||
beanDefinition.getPropertyValues().addPropertyValue("order", new Integer(Ordered.HIGHEST_PRECEDENCE));
|
||||
beanDefinition.getPropertyValues().addPropertyValue("order", Ordered.HIGHEST_PRECEDENCE);
|
||||
beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
registry.registerBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME, beanDefinition);
|
||||
return beanDefinition;
|
||||
}
|
||||
|
||||
private static Class getAspectJAnnotationAutoProxyCreatorClassIfPossible() {
|
||||
if (JdkVersion.getMajorJavaVersion() < JdkVersion.JAVA_15) {
|
||||
throw new IllegalStateException(
|
||||
"AnnotationAwareAspectJAutoProxyCreator is only available on Java 1.5 and higher");
|
||||
}
|
||||
try {
|
||||
return ClassUtils.forName(
|
||||
ASPECTJ_ANNOTATION_AUTO_PROXY_CREATOR_CLASS_NAME, AopConfigUtils.class.getClassLoader());
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
throw new IllegalStateException("Unable to load Java 1.5 dependent class [" +
|
||||
ASPECTJ_ANNOTATION_AUTO_PROXY_CREATOR_CLASS_NAME + "]", ex);
|
||||
}
|
||||
private static int findPriorityForClass(Class clazz) {
|
||||
return APC_PRIORITY_LIST.indexOf(clazz);
|
||||
}
|
||||
|
||||
private static int findPriorityForClass(String className) {
|
||||
Assert.notNull(className, "Class name must not be null");
|
||||
for (int i = 0; i < APC_PRIORITY_LIST.size(); i++) {
|
||||
String str = (String) APC_PRIORITY_LIST.get(i);
|
||||
if (className.equals(str)) {
|
||||
Class clazz = APC_PRIORITY_LIST.get(i);
|
||||
if (clazz.getName().equals(className)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,68 +61,37 @@ import org.springframework.util.xml.DomUtils;
|
|||
class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
||||
|
||||
private static final String ASPECT = "aspect";
|
||||
|
||||
private static final String EXPRESSION = "expression";
|
||||
|
||||
private static final String ID = "id";
|
||||
|
||||
private static final String POINTCUT = "pointcut";
|
||||
|
||||
private static final String ADVICE_BEAN_NAME = "adviceBeanName";
|
||||
|
||||
private static final String ADVISOR = "advisor";
|
||||
|
||||
private static final String ADVICE_REF = "advice-ref";
|
||||
|
||||
private static final String POINTCUT_REF = "pointcut-ref";
|
||||
|
||||
private static final String REF = "ref";
|
||||
|
||||
private static final String BEFORE = "before";
|
||||
|
||||
private static final String DECLARE_PARENTS = "declare-parents";
|
||||
|
||||
private static final String TYPE_PATTERN = "types-matching";
|
||||
|
||||
private static final String DEFAULT_IMPL = "default-impl";
|
||||
|
||||
private static final String DELEGATE_REF = "delegate-ref";
|
||||
|
||||
private static final String IMPLEMENT_INTERFACE = "implement-interface";
|
||||
|
||||
private static final String AFTER = "after";
|
||||
|
||||
private static final String AFTER_RETURNING_ELEMENT = "after-returning";
|
||||
|
||||
private static final String AFTER_THROWING_ELEMENT = "after-throwing";
|
||||
|
||||
private static final String AROUND = "around";
|
||||
|
||||
private static final String RETURNING = "returning";
|
||||
|
||||
private static final String RETURNING_PROPERTY = "returningName";
|
||||
|
||||
private static final String THROWING = "throwing";
|
||||
|
||||
private static final String THROWING_PROPERTY = "throwingName";
|
||||
|
||||
private static final String ARG_NAMES = "arg-names";
|
||||
|
||||
private static final String ARG_NAMES_PROPERTY = "argumentNames";
|
||||
|
||||
private static final String ASPECT_NAME_PROPERTY = "aspectName";
|
||||
|
||||
private static final String DECLARATION_ORDER_PROPERTY = "declarationOrder";
|
||||
|
||||
private static final String ORDER_PROPERTY = "order";
|
||||
|
||||
private static final int METHOD_INDEX = 0;
|
||||
|
||||
private static final int POINTCUT_INDEX = 1;
|
||||
|
||||
private static final int ASPECT_INSTANCE_FACTORY_INDEX = 2;
|
||||
|
||||
|
||||
private ParseState parseState = new ParseState();
|
||||
|
||||
|
||||
|
|
@ -232,12 +201,12 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
|
||||
try {
|
||||
this.parseState.push(new AspectEntry(aspectId, aspectName));
|
||||
List beanDefinitions = new ArrayList();
|
||||
List beanReferences = new ArrayList();
|
||||
List<BeanDefinition> beanDefinitions = new ArrayList<BeanDefinition>();
|
||||
List<BeanReference> beanReferences = new ArrayList<BeanReference>();
|
||||
|
||||
List declareParents = DomUtils.getChildElementsByTagName(aspectElement, DECLARE_PARENTS);
|
||||
List<Element> declareParents = DomUtils.getChildElementsByTagName(aspectElement, DECLARE_PARENTS);
|
||||
for (int i = METHOD_INDEX; i < declareParents.size(); i++) {
|
||||
Element declareParentsElement = (Element) declareParents.get(i);
|
||||
Element declareParentsElement = declareParents.get(i);
|
||||
beanDefinitions.add(parseDeclareParents(declareParentsElement, parserContext));
|
||||
}
|
||||
|
||||
|
|
@ -268,9 +237,8 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
aspectElement, aspectId, beanDefinitions, beanReferences, parserContext);
|
||||
parserContext.pushContainingComponent(aspectComponentDefinition);
|
||||
|
||||
List pointcuts = DomUtils.getChildElementsByTagName(aspectElement, POINTCUT);
|
||||
for (int i = 0; i < pointcuts.size(); i++) {
|
||||
Element pointcutElement = (Element) pointcuts.get(i);
|
||||
List<Element> pointcuts = DomUtils.getChildElementsByTagName(aspectElement, POINTCUT);
|
||||
for (Element pointcutElement : pointcuts) {
|
||||
parsePointcut(pointcutElement, parserContext);
|
||||
}
|
||||
|
||||
|
|
@ -282,10 +250,11 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
}
|
||||
|
||||
private AspectComponentDefinition createAspectComponentDefinition(
|
||||
Element aspectElement, String aspectId, List beanDefs, List beanRefs, ParserContext parserContext) {
|
||||
Element aspectElement, String aspectId, List<BeanDefinition> beanDefs,
|
||||
List<BeanReference> beanRefs, ParserContext parserContext) {
|
||||
|
||||
BeanDefinition[] beanDefArray = (BeanDefinition[]) beanDefs.toArray(new BeanDefinition[beanDefs.size()]);
|
||||
BeanReference[] beanRefArray = (BeanReference[]) beanRefs.toArray(new BeanReference[beanRefs.size()]);
|
||||
BeanDefinition[] beanDefArray = beanDefs.toArray(new BeanDefinition[beanDefs.size()]);
|
||||
BeanReference[] beanRefArray = beanRefs.toArray(new BeanReference[beanRefs.size()]);
|
||||
Object source = parserContext.extractSource(aspectElement);
|
||||
return new AspectComponentDefinition(aspectId, beanDefArray, beanRefArray, source);
|
||||
}
|
||||
|
|
@ -345,7 +314,7 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
*/
|
||||
private AbstractBeanDefinition parseAdvice(
|
||||
String aspectName, int order, Element aspectElement, Element adviceElement, ParserContext parserContext,
|
||||
List beanDefinitions, List beanReferences) {
|
||||
List<BeanDefinition> beanDefinitions, List<BeanReference> beanReferences) {
|
||||
|
||||
try {
|
||||
this.parseState.push(new AdviceEntry(adviceElement.getLocalName()));
|
||||
|
|
@ -394,15 +363,14 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
*/
|
||||
private AbstractBeanDefinition createAdviceDefinition(
|
||||
Element adviceElement, ParserContext parserContext, String aspectName, int order,
|
||||
RootBeanDefinition methodDef, RootBeanDefinition aspectFactoryDef, List beanDefinitions, List beanReferences) {
|
||||
RootBeanDefinition methodDef, RootBeanDefinition aspectFactoryDef,
|
||||
List<BeanDefinition> beanDefinitions, List<BeanReference> beanReferences) {
|
||||
|
||||
RootBeanDefinition adviceDefinition = new RootBeanDefinition(getAdviceClass(adviceElement));
|
||||
adviceDefinition.setSource(parserContext.extractSource(adviceElement));
|
||||
|
||||
adviceDefinition.getPropertyValues().addPropertyValue(
|
||||
ASPECT_NAME_PROPERTY, aspectName);
|
||||
adviceDefinition.getPropertyValues().addPropertyValue(
|
||||
DECLARATION_ORDER_PROPERTY, new Integer(order));
|
||||
adviceDefinition.getPropertyValues().addPropertyValue(ASPECT_NAME_PROPERTY, aspectName);
|
||||
adviceDefinition.getPropertyValues().addPropertyValue(DECLARATION_ORDER_PROPERTY, order);
|
||||
|
||||
if (adviceElement.hasAttribute(RETURNING)) {
|
||||
adviceDefinition.getPropertyValues().addPropertyValue(
|
||||
|
|
@ -423,7 +391,7 @@ class ConfigBeanDefinitionParser implements BeanDefinitionParser {
|
|||
Object pointcut = parsePointcutProperty(adviceElement, parserContext);
|
||||
if (pointcut instanceof BeanDefinition) {
|
||||
cav.addIndexedArgumentValue(POINTCUT_INDEX, pointcut);
|
||||
beanDefinitions.add(pointcut);
|
||||
beanDefinitions.add((BeanDefinition) pointcut);
|
||||
}
|
||||
else if (pointcut instanceof String) {
|
||||
RuntimeBeanReference pointcutRef = new RuntimeBeanReference((String) pointcut);
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -31,11 +31,9 @@ import org.springframework.util.Assert;
|
|||
*/
|
||||
public class ProxyCreatorSupport extends AdvisedSupport {
|
||||
|
||||
/** The AopProxyFactory to use */
|
||||
private AopProxyFactory aopProxyFactory;
|
||||
|
||||
/** List of AdvisedSupportListener */
|
||||
private List listeners = new LinkedList();
|
||||
private List<AdvisedSupportListener> listeners = new LinkedList<AdvisedSupportListener>();
|
||||
|
||||
/** Set to true when the first AOP proxy has been created */
|
||||
private boolean active = false;
|
||||
|
|
@ -112,8 +110,8 @@ public class ProxyCreatorSupport extends AdvisedSupport {
|
|||
*/
|
||||
private void activate() {
|
||||
this.active = true;
|
||||
for (int i = 0; i < this.listeners.size(); i++) {
|
||||
((AdvisedSupportListener) this.listeners.get(i)).activated(this);
|
||||
for (AdvisedSupportListener listener : this.listeners) {
|
||||
listener.activated(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -126,8 +124,8 @@ public class ProxyCreatorSupport extends AdvisedSupport {
|
|||
super.adviceChanged();
|
||||
synchronized (this) {
|
||||
if (this.active) {
|
||||
for (int i = 0; i < this.listeners.size(); i++) {
|
||||
((AdvisedSupportListener) this.listeners.get(i)).adviceChanged(this);
|
||||
for (AdvisedSupportListener listener : this.listeners) {
|
||||
listener.adviceChanged(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -39,7 +39,7 @@ import org.springframework.aop.support.DefaultPointcutAdvisor;
|
|||
*/
|
||||
public class DefaultAdvisorAdapterRegistry implements AdvisorAdapterRegistry, Serializable {
|
||||
|
||||
private final List adapters = new ArrayList(3);
|
||||
private final List<AdvisorAdapter> adapters = new ArrayList<AdvisorAdapter>(3);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -64,9 +64,8 @@ public class DefaultAdvisorAdapterRegistry implements AdvisorAdapterRegistry, Se
|
|||
// So well-known it doesn't even need an adapter.
|
||||
return new DefaultPointcutAdvisor(advice);
|
||||
}
|
||||
for (int i = 0; i < this.adapters.size(); i++) {
|
||||
for (AdvisorAdapter adapter : this.adapters) {
|
||||
// Check that it is supported.
|
||||
AdvisorAdapter adapter = (AdvisorAdapter) this.adapters.get(i);
|
||||
if (adapter.supportsAdvice(advice)) {
|
||||
return new DefaultPointcutAdvisor(advice);
|
||||
}
|
||||
|
|
@ -75,13 +74,12 @@ public class DefaultAdvisorAdapterRegistry implements AdvisorAdapterRegistry, Se
|
|||
}
|
||||
|
||||
public MethodInterceptor[] getInterceptors(Advisor advisor) throws UnknownAdviceTypeException {
|
||||
List interceptors = new ArrayList(3);
|
||||
List<MethodInterceptor> interceptors = new ArrayList<MethodInterceptor>(3);
|
||||
Advice advice = advisor.getAdvice();
|
||||
if (advice instanceof MethodInterceptor) {
|
||||
interceptors.add(advice);
|
||||
interceptors.add((MethodInterceptor) advice);
|
||||
}
|
||||
for (int i = 0; i < this.adapters.size(); i++) {
|
||||
AdvisorAdapter adapter = (AdvisorAdapter) this.adapters.get(i);
|
||||
for (AdvisorAdapter adapter : this.adapters) {
|
||||
if (adapter.supportsAdvice(advice)) {
|
||||
interceptors.add(adapter.getInterceptor(advisor));
|
||||
}
|
||||
|
|
@ -89,7 +87,7 @@ public class DefaultAdvisorAdapterRegistry implements AdvisorAdapterRegistry, Se
|
|||
if (interceptors.isEmpty()) {
|
||||
throw new UnknownAdviceTypeException(advisor.getAdvice());
|
||||
}
|
||||
return (MethodInterceptor[]) interceptors.toArray(new MethodInterceptor[interceptors.size()]);
|
||||
return interceptors.toArray(new MethodInterceptor[interceptors.size()]);
|
||||
}
|
||||
|
||||
public void registerAdvisorAdapter(AdvisorAdapter adapter) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class BeanFactoryAdvisorRetrievalHelper {
|
|||
* @return the list of {@link org.springframework.aop.Advisor} beans
|
||||
* @see #isEligibleBean
|
||||
*/
|
||||
public List findAdvisorBeans() {
|
||||
public List<Advisor> findAdvisorBeans() {
|
||||
// Determine list of advisor bean names, if not cached already.
|
||||
String[] advisorNames = null;
|
||||
synchronized (this) {
|
||||
|
|
@ -76,7 +76,7 @@ public class BeanFactoryAdvisorRetrievalHelper {
|
|||
}
|
||||
}
|
||||
if (advisorNames.length == 0) {
|
||||
return new LinkedList();
|
||||
return new LinkedList<Advisor>();
|
||||
}
|
||||
|
||||
List<Advisor> advisors = new LinkedList<Advisor>();
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -20,6 +20,7 @@ import java.io.Serializable;
|
|||
import java.lang.reflect.Method;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.PatternMatchUtils;
|
||||
|
|
@ -36,7 +37,7 @@ import org.springframework.util.PatternMatchUtils;
|
|||
*/
|
||||
public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut implements Serializable {
|
||||
|
||||
private List mappedNames = new LinkedList();
|
||||
private List<String> mappedNames = new LinkedList<String>();
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -54,11 +55,9 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
|
|||
* the pointcut matches.
|
||||
*/
|
||||
public void setMappedNames(String[] mappedNames) {
|
||||
this.mappedNames = new LinkedList();
|
||||
this.mappedNames = new LinkedList<String>();
|
||||
if (mappedNames != null) {
|
||||
for (int i = 0; i < mappedNames.length; i++) {
|
||||
this.mappedNames.add(mappedNames[i]);
|
||||
}
|
||||
this.mappedNames.addAll(Arrays.asList(mappedNames));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -72,16 +71,13 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
|
|||
* @return this pointcut to allow for multiple additions in one line
|
||||
*/
|
||||
public NameMatchMethodPointcut addMethodName(String name) {
|
||||
// TODO in a future release, consider a way of letting proxies
|
||||
// cause advice changed events.
|
||||
this.mappedNames.add(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public boolean matches(Method method, Class targetClass) {
|
||||
for (int i = 0; i < this.mappedNames.size(); i++) {
|
||||
String mappedName = (String) this.mappedNames.get(i);
|
||||
for (String mappedName : this.mappedNames) {
|
||||
if (mappedName.equals(method.getName()) || isMatch(method.getName(), mappedName)) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -105,11 +101,8 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
|
|||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
return (other instanceof NameMatchMethodPointcut &&
|
||||
ObjectUtils.nullSafeEquals(this.mappedNames, ((NameMatchMethodPointcut) other).mappedNames));
|
||||
return (this == other || (other instanceof NameMatchMethodPointcut &&
|
||||
ObjectUtils.nullSafeEquals(this.mappedNames, ((NameMatchMethodPointcut) other).mappedNames)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -38,10 +38,7 @@ 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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -80,15 +80,15 @@ public class FreeMarkerConfigurationFactory {
|
|||
|
||||
private Properties freemarkerSettings;
|
||||
|
||||
private Map freemarkerVariables;
|
||||
private Map<String, Object> freemarkerVariables;
|
||||
|
||||
private String defaultEncoding;
|
||||
|
||||
private final List templateLoaders = new ArrayList();
|
||||
private final List<TemplateLoader> templateLoaders = new ArrayList<TemplateLoader>();
|
||||
|
||||
private List preTemplateLoaders;
|
||||
private List<TemplateLoader> preTemplateLoaders;
|
||||
|
||||
private List postTemplateLoaders;
|
||||
private List<TemplateLoader> postTemplateLoaders;
|
||||
|
||||
private String[] templateLoaderPaths;
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ public class FreeMarkerConfigurationFactory {
|
|||
* to FreeMarker's <code>Configuration.setAllSharedVariables()</code> method.
|
||||
* @see freemarker.template.Configuration#setAllSharedVariables
|
||||
*/
|
||||
public void setFreemarkerVariables(Map variables) {
|
||||
public void setFreemarkerVariables(Map<String, Object> variables) {
|
||||
this.freemarkerVariables = variables;
|
||||
}
|
||||
|
||||
|
|
@ -300,8 +300,8 @@ public class FreeMarkerConfigurationFactory {
|
|||
|
||||
// Register default template loaders.
|
||||
if (this.templateLoaderPaths != null) {
|
||||
for (int i = 0; i < this.templateLoaderPaths.length; i++) {
|
||||
this.templateLoaders.add(getTemplateLoaderForPath(this.templateLoaderPaths[i]));
|
||||
for (String path : this.templateLoaderPaths) {
|
||||
this.templateLoaders.add(getTemplateLoaderForPath(path));
|
||||
}
|
||||
}
|
||||
postProcessTemplateLoaders(this.templateLoaders);
|
||||
|
|
@ -393,16 +393,16 @@ public class FreeMarkerConfigurationFactory {
|
|||
* @param templateLoaders the final List of TemplateLoader instances
|
||||
* @return the aggregate TemplateLoader
|
||||
*/
|
||||
protected TemplateLoader getAggregateTemplateLoader(List templateLoaders) {
|
||||
protected TemplateLoader getAggregateTemplateLoader(List<TemplateLoader> templateLoaders) {
|
||||
int loaderCount = templateLoaders.size();
|
||||
switch (loaderCount) {
|
||||
case 0:
|
||||
logger.info("No FreeMarker TemplateLoaders specified");
|
||||
return null;
|
||||
case 1:
|
||||
return (TemplateLoader) templateLoaders.get(0);
|
||||
return templateLoaders.get(0);
|
||||
default:
|
||||
TemplateLoader[] loaders = (TemplateLoader[]) templateLoaders.toArray(new TemplateLoader[loaderCount]);
|
||||
TemplateLoader[] loaders = templateLoaders.toArray(new TemplateLoader[loaderCount]);
|
||||
return new MultiTemplateLoader(loaders);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
|
|||
if (codes == null) {
|
||||
codes = new String[0];
|
||||
}
|
||||
for (int i = 0; i < codes.length; i++) {
|
||||
String msg = getMessageInternal(codes[i], resolvable.getArguments(), locale);
|
||||
for (String code : codes) {
|
||||
String msg = getMessageInternal(code, resolvable.getArguments(), locale);
|
||||
if (msg != null) {
|
||||
return msg;
|
||||
}
|
||||
|
|
@ -291,13 +291,13 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
|
|||
if (args == null) {
|
||||
return new Object[0];
|
||||
}
|
||||
List resolvedArgs = new ArrayList(args.length);
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (args[i] instanceof MessageSourceResolvable) {
|
||||
resolvedArgs.add(getMessage((MessageSourceResolvable) args[i], locale));
|
||||
List<Object> resolvedArgs = new ArrayList<Object>(args.length);
|
||||
for (Object arg : args) {
|
||||
if (arg instanceof MessageSourceResolvable) {
|
||||
resolvedArgs.add(getMessage((MessageSourceResolvable) arg, locale));
|
||||
}
|
||||
else {
|
||||
resolvedArgs.add(args[i]);
|
||||
resolvedArgs.add(arg);
|
||||
}
|
||||
}
|
||||
return resolvedArgs.toArray(new Object[resolvedArgs.size()]);
|
||||
|
|
|
|||
|
|
@ -16,10 +16,9 @@
|
|||
|
||||
package org.springframework.jmx.support;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.management.MalformedObjectNameException;
|
||||
import javax.management.NotificationFilter;
|
||||
import javax.management.NotificationListener;
|
||||
|
|
@ -46,7 +45,7 @@ public class NotificationListenerHolder {
|
|||
|
||||
private Object handback;
|
||||
|
||||
protected Set mappedObjectNames;
|
||||
protected Set<Object> mappedObjectNames;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -122,15 +121,8 @@ public class NotificationListenerHolder {
|
|||
* @see #setMappedObjectName
|
||||
*/
|
||||
public void setMappedObjectNames(Object[] mappedObjectNames) {
|
||||
if (mappedObjectNames != null) {
|
||||
this.mappedObjectNames = new LinkedHashSet(mappedObjectNames.length);
|
||||
for (int i = 0; i < mappedObjectNames.length; i++) {
|
||||
this.mappedObjectNames.add(mappedObjectNames[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.mappedObjectNames = null;
|
||||
}
|
||||
this.mappedObjectNames = (mappedObjectNames != null ?
|
||||
new LinkedHashSet<Object>(Arrays.asList(mappedObjectNames)) : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -145,8 +137,8 @@ public class NotificationListenerHolder {
|
|||
}
|
||||
ObjectName[] resolved = new ObjectName[this.mappedObjectNames.size()];
|
||||
int i = 0;
|
||||
for (Iterator it = this.mappedObjectNames.iterator(); it.hasNext();) {
|
||||
resolved[i] = ObjectNameManager.getInstance(it.next());
|
||||
for (Object objectName : this.mappedObjectNames) {
|
||||
resolved[i] = ObjectNameManager.getInstance(objectName);
|
||||
i++;
|
||||
}
|
||||
return resolved;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -45,7 +45,7 @@ public abstract class RemoteInvocationUtils {
|
|||
public static void fillInClientStackTraceIfPossible(Throwable ex) {
|
||||
if (ex != null) {
|
||||
StackTraceElement[] clientStack = new Throwable().getStackTrace();
|
||||
Set visitedExceptions = new HashSet();
|
||||
Set<Throwable> visitedExceptions = new HashSet<Throwable>();
|
||||
Throwable exToUpdate = ex;
|
||||
while (exToUpdate != null && !visitedExceptions.contains(exToUpdate)) {
|
||||
StackTraceElement[] serverStack = exToUpdate.getStackTrace();
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package org.springframework.validation;
|
|||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.EmptyStackException;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
|
@ -38,7 +37,7 @@ public abstract class AbstractErrors implements Errors, Serializable {
|
|||
|
||||
private String nestedPath = "";
|
||||
|
||||
private final Stack nestedPathStack = new Stack();
|
||||
private final Stack<String> nestedPathStack = new Stack<String>();
|
||||
|
||||
|
||||
public void setNestedPath(String nestedPath) {
|
||||
|
|
@ -57,7 +56,7 @@ public abstract class AbstractErrors implements Errors, Serializable {
|
|||
|
||||
public void popNestedPath() throws IllegalArgumentException {
|
||||
try {
|
||||
String formerNestedPath = (String) this.nestedPathStack.pop();
|
||||
String formerNestedPath = this.nestedPathStack.pop();
|
||||
doSetNestedPath(formerNestedPath);
|
||||
}
|
||||
catch (EmptyStackException ex) {
|
||||
|
|
@ -131,8 +130,8 @@ public abstract class AbstractErrors implements Errors, Serializable {
|
|||
return getAllErrors().size();
|
||||
}
|
||||
|
||||
public List getAllErrors() {
|
||||
List result = new LinkedList();
|
||||
public List<ObjectError> getAllErrors() {
|
||||
List<ObjectError> result = new LinkedList<ObjectError>();
|
||||
result.addAll(getGlobalErrors());
|
||||
result.addAll(getFieldErrors());
|
||||
return Collections.unmodifiableList(result);
|
||||
|
|
@ -172,13 +171,12 @@ public abstract class AbstractErrors implements Errors, Serializable {
|
|||
return getFieldErrors(field).size();
|
||||
}
|
||||
|
||||
public List getFieldErrors(String field) {
|
||||
List fieldErrors = getFieldErrors();
|
||||
List result = new LinkedList();
|
||||
public List<FieldError> getFieldErrors(String field) {
|
||||
List<FieldError> fieldErrors = getFieldErrors();
|
||||
List<FieldError> result = new LinkedList<FieldError>();
|
||||
String fixedField = fixedField(field);
|
||||
for (Iterator it = fieldErrors.iterator(); it.hasNext();) {
|
||||
Object error = it.next();
|
||||
if (isMatchingFieldError(fixedField, (FieldError) error)) {
|
||||
for (FieldError error : fieldErrors) {
|
||||
if (isMatchingFieldError(fixedField, error)) {
|
||||
result.add(error);
|
||||
}
|
||||
}
|
||||
|
|
@ -198,6 +196,7 @@ public abstract class AbstractErrors implements Errors, Serializable {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the given FieldError matches the given field.
|
||||
* @param field the field that we are looking up FieldErrors for
|
||||
|
|
@ -214,9 +213,8 @@ public abstract class AbstractErrors implements Errors, Serializable {
|
|||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(getClass().getName());
|
||||
sb.append(": ").append(getErrorCount()).append(" errors");
|
||||
Iterator it = getAllErrors().iterator();
|
||||
while (it.hasNext()) {
|
||||
sb.append('\n').append(it.next());
|
||||
for (ObjectError error : getAllErrors()) {
|
||||
sb.append('\n').append(error);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public abstract class Conventions {
|
|||
* Set of interfaces that are supposed to be ignored
|
||||
* when searching for the 'primary' interface of a proxy.
|
||||
*/
|
||||
private static final Set ignoredInterfaces = new HashSet();
|
||||
private static final Set<Class> ignoredInterfaces = new HashSet<Class>();
|
||||
|
||||
static {
|
||||
ignoredInterfaces.add(Serializable.class);
|
||||
|
|
@ -212,15 +212,14 @@ public abstract class Conventions {
|
|||
*/
|
||||
public static String attributeNameToPropertyName(String attributeName) {
|
||||
Assert.notNull(attributeName, "'attributeName' must not be null");
|
||||
if (attributeName.indexOf("-") == -1) {
|
||||
if (!attributeName.contains("-")) {
|
||||
return attributeName;
|
||||
}
|
||||
char[] chars = attributeName.toCharArray();
|
||||
char[] result = new char[chars.length -1]; // not completely accurate but good guess
|
||||
int currPos = 0;
|
||||
boolean upperCaseNext = false;
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
char c = chars[i];
|
||||
for (char c : chars) {
|
||||
if (c == '-') {
|
||||
upperCaseNext = true;
|
||||
}
|
||||
|
|
@ -260,8 +259,7 @@ public abstract class Conventions {
|
|||
Class valueClass = value.getClass();
|
||||
if (Proxy.isProxyClass(valueClass)) {
|
||||
Class[] ifcs = valueClass.getInterfaces();
|
||||
for (int i = 0; i < ifcs.length; i++) {
|
||||
Class ifc = ifcs[i];
|
||||
for (Class ifc : ifcs) {
|
||||
if (!ignoredInterfaces.contains(ifc)) {
|
||||
return ifc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
|
|
@ -94,17 +93,15 @@ public class ResourceArrayPropertyEditor extends PropertyEditorSupport {
|
|||
public void setValue(Object value) throws IllegalArgumentException {
|
||||
if (value instanceof Collection || (value instanceof Object[] && !(value instanceof Resource[]))) {
|
||||
Collection input = (value instanceof Collection ? (Collection) value : Arrays.asList((Object[]) value));
|
||||
List merged = new ArrayList();
|
||||
for (Iterator it = input.iterator(); it.hasNext();) {
|
||||
Object element = it.next();
|
||||
List<Resource> merged = new ArrayList<Resource>();
|
||||
for (Object element : input) {
|
||||
if (element instanceof String) {
|
||||
// A location pattern: resolve it into a Resource array.
|
||||
// Might point to a single resource or to multiple resources.
|
||||
String pattern = resolvePath((String) element).trim();
|
||||
try {
|
||||
Resource[] resources = this.resourcePatternResolver.getResources(pattern);
|
||||
for (int i = 0; i < resources.length; i++) {
|
||||
Resource resource = resources[i];
|
||||
for (Resource resource : resources) {
|
||||
if (!merged.contains(resource)) {
|
||||
merged.add(resource);
|
||||
}
|
||||
|
|
@ -117,8 +114,9 @@ public class ResourceArrayPropertyEditor extends PropertyEditorSupport {
|
|||
}
|
||||
else if (element instanceof Resource) {
|
||||
// A Resource object: add it to the result.
|
||||
if (!merged.contains(element)) {
|
||||
merged.add(element);
|
||||
Resource resource = (Resource) element;
|
||||
if (!merged.contains(resource)) {
|
||||
merged.add(resource);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -39,18 +39,18 @@ import java.util.ListIterator;
|
|||
* @author Juergen Hoeller
|
||||
* @since 2.0
|
||||
*/
|
||||
public class AutoPopulatingList implements List, Serializable {
|
||||
public class AutoPopulatingList<E> implements List<E>, Serializable {
|
||||
|
||||
/**
|
||||
* The {@link List} that all operations are eventually delegated to.
|
||||
*/
|
||||
private final List backingList;
|
||||
private final List<E> backingList;
|
||||
|
||||
/**
|
||||
* The {@link ElementFactory} to use to create new {@link List} elements
|
||||
* on demand.
|
||||
*/
|
||||
private final ElementFactory elementFactory;
|
||||
private final ElementFactory<E> elementFactory;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -58,8 +58,8 @@ public class AutoPopulatingList implements List, Serializable {
|
|||
* {@link ArrayList} and adds new instances of the supplied {@link Class element Class}
|
||||
* to the backing {@link List} on demand.
|
||||
*/
|
||||
public AutoPopulatingList(Class elementClass) {
|
||||
this(new ArrayList(), elementClass);
|
||||
public AutoPopulatingList(Class<? extends E> elementClass) {
|
||||
this(new ArrayList<E>(), elementClass);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -67,23 +67,23 @@ public class AutoPopulatingList implements List, Serializable {
|
|||
* and adds new instances of the supplied {@link Class element Class} to the backing
|
||||
* {@link List} on demand.
|
||||
*/
|
||||
public AutoPopulatingList(List backingList, Class elementClass) {
|
||||
this(backingList, new ReflectiveElementFactory(elementClass));
|
||||
public AutoPopulatingList(List<E> backingList, Class<? extends E> elementClass) {
|
||||
this(backingList, new ReflectiveElementFactory<E>(elementClass));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>AutoPopulatingList</code> that is backed by a standard
|
||||
* {@link ArrayList} and creates new elements on demand using the supplied {@link ElementFactory}.
|
||||
*/
|
||||
public AutoPopulatingList(ElementFactory elementFactory) {
|
||||
this(new ArrayList(), elementFactory);
|
||||
public AutoPopulatingList(ElementFactory<E> elementFactory) {
|
||||
this(new ArrayList<E>(), elementFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>AutoPopulatingList</code> that is backed by the supplied {@link List}
|
||||
* and creates new elements on demand using the supplied {@link ElementFactory}.
|
||||
*/
|
||||
public AutoPopulatingList(List backingList, ElementFactory elementFactory) {
|
||||
public AutoPopulatingList(List<E> backingList, ElementFactory<E> elementFactory) {
|
||||
Assert.notNull(backingList, "Backing List must not be null");
|
||||
Assert.notNull(elementFactory, "Element factory must not be null");
|
||||
this.backingList = backingList;
|
||||
|
|
@ -91,19 +91,19 @@ public class AutoPopulatingList implements List, Serializable {
|
|||
}
|
||||
|
||||
|
||||
public void add(int index, Object element) {
|
||||
public void add(int index, E element) {
|
||||
this.backingList.add(index, element);
|
||||
}
|
||||
|
||||
public boolean add(Object o) {
|
||||
public boolean add(E o) {
|
||||
return this.backingList.add(o);
|
||||
}
|
||||
|
||||
public boolean addAll(Collection c) {
|
||||
public boolean addAll(Collection<? extends E> c) {
|
||||
return this.backingList.addAll(c);
|
||||
}
|
||||
|
||||
public boolean addAll(int index, Collection c) {
|
||||
public boolean addAll(int index, Collection<? extends E> c) {
|
||||
return this.backingList.addAll(index, c);
|
||||
}
|
||||
|
||||
|
|
@ -119,19 +119,13 @@ public class AutoPopulatingList implements List, Serializable {
|
|||
return this.backingList.containsAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return this.backingList.equals(o);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the element at the supplied index, creating it if there is
|
||||
* no element at that index.
|
||||
*/
|
||||
public Object get(int index) {
|
||||
public E get(int index) {
|
||||
int backingListSize = this.backingList.size();
|
||||
|
||||
Object element = null;
|
||||
E element = null;
|
||||
if (index < backingListSize) {
|
||||
element = this.backingList.get(index);
|
||||
if (element == null) {
|
||||
|
|
@ -149,11 +143,6 @@ public class AutoPopulatingList implements List, Serializable {
|
|||
return element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.backingList.hashCode();
|
||||
}
|
||||
|
||||
public int indexOf(Object o) {
|
||||
return this.backingList.indexOf(o);
|
||||
}
|
||||
|
|
@ -162,7 +151,7 @@ public class AutoPopulatingList implements List, Serializable {
|
|||
return this.backingList.isEmpty();
|
||||
}
|
||||
|
||||
public Iterator iterator() {
|
||||
public Iterator<E> iterator() {
|
||||
return this.backingList.iterator();
|
||||
}
|
||||
|
||||
|
|
@ -170,15 +159,15 @@ public class AutoPopulatingList implements List, Serializable {
|
|||
return this.backingList.lastIndexOf(o);
|
||||
}
|
||||
|
||||
public ListIterator listIterator() {
|
||||
public ListIterator<E> listIterator() {
|
||||
return this.backingList.listIterator();
|
||||
}
|
||||
|
||||
public ListIterator listIterator(int index) {
|
||||
public ListIterator<E> listIterator(int index) {
|
||||
return this.backingList.listIterator(index);
|
||||
}
|
||||
|
||||
public Object remove(int index) {
|
||||
public E remove(int index) {
|
||||
return this.backingList.remove(index);
|
||||
}
|
||||
|
||||
|
|
@ -186,15 +175,15 @@ public class AutoPopulatingList implements List, Serializable {
|
|||
return this.backingList.remove(o);
|
||||
}
|
||||
|
||||
public boolean removeAll(Collection c) {
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
return this.backingList.removeAll(c);
|
||||
}
|
||||
|
||||
public boolean retainAll(Collection c) {
|
||||
public boolean retainAll(Collection<?> c) {
|
||||
return this.backingList.retainAll(c);
|
||||
}
|
||||
|
||||
public Object set(int index, Object element) {
|
||||
public E set(int index, E element) {
|
||||
return this.backingList.set(index, element);
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +191,7 @@ public class AutoPopulatingList implements List, Serializable {
|
|||
return this.backingList.size();
|
||||
}
|
||||
|
||||
public List subList(int fromIndex, int toIndex) {
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return this.backingList.subList(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
|
|
@ -210,16 +199,27 @@ public class AutoPopulatingList implements List, Serializable {
|
|||
return this.backingList.toArray();
|
||||
}
|
||||
|
||||
public Object[] toArray(Object[] a) {
|
||||
public <T> T[] toArray(T[] a) {
|
||||
return this.backingList.toArray(a);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return this.backingList.equals(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.backingList.hashCode();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Factory interface for creating elements for an index-based access
|
||||
* data structure such as a {@link java.util.List}.
|
||||
*/
|
||||
public interface ElementFactory {
|
||||
public interface ElementFactory<E> {
|
||||
|
||||
/**
|
||||
* Create the element for the supplied index.
|
||||
|
|
@ -227,7 +227,7 @@ public class AutoPopulatingList implements List, Serializable {
|
|||
* @throws ElementInstantiationException if the instantiation process failed
|
||||
* (any exception thrown by a target constructor should be propagated as-is)
|
||||
*/
|
||||
Object createElement(int index) throws ElementInstantiationException;
|
||||
E createElement(int index) throws ElementInstantiationException;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -247,18 +247,18 @@ public class AutoPopulatingList implements List, Serializable {
|
|||
* using <code>Class.newInstance()</code> on a given element class.
|
||||
* @see java.lang.Class#newInstance()
|
||||
*/
|
||||
private static class ReflectiveElementFactory implements ElementFactory, Serializable {
|
||||
private static class ReflectiveElementFactory<E> implements ElementFactory<E>, Serializable {
|
||||
|
||||
private final Class elementClass;
|
||||
private final Class<? extends E> elementClass;
|
||||
|
||||
public ReflectiveElementFactory(Class elementClass) {
|
||||
public ReflectiveElementFactory(Class<? extends E> elementClass) {
|
||||
Assert.notNull(elementClass, "Element clas must not be null");
|
||||
Assert.isTrue(!elementClass.isInterface(), "Element class must not be an interface type");
|
||||
Assert.isTrue(!Modifier.isAbstract(elementClass.getModifiers()), "Element class cannot be an abstract class");
|
||||
this.elementClass = elementClass;
|
||||
}
|
||||
|
||||
public Object createElement(int index) {
|
||||
public E createElement(int index) {
|
||||
try {
|
||||
return this.elementClass.newInstance();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,10 +67,9 @@ public abstract class ReflectionUtils {
|
|||
Class searchType = clazz;
|
||||
while (!Object.class.equals(searchType) && searchType != null) {
|
||||
Field[] fields = searchType.getDeclaredFields();
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
Field field = fields[i];
|
||||
if ((name == null || name.equals(field.getName()))
|
||||
&& (type == null || type.equals(field.getType()))) {
|
||||
for (Field field : fields) {
|
||||
if ((name == null || name.equals(field.getName())) &&
|
||||
(type == null || type.equals(field.getType()))) {
|
||||
return field;
|
||||
}
|
||||
}
|
||||
|
|
@ -152,8 +151,7 @@ public abstract class ReflectionUtils {
|
|||
Class searchType = clazz;
|
||||
while (!Object.class.equals(searchType) && searchType != null) {
|
||||
Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods());
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
Method method = methods[i];
|
||||
for (Method method : methods) {
|
||||
if (name.equals(method.getName()) &&
|
||||
(paramTypes == null || Arrays.equals(paramTypes, method.getParameterTypes()))) {
|
||||
return method;
|
||||
|
|
@ -454,16 +452,16 @@ public abstract class ReflectionUtils {
|
|||
// Keep backing up the inheritance hierarchy.
|
||||
do {
|
||||
Method[] methods = targetClass.getDeclaredMethods();
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (mf != null && !mf.matches(methods[i])) {
|
||||
for (Method method : methods) {
|
||||
if (mf != null && !mf.matches(method)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
mc.doWith(methods[i]);
|
||||
mc.doWith(method);
|
||||
}
|
||||
catch (IllegalAccessException ex) {
|
||||
throw new IllegalStateException(
|
||||
"Shouldn't be illegal to access method '" + methods[i].getName() + "': " + ex);
|
||||
"Shouldn't be illegal to access method '" + method.getName() + "': " + ex);
|
||||
}
|
||||
}
|
||||
targetClass = targetClass.getSuperclass();
|
||||
|
|
@ -476,13 +474,13 @@ public abstract class ReflectionUtils {
|
|||
* Leaf class methods are included first.
|
||||
*/
|
||||
public static Method[] getAllDeclaredMethods(Class leafClass) throws IllegalArgumentException {
|
||||
final List list = new ArrayList(32);
|
||||
final List<Method> methods = new ArrayList<Method>(32);
|
||||
doWithMethods(leafClass, new MethodCallback() {
|
||||
public void doWith(Method method) {
|
||||
list.add(method);
|
||||
methods.add(method);
|
||||
}
|
||||
});
|
||||
return (Method[]) list.toArray(new Method[list.size()]);
|
||||
return methods.toArray(new Method[methods.size()]);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -510,17 +508,17 @@ public abstract class ReflectionUtils {
|
|||
do {
|
||||
// Copy each field declared on this class unless it's static or file.
|
||||
Field[] fields = targetClass.getDeclaredFields();
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
for (Field field : fields) {
|
||||
// Skip static and final fields.
|
||||
if (ff != null && !ff.matches(fields[i])) {
|
||||
if (ff != null && !ff.matches(field)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
fc.doWith(fields[i]);
|
||||
fc.doWith(field);
|
||||
}
|
||||
catch (IllegalAccessException ex) {
|
||||
throw new IllegalStateException(
|
||||
"Shouldn't be illegal to access field '" + fields[i].getName() + "': " + ex);
|
||||
"Shouldn't be illegal to access field '" + field.getName() + "': " + ex);
|
||||
}
|
||||
}
|
||||
targetClass = targetClass.getSuperclass();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-20078the 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.
|
||||
|
|
@ -48,8 +48,7 @@ public class StopWatch {
|
|||
|
||||
private boolean keepTaskList = true;
|
||||
|
||||
/** List of TaskInfo objects */
|
||||
private final List taskList = new LinkedList();
|
||||
private final List<TaskInfo> taskList = new LinkedList<TaskInfo>();
|
||||
|
||||
/** Start time of the current task */
|
||||
private long startTimeMillis;
|
||||
|
|
@ -187,7 +186,7 @@ public class StopWatch {
|
|||
if (!this.keepTaskList) {
|
||||
throw new UnsupportedOperationException("Task info is not being kept!");
|
||||
}
|
||||
return (TaskInfo[]) this.taskList.toArray(new TaskInfo[this.taskList.size()]);
|
||||
return this.taskList.toArray(new TaskInfo[this.taskList.size()]);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -209,7 +208,6 @@ public class StopWatch {
|
|||
sb.append("No task info kept");
|
||||
}
|
||||
else {
|
||||
TaskInfo[] tasks = getTaskInfo();
|
||||
sb.append("-----------------------------------------\n");
|
||||
sb.append("ms % Task name\n");
|
||||
sb.append("-----------------------------------------\n");
|
||||
|
|
@ -219,10 +217,10 @@ public class StopWatch {
|
|||
NumberFormat pf = NumberFormat.getPercentInstance();
|
||||
pf.setMinimumIntegerDigits(3);
|
||||
pf.setGroupingUsed(false);
|
||||
for (int i = 0; i < tasks.length; i++) {
|
||||
sb.append(nf.format(tasks[i].getTimeMillis()) + " ");
|
||||
sb.append(pf.format(tasks[i].getTimeSeconds() / getTotalTimeSeconds()) + " ");
|
||||
sb.append(tasks[i].getTaskName() + "\n");
|
||||
for (TaskInfo task : getTaskInfo()) {
|
||||
sb.append(nf.format(task.getTimeMillis())).append(" ");
|
||||
sb.append(pf.format(task.getTimeSeconds() / getTotalTimeSeconds())).append(" ");
|
||||
sb.append(task.getTaskName()).append("\n");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
@ -236,11 +234,10 @@ public class StopWatch {
|
|||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(shortSummary());
|
||||
if (this.keepTaskList) {
|
||||
TaskInfo[] tasks = getTaskInfo();
|
||||
for (int i = 0; i < tasks.length; i++) {
|
||||
sb.append("; [" + tasks[i].getTaskName() + "] took " + tasks[i].getTimeMillis());
|
||||
long percent = Math.round((100.0 * tasks[i].getTimeSeconds()) / getTotalTimeSeconds());
|
||||
sb.append(" = " + percent + "%");
|
||||
for (TaskInfo task : getTaskInfo()) {
|
||||
sb.append("; [").append(task.getTaskName()).append("] took ").append(task.getTimeMillis());
|
||||
long percent = Math.round((100.0 * task.getTimeSeconds()) / getTotalTimeSeconds());
|
||||
sb.append(" = ").append(percent).append("%");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -26,10 +26,10 @@ import java.util.List;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.jdbc.core.SqlInOutParameter;
|
||||
import org.springframework.jdbc.core.SqlOutParameter;
|
||||
import org.springframework.jdbc.core.SqlParameter;
|
||||
import org.springframework.jdbc.core.SqlInOutParameter;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
|
@ -279,14 +279,10 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
|||
metaDataSchemaName + "/" + metaDataProcedureName);
|
||||
}
|
||||
try {
|
||||
procs = databaseMetaData.getProcedures(
|
||||
metaDataCatalogName,
|
||||
metaDataSchemaName,
|
||||
metaDataProcedureName);
|
||||
List found = new ArrayList();
|
||||
procs = databaseMetaData.getProcedures(metaDataCatalogName, metaDataSchemaName, metaDataProcedureName);
|
||||
List<String> found = new ArrayList<String>();
|
||||
while (procs.next()) {
|
||||
found.add(procs.getString("PROCEDURE_CAT") +
|
||||
"."+procs.getString("PROCEDURE_SCHEM") +
|
||||
found.add(procs.getString("PROCEDURE_CAT") + "." + procs.getString("PROCEDURE_SCHEM") +
|
||||
"." + procs.getString("PROCEDURE_NAME"));
|
||||
}
|
||||
procs.close();
|
||||
|
|
@ -304,10 +300,7 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
|||
}
|
||||
|
||||
procs = databaseMetaData.getProcedureColumns(
|
||||
metaDataCatalogName,
|
||||
metaDataSchemaName,
|
||||
metaDataProcedureName,
|
||||
null);
|
||||
metaDataCatalogName, metaDataSchemaName, metaDataProcedureName, null);
|
||||
while (procs.next()) {
|
||||
String columnName = procs.getString("COLUMN_NAME");
|
||||
int columnType = procs.getInt("COLUMN_TYPE");
|
||||
|
|
@ -327,36 +320,30 @@ public class GenericCallMetaDataProvider implements CallMetaDataProvider {
|
|||
}
|
||||
}
|
||||
else {
|
||||
CallParameterMetaData meta = new CallParameterMetaData(
|
||||
columnName,
|
||||
columnType,
|
||||
procs.getInt("DATA_TYPE"),
|
||||
procs.getString("TYPE_NAME"),
|
||||
procs.getBoolean("NULLABLE")
|
||||
CallParameterMetaData meta = new CallParameterMetaData(columnName, columnType,
|
||||
procs.getInt("DATA_TYPE"), procs.getString("TYPE_NAME"), procs.getBoolean("NULLABLE")
|
||||
);
|
||||
callParameterMetaData.add(meta);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Retrieved metadata: "
|
||||
+ meta.getParameterName() +
|
||||
" " + meta.getParameterType() +
|
||||
" " + meta.getSqlType() +
|
||||
" " + meta.getTypeName() +
|
||||
" " + meta.isNullable()
|
||||
logger.debug("Retrieved metadata: " + meta.getParameterName() + " " +
|
||||
meta.getParameterType() + " " + meta.getSqlType() +
|
||||
" " + meta.getTypeName() + " " + meta.isNullable()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException se) {
|
||||
logger.warn("Error while retreiving metadata for procedure columns: " + se.getMessage());
|
||||
catch (SQLException ex) {
|
||||
logger.warn("Error while retrieving metadata for procedure columns: " + ex);
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
if (procs != null)
|
||||
if (procs != null) {
|
||||
procs.close();
|
||||
}
|
||||
catch (SQLException se) {
|
||||
logger.warn("Problem closing resultset for procedure column metadata " + se.getMessage());
|
||||
}
|
||||
catch (SQLException ex) {
|
||||
logger.warn("Problem closing ResultSet for procedure column metadata: " + ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -192,7 +192,7 @@ public class TableMetaDataContext {
|
|||
if (declaredColumns.size() > 0) {
|
||||
return new ArrayList<String>(declaredColumns);
|
||||
}
|
||||
Set keys = new HashSet(generatedKeyNames.length);
|
||||
Set<String> keys = new HashSet<String>(generatedKeyNames.length);
|
||||
for (String key : generatedKeyNames) {
|
||||
keys.add(key.toUpperCase());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,14 +75,14 @@ public class BeanPropertySqlParameterSource extends AbstractSqlParameterSource {
|
|||
*/
|
||||
public String[] getReadablePropertyNames() {
|
||||
if (this.propertyNames == null) {
|
||||
List names = new ArrayList();
|
||||
List<String> names = new ArrayList<String>();
|
||||
PropertyDescriptor[] props = this.beanWrapper.getPropertyDescriptors();
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
if (this.beanWrapper.isReadableProperty(props[i].getName())) {
|
||||
names.add(props[i].getName());
|
||||
for (PropertyDescriptor pd : props) {
|
||||
if (this.beanWrapper.isReadableProperty(pd.getName())) {
|
||||
names.add(pd.getName());
|
||||
}
|
||||
}
|
||||
this.propertyNames = (String[]) names.toArray(new String[names.size()]);
|
||||
this.propertyNames = names.toArray(new String[names.size()]);
|
||||
}
|
||||
return this.propertyNames;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,15 +44,15 @@ import org.springframework.jdbc.BadSqlGrammarException;
|
|||
*/
|
||||
public class SQLStateSQLExceptionTranslator extends AbstractFallbackSQLExceptionTranslator {
|
||||
|
||||
private static final Set BAD_SQL_GRAMMAR_CODES = new HashSet(8);
|
||||
private static final Set<String> BAD_SQL_GRAMMAR_CODES = new HashSet<String>(8);
|
||||
|
||||
private static final Set DATA_INTEGRITY_VIOLATION_CODES = new HashSet(8);
|
||||
private static final Set<String> DATA_INTEGRITY_VIOLATION_CODES = new HashSet<String>(8);
|
||||
|
||||
private static final Set DATA_ACCESS_RESOURCE_FAILURE_CODES = new HashSet(8);
|
||||
private static final Set<String> DATA_ACCESS_RESOURCE_FAILURE_CODES = new HashSet<String>(8);
|
||||
|
||||
private static final Set TRANSIENT_DATA_ACCESS_RESOURCE_CODES = new HashSet(8);
|
||||
private static final Set<String> TRANSIENT_DATA_ACCESS_RESOURCE_CODES = new HashSet<String>(8);
|
||||
|
||||
private static final Set CONCURRENCY_FAILURE_CODES = new HashSet(4);
|
||||
private static final Set<String> CONCURRENCY_FAILURE_CODES = new HashSet<String>(4);
|
||||
|
||||
|
||||
static {
|
||||
|
|
|
|||
|
|
@ -394,8 +394,8 @@ public class SingleConnectionFactory
|
|||
*/
|
||||
protected Session createSession(Connection con, Integer mode) throws JMSException {
|
||||
// Determine JMS API arguments...
|
||||
boolean transacted = (mode.intValue() == Session.SESSION_TRANSACTED);
|
||||
int ackMode = (transacted ? Session.AUTO_ACKNOWLEDGE : mode.intValue());
|
||||
boolean transacted = (mode == Session.SESSION_TRANSACTED);
|
||||
int ackMode = (transacted ? Session.AUTO_ACKNOWLEDGE : mode);
|
||||
// Now actually call the appropriate JMS factory method...
|
||||
if (Boolean.FALSE.equals(this.pubSubMode) && con instanceof QueueConnection) {
|
||||
return ((QueueConnection) con).createQueueSession(transacted, ackMode);
|
||||
|
|
@ -444,7 +444,7 @@ public class SingleConnectionFactory
|
|||
* @return the wrapped Connection
|
||||
*/
|
||||
protected Connection getSharedConnectionProxy(Connection target) {
|
||||
List classes = new ArrayList(3);
|
||||
List<Class> classes = new ArrayList<Class>(3);
|
||||
classes.add(Connection.class);
|
||||
if (target instanceof QueueConnection) {
|
||||
classes.add(QueueConnection.class);
|
||||
|
|
@ -454,7 +454,7 @@ public class SingleConnectionFactory
|
|||
}
|
||||
return (Connection) Proxy.newProxyInstance(
|
||||
Connection.class.getClassLoader(),
|
||||
(Class[]) classes.toArray(new Class[classes.size()]),
|
||||
classes.toArray(new Class[classes.size()]),
|
||||
new SharedConnectionInvocationHandler(target));
|
||||
}
|
||||
|
||||
|
|
@ -477,7 +477,7 @@ public class SingleConnectionFactory
|
|||
}
|
||||
else if (method.getName().equals("hashCode")) {
|
||||
// Use hashCode of Connection proxy.
|
||||
return new Integer(System.identityHashCode(proxy));
|
||||
return System.identityHashCode(proxy);
|
||||
}
|
||||
else if (method.getName().equals("toString")) {
|
||||
return "Shared JMS Connection: " + this.target;
|
||||
|
|
@ -527,9 +527,9 @@ public class SingleConnectionFactory
|
|||
}
|
||||
else if (method.getName().equals("createSession") || method.getName().equals("createQueueSession") ||
|
||||
method.getName().equals("createTopicSession")) {
|
||||
boolean transacted = ((Boolean) args[0]).booleanValue();
|
||||
boolean transacted = (Boolean) args[0];
|
||||
Integer ackMode = (Integer) args[1];
|
||||
Integer mode = (transacted ? new Integer(Session.SESSION_TRANSACTED) : ackMode);
|
||||
Integer mode = (transacted ? Session.SESSION_TRANSACTED : ackMode);
|
||||
Session session = getSession(this.target, mode);
|
||||
if (session != null) {
|
||||
if (!method.getReturnType().isInstance(session)) {
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ public class TransactionAwareConnectionFactoryProxy
|
|||
* @return the wrapped Connection
|
||||
*/
|
||||
private Connection getTransactionAwareConnectionProxy(Connection target) {
|
||||
List classes = new ArrayList(3);
|
||||
List<Class> classes = new ArrayList<Class>(3);
|
||||
classes.add(Connection.class);
|
||||
if (target instanceof QueueConnection) {
|
||||
classes.add(QueueConnection.class);
|
||||
|
|
@ -202,7 +202,7 @@ public class TransactionAwareConnectionFactoryProxy
|
|||
}
|
||||
return (Connection) Proxy.newProxyInstance(
|
||||
Connection.class.getClassLoader(),
|
||||
(Class[]) classes.toArray(new Class[classes.size()]),
|
||||
classes.toArray(new Class[classes.size()]),
|
||||
new TransactionAwareConnectionInvocationHandler(target));
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ public class TransactionAwareConnectionFactoryProxy
|
|||
}
|
||||
|
||||
private Session getCloseSuppressingSessionProxy(Session target) {
|
||||
List classes = new ArrayList(3);
|
||||
List<Class> classes = new ArrayList<Class>(3);
|
||||
classes.add(SessionProxy.class);
|
||||
if (target instanceof QueueSession) {
|
||||
classes.add(QueueSession.class);
|
||||
|
|
@ -273,7 +273,7 @@ public class TransactionAwareConnectionFactoryProxy
|
|||
}
|
||||
return (Session) Proxy.newProxyInstance(
|
||||
SessionProxy.class.getClassLoader(),
|
||||
(Class[]) classes.toArray(new Class[classes.size()]),
|
||||
classes.toArray(new Class[classes.size()]),
|
||||
new CloseSuppressingSessionInvocationHandler(target));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
|
|||
|
||||
private boolean running = false;
|
||||
|
||||
private final List pausedTasks = new LinkedList();
|
||||
private final List<Object> pausedTasks = new LinkedList<Object>();
|
||||
|
||||
protected final Object lifecycleMonitor = new Object();
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -94,13 +94,11 @@ class TxAdviceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
|||
}
|
||||
|
||||
private RootBeanDefinition parseAttributeSource(Element attrEle, ParserContext parserContext) {
|
||||
List methods = DomUtils.getChildElementsByTagName(attrEle, "method");
|
||||
List<Element> methods = DomUtils.getChildElementsByTagName(attrEle, "method");
|
||||
ManagedMap transactionAttributeMap = new ManagedMap(methods.size());
|
||||
transactionAttributeMap.setSource(parserContext.extractSource(attrEle));
|
||||
|
||||
for (int i = 0; i < methods.size(); i++) {
|
||||
Element methodEle = (Element) methods.get(i);
|
||||
|
||||
for (Element methodEle : methods) {
|
||||
String name = methodEle.getAttribute("name");
|
||||
TypedStringValue nameHolder = new TypedStringValue(name);
|
||||
nameHolder.setSource(parserContext.extractSource(methodEle));
|
||||
|
|
@ -125,10 +123,10 @@ class TxAdviceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
|||
}
|
||||
}
|
||||
if (StringUtils.hasText(readOnly)) {
|
||||
attribute.setReadOnly(Boolean.valueOf(methodEle.getAttribute(READ_ONLY)).booleanValue());
|
||||
attribute.setReadOnly(Boolean.valueOf(methodEle.getAttribute(READ_ONLY)));
|
||||
}
|
||||
|
||||
List rollbackRules = new LinkedList();
|
||||
List<RollbackRuleAttribute> rollbackRules = new LinkedList<RollbackRuleAttribute>();
|
||||
if (methodEle.hasAttribute(ROLLBACK_FOR)) {
|
||||
String rollbackForValue = methodEle.getAttribute(ROLLBACK_FOR);
|
||||
addRollbackRuleAttributesTo(rollbackRules,rollbackForValue);
|
||||
|
|
@ -148,17 +146,17 @@ class TxAdviceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
|||
return attributeSourceDefinition;
|
||||
}
|
||||
|
||||
private void addRollbackRuleAttributesTo(List rollbackRules, String rollbackForValue) {
|
||||
private void addRollbackRuleAttributesTo(List<RollbackRuleAttribute> rollbackRules, String rollbackForValue) {
|
||||
String[] exceptionTypeNames = StringUtils.commaDelimitedListToStringArray(rollbackForValue);
|
||||
for (int i = 0; i < exceptionTypeNames.length; i++) {
|
||||
rollbackRules.add(new RollbackRuleAttribute(StringUtils.trimWhitespace(exceptionTypeNames[i])));
|
||||
for (String typeName : exceptionTypeNames) {
|
||||
rollbackRules.add(new RollbackRuleAttribute(StringUtils.trimWhitespace(typeName)));
|
||||
}
|
||||
}
|
||||
|
||||
private void addNoRollbackRuleAttributesTo(List rollbackRules, String noRollbackForValue) {
|
||||
private void addNoRollbackRuleAttributesTo(List<RollbackRuleAttribute> rollbackRules, String noRollbackForValue) {
|
||||
String[] exceptionTypeNames = StringUtils.commaDelimitedListToStringArray(noRollbackForValue);
|
||||
for (int i = 0; i < exceptionTypeNames.length; i++) {
|
||||
rollbackRules.add(new NoRollbackRuleAttribute(StringUtils.trimWhitespace(exceptionTypeNames[i])));
|
||||
for (String typeName : exceptionTypeNames) {
|
||||
rollbackRules.add(new NoRollbackRuleAttribute(StringUtils.trimWhitespace(typeName)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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()) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -17,7 +17,6 @@
|
|||
package org.springframework.web.bind;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.validation.Errors;
|
||||
|
|
@ -117,7 +116,7 @@ public class EscapedErrors implements Errors {
|
|||
return this.source.getErrorCount();
|
||||
}
|
||||
|
||||
public List getAllErrors() {
|
||||
public List<ObjectError> getAllErrors() {
|
||||
return escapeObjectErrors(this.source.getAllErrors());
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +128,7 @@ public class EscapedErrors implements Errors {
|
|||
return this.source.getGlobalErrorCount();
|
||||
}
|
||||
|
||||
public List getGlobalErrors() {
|
||||
public List<ObjectError> getGlobalErrors() {
|
||||
return escapeObjectErrors(this.source.getGlobalErrors());
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +144,7 @@ public class EscapedErrors implements Errors {
|
|||
return this.source.getFieldErrorCount();
|
||||
}
|
||||
|
||||
public List getFieldErrors() {
|
||||
public List<FieldError> getFieldErrors() {
|
||||
return this.source.getFieldErrors();
|
||||
}
|
||||
|
||||
|
|
@ -161,12 +160,12 @@ public class EscapedErrors implements Errors {
|
|||
return this.source.getFieldErrorCount(field);
|
||||
}
|
||||
|
||||
public List getFieldErrors(String field) {
|
||||
public List<FieldError> getFieldErrors(String field) {
|
||||
return escapeObjectErrors(this.source.getFieldErrors(field));
|
||||
}
|
||||
|
||||
public FieldError getFieldError(String field) {
|
||||
return (FieldError) escapeObjectError(this.source.getFieldError(field));
|
||||
return escapeObjectError(this.source.getFieldError(field));
|
||||
}
|
||||
|
||||
public Object getFieldValue(String field) {
|
||||
|
|
@ -178,7 +177,8 @@ public class EscapedErrors implements Errors {
|
|||
return this.source.getFieldType(field);
|
||||
}
|
||||
|
||||
private ObjectError escapeObjectError(ObjectError source) {
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T extends ObjectError> T escapeObjectError(T source) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -188,20 +188,21 @@ public class EscapedErrors implements Errors {
|
|||
if (value instanceof String) {
|
||||
value = HtmlUtils.htmlEscape((String) value);
|
||||
}
|
||||
return new FieldError(
|
||||
return (T) new FieldError(
|
||||
fieldError.getObjectName(), fieldError.getField(), value,
|
||||
fieldError.isBindingFailure(), fieldError.getCodes(),
|
||||
fieldError.getArguments(), HtmlUtils.htmlEscape(fieldError.getDefaultMessage()));
|
||||
}
|
||||
return new ObjectError(
|
||||
else {
|
||||
return (T) new ObjectError(
|
||||
source.getObjectName(), source.getCodes(), source.getArguments(),
|
||||
HtmlUtils.htmlEscape(source.getDefaultMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
private List escapeObjectErrors(List source) {
|
||||
List escaped = new ArrayList(source.size());
|
||||
for (Iterator it = source.iterator(); it.hasNext();) {
|
||||
ObjectError objectError = (ObjectError)it.next();
|
||||
private <T extends ObjectError> List<T> escapeObjectErrors(List<T> source) {
|
||||
List<T> escaped = new ArrayList<T>(source.size());
|
||||
for (T objectError : source) {
|
||||
escaped.add(escapeObjectError(objectError));
|
||||
}
|
||||
return escaped;
|
||||
|
|
|
|||
|
|
@ -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.servlet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
|
@ -35,7 +36,7 @@ public class HandlerExecutionChain {
|
|||
|
||||
private HandlerInterceptor[] interceptors;
|
||||
|
||||
private List interceptorList;
|
||||
private List<HandlerInterceptor> interceptorList;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -56,7 +57,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);
|
||||
}
|
||||
|
|
@ -83,20 +84,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;
|
||||
}
|
||||
}
|
||||
|
|
@ -107,17 +104,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(handler);
|
||||
return String.valueOf(this.handler);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public abstract class HttpServletBean extends HttpServlet {
|
|||
* Set of required properties (Strings) that must be supplied as
|
||||
* config parameters to this servlet.
|
||||
*/
|
||||
private final Set requiredProperties = new HashSet();
|
||||
private final Set<String> requiredProperties = new HashSet<String>();
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -187,11 +187,11 @@ public abstract class HttpServletBean extends HttpServlet {
|
|||
* we can't accept default values
|
||||
* @throws ServletException if any required properties are missing
|
||||
*/
|
||||
public ServletConfigPropertyValues(ServletConfig config, Set requiredProperties)
|
||||
public ServletConfigPropertyValues(ServletConfig config, Set<String> requiredProperties)
|
||||
throws ServletException {
|
||||
|
||||
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()) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -52,7 +52,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
|||
|
||||
private Object defaultHandler;
|
||||
|
||||
private final List interceptors = new ArrayList();
|
||||
private final List<Object> interceptors = new ArrayList<Object>();
|
||||
|
||||
private HandlerInterceptor[] adaptedInterceptors;
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public class BeanNameUrlHandlerMapping extends AbstractDetectingUrlHandlerMappin
|
|||
*/
|
||||
@Override
|
||||
protected String[] determineUrlsForHandler(String beanName) {
|
||||
List urls = new ArrayList();
|
||||
List<String> urls = new ArrayList<String>();
|
||||
if (beanName.startsWith("/")) {
|
||||
urls.add(beanName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
|||
|
||||
|
||||
/** Set of supported HTTP methods */
|
||||
private Set supportedMethods;
|
||||
private Set<String> supportedMethods;
|
||||
|
||||
private boolean requireSession = false;
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
|||
*/
|
||||
public WebContentGenerator(boolean restrictDefaultSupportedMethods) {
|
||||
if (restrictDefaultSupportedMethods) {
|
||||
this.supportedMethods = new HashSet(4);
|
||||
this.supportedMethods = new HashSet<String>(4);
|
||||
this.supportedMethods.add(METHOD_GET);
|
||||
this.supportedMethods.add(METHOD_HEAD);
|
||||
this.supportedMethods.add(METHOD_POST);
|
||||
|
|
@ -111,7 +111,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
|
|||
*/
|
||||
public final void setSupportedMethods(String[] methods) {
|
||||
if (methods != null) {
|
||||
this.supportedMethods = new HashSet(Arrays.asList(methods));
|
||||
this.supportedMethods = new HashSet<String>(Arrays.asList(methods));
|
||||
}
|
||||
else {
|
||||
this.supportedMethods = null;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ package org.springframework.web.servlet.tags.form;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.PageContext;
|
||||
import javax.servlet.jsp.tagext.BodyTag;
|
||||
|
|
@ -169,7 +168,7 @@ public class ErrorsTag extends AbstractHtmlElementBodyTag implements BodyTag {
|
|||
*/
|
||||
@Override
|
||||
protected void exposeAttributes() throws JspException {
|
||||
List errorMessages = new ArrayList();
|
||||
List<String> errorMessages = new ArrayList<String>();
|
||||
errorMessages.addAll(Arrays.asList(getBindStatus().getErrorMessages()));
|
||||
this.oldMessages = this.pageContext.getAttribute(MESSAGES_ATTRIBUTE, PageContext.PAGE_SCOPE);
|
||||
this.pageContext.setAttribute(MESSAGES_ATTRIBUTE, errorMessages, PageContext.PAGE_SCOPE);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class InternalResourceView extends AbstractUrlBasedView {
|
|||
|
||||
private boolean exposeContextBeansAsAttributes = false;
|
||||
|
||||
private Set exposedContextBeanNames;
|
||||
private Set<String> exposedContextBeanNames;
|
||||
|
||||
private boolean preventDispatchLoop = false;
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ public class InternalResourceView extends AbstractUrlBasedView {
|
|||
* flag on but do not list specific bean names for this property.
|
||||
*/
|
||||
public void setExposedContextBeanNames(String[] exposedContextBeanNames) {
|
||||
this.exposedContextBeanNames = new HashSet(Arrays.asList(exposedContextBeanNames));
|
||||
this.exposedContextBeanNames = new HashSet<String>(Arrays.asList(exposedContextBeanNames));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ public class ContextExposingHttpServletRequest extends HttpServletRequestWrapper
|
|||
|
||||
private final WebApplicationContext webApplicationContext;
|
||||
|
||||
private final Set exposedContextBeanNames;
|
||||
private final Set<String> exposedContextBeanNames;
|
||||
|
||||
private Set explicitAttributes;
|
||||
private Set<String> explicitAttributes;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -60,7 +60,7 @@ public class ContextExposingHttpServletRequest extends HttpServletRequestWrapper
|
|||
* Set are eligible for exposure as attributes)
|
||||
*/
|
||||
public ContextExposingHttpServletRequest(
|
||||
HttpServletRequest originalRequest, WebApplicationContext context, Set exposedContextBeanNames) {
|
||||
HttpServletRequest originalRequest, WebApplicationContext context, Set<String> exposedContextBeanNames) {
|
||||
|
||||
super(originalRequest);
|
||||
Assert.notNull(context, "WebApplicationContext must not be null");
|
||||
|
|
@ -93,7 +93,7 @@ public class ContextExposingHttpServletRequest extends HttpServletRequestWrapper
|
|||
public void setAttribute(String name, Object value) {
|
||||
super.setAttribute(name, value);
|
||||
if (this.explicitAttributes == null) {
|
||||
this.explicitAttributes = new HashSet(8);
|
||||
this.explicitAttributes = new HashSet<String>(8);
|
||||
}
|
||||
this.explicitAttributes.add(name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public abstract class GenericFilterBean implements
|
|||
* Set of required properties (Strings) that must be supplied as
|
||||
* config parameters to this filter.
|
||||
*/
|
||||
private final Set requiredProperties = new HashSet();
|
||||
private final Set<String> requiredProperties = new HashSet<String>();
|
||||
|
||||
/* The FilterConfig of this filter */
|
||||
private FilterConfig filterConfig;
|
||||
|
|
@ -275,11 +275,11 @@ public abstract class GenericFilterBean implements
|
|||
* we can't accept default values
|
||||
* @throws ServletException if any required properties are missing
|
||||
*/
|
||||
public FilterConfigPropertyValues(FilterConfig config, Set requiredProperties)
|
||||
public FilterConfigPropertyValues(FilterConfig config, Set<String> requiredProperties)
|
||||
throws ServletException {
|
||||
|
||||
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()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue