Browse Source

Consistent vararg declarations for String array setters

pull/621/head
Juergen Hoeller 12 years ago
parent
commit
ad475ffadf
  1. 4
      spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java
  2. 20
      spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisor.java
  3. 4
      spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java
  4. 4
      spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java
  5. 4
      spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java
  6. 6
      spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java
  7. 4
      spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcutAdvisor.java
  8. 6
      spring-aop/src/main/java/org/springframework/aop/support/RegexpMethodPointcutAdvisor.java
  9. 4
      spring-beans/src/main/java/org/springframework/beans/factory/config/BeanDefinition.java
  10. 2
      spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java
  11. 4
      spring-context-support/src/main/java/org/springframework/mail/javamail/ConfigurableMimeFileTypeMap.java
  12. 97
      spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperation.java
  13. 4
      spring-context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java
  14. 4
      spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableConfigApplicationContext.java
  15. 4
      spring-context/src/main/java/org/springframework/jmx/export/assembler/MethodExclusionMBeanInfoAssembler.java
  16. 4
      spring-context/src/main/java/org/springframework/jmx/export/metadata/ManagedNotification.java
  17. 19
      spring-context/src/main/java/org/springframework/jndi/support/SimpleJndiBeanFactory.java
  18. 2
      spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java
  19. 7
      spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java
  20. 2
      spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreatorFactory.java
  21. 5
      spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java
  22. 18
      spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java
  23. 4
      spring-jdbc/src/main/java/org/springframework/jdbc/object/RdbmsOperation.java
  24. 4
      spring-jdbc/src/main/java/org/springframework/jdbc/support/CustomSQLErrorCodesTranslation.java
  25. 26
      spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodes.java
  26. 2
      spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java
  27. 217
      spring-test/src/main/java/org/springframework/test/context/ContextConfigurationAttributes.java
  28. 4
      spring-web/src/main/java/org/springframework/web/context/ConfigurableWebApplicationContext.java
  29. 4
      spring-web/src/main/java/org/springframework/web/context/support/GenericWebApplicationContext.java
  30. 4
      spring-web/src/main/java/org/springframework/web/context/support/StaticWebApplicationContext.java
  31. 4
      spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/ConfigurablePortletApplicationContext.java
  32. 4
      spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/StaticPortletApplicationContext.java
  33. 5
      spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/UserRoleAuthorizationInterceptor.java
  34. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/handler/UserRoleAuthorizationInterceptor.java
  35. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/ParameterMethodNameResolver.java
  36. 6
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AbstractControllerUrlHandlerMapping.java
  37. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java
  38. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/view/ResourceBundleViewResolver.java
  39. 2
      spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/AbstractJasperReportsView.java
  40. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsViewResolver.java

4
spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -240,7 +240,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence @@ -240,7 +240,7 @@ public abstract class AbstractAspectJAdvice implements Advice, AspectJPrecedence
setArgumentNamesFromStringArray(tokens);
}
public void setArgumentNamesFromStringArray(String[] args) {
public void setArgumentNamesFromStringArray(String... args) {
this.argumentNames = new String[args.length];
for (int i = 0; i < args.length; i++) {
this.argumentNames[i] = StringUtils.trimWhitespace(args[i]);

20
spring-aop/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -40,24 +40,24 @@ public class AspectJExpressionPointcutAdvisor extends AbstractGenericPointcutAdv @@ -40,24 +40,24 @@ public class AspectJExpressionPointcutAdvisor extends AbstractGenericPointcutAdv
this.pointcut.setExpression(expression);
}
public String getExpression() {
return this.pointcut.getExpression();
}
public void setLocation(String location) {
this.pointcut.setLocation(location);
}
public String getLocation() {
return this.pointcut.getLocation();
}
public void setParameterTypes(Class<?>[] types) {
this.pointcut.setParameterTypes(types);
}
public void setParameterNames(String[] names) {
public void setParameterNames(String... names) {
this.pointcut.setParameterNames(names);
}
public String getLocation() {
return this.pointcut.getLocation();
}
public String getExpression() {
return this.pointcut.getExpression();
}
}

4
spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -154,7 +154,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport @@ -154,7 +154,7 @@ public class ProxyFactoryBean extends ProxyCreatorSupport
* @see org.aopalliance.aop.Advice
* @see org.springframework.aop.target.SingletonTargetSource
*/
public void setInterceptorNames(String[] interceptorNames) {
public void setInterceptorNames(String... interceptorNames) {
this.interceptorNames = interceptorNames;
}

4
spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java

@ -175,7 +175,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport @@ -175,7 +175,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
* Ordering is significant: The TargetSource returned from the first matching
* TargetSourceCreator (that is, the first that returns non-null) will be used.
*/
public void setCustomTargetSourceCreators(TargetSourceCreator[] targetSourceCreators) {
public void setCustomTargetSourceCreators(TargetSourceCreator... targetSourceCreators) {
this.customTargetSourceCreators = targetSourceCreators;
}
@ -186,7 +186,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport @@ -186,7 +186,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
* This is perfectly valid, if "specific" interceptors such as matching
* Advisors are all we want.
*/
public void setInterceptorNames(String[] interceptorNames) {
public void setInterceptorNames(String... interceptorNames) {
this.interceptorNames = interceptorNames;
}

4
spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/BeanNameAutoProxyCreator.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -60,7 +60,7 @@ public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator { @@ -60,7 +60,7 @@ public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator {
* @see org.springframework.beans.factory.FactoryBean
* @see org.springframework.beans.factory.BeanFactory#FACTORY_BEAN_PREFIX
*/
public void setBeanNames(String[] beanNames) {
public void setBeanNames(String... beanNames) {
Assert.notEmpty(beanNames, "'beanNames' must not be empty");
this.beanNames = new ArrayList<String>(beanNames.length);
for (String mappedName : beanNames) {

6
spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcut.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -47,7 +47,7 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme @@ -47,7 +47,7 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
* @see #setMappedNames
*/
public void setMappedName(String mappedName) {
setMappedNames(new String[] {mappedName});
setMappedNames(mappedName);
}
/**
@ -55,7 +55,7 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme @@ -55,7 +55,7 @@ public class NameMatchMethodPointcut extends StaticMethodMatcherPointcut impleme
* Matching will be the union of all these; if any match,
* the pointcut matches.
*/
public void setMappedNames(String[] mappedNames) {
public void setMappedNames(String... mappedNames) {
this.mappedNames = new LinkedList<String>();
if (mappedNames != null) {
this.mappedNames.addAll(Arrays.asList(mappedNames));

4
spring-aop/src/main/java/org/springframework/aop/support/NameMatchMethodPointcutAdvisor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -68,7 +68,7 @@ public class NameMatchMethodPointcutAdvisor extends AbstractGenericPointcutAdvis @@ -68,7 +68,7 @@ public class NameMatchMethodPointcutAdvisor extends AbstractGenericPointcutAdvis
* the pointcut matches.
* @see NameMatchMethodPointcut#setMappedNames
*/
public void setMappedNames(String[] mappedNames) {
public void setMappedNames(String... mappedNames) {
this.pointcut.setMappedNames(mappedNames);
}

6
spring-aop/src/main/java/org/springframework/aop/support/RegexpMethodPointcutAdvisor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -98,7 +98,7 @@ public class RegexpMethodPointcutAdvisor extends AbstractGenericPointcutAdvisor @@ -98,7 +98,7 @@ public class RegexpMethodPointcutAdvisor extends AbstractGenericPointcutAdvisor
* @see #setPatterns
*/
public void setPattern(String pattern) {
setPatterns(new String[] {pattern});
setPatterns(pattern);
}
/**
@ -108,7 +108,7 @@ public class RegexpMethodPointcutAdvisor extends AbstractGenericPointcutAdvisor @@ -108,7 +108,7 @@ public class RegexpMethodPointcutAdvisor extends AbstractGenericPointcutAdvisor
* patterns matches, the pointcut matches.
* @see AbstractRegexpMethodPointcut#setPatterns
*/
public void setPatterns(String[] patterns) {
public void setPatterns(String... patterns) {
this.patterns = patterns;
}

4
spring-beans/src/main/java/org/springframework/beans/factory/config/BeanDefinition.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -166,7 +166,7 @@ public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement { @@ -166,7 +166,7 @@ public interface BeanDefinition extends AttributeAccessor, BeanMetadataElement {
* Set the names of the beans that this bean depends on being initialized.
* The bean factory will guarantee that these beans get initialized first.
*/
void setDependsOn(String[] dependsOn);
void setDependsOn(String... dependsOn);
/**
* Return whether this bean is a candidate for getting autowired into some other bean.

2
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java

@ -556,7 +556,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess @@ -556,7 +556,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
* of dependencies like statics (*ugh*) or database preparation on startup.
*/
@Override
public void setDependsOn(String[] dependsOn) {
public void setDependsOn(String... dependsOn) {
this.dependsOn = dependsOn;
}

4
spring-context-support/src/main/java/org/springframework/mail/javamail/ConfigurableMimeFileTypeMap.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -93,7 +93,7 @@ public class ConfigurableMimeFileTypeMap extends FileTypeMap implements Initiali @@ -93,7 +93,7 @@ public class ConfigurableMimeFileTypeMap extends FileTypeMap implements Initiali
* Java Activation Framework, for example:<br>
* {@code text/html html htm HTML HTM}
*/
public void setMappings(String[] mappings) {
public void setMappings(String... mappings) {
this.mappings = mappings;
}

97
spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperation.java vendored

@ -31,9 +31,9 @@ import org.springframework.util.Assert; @@ -31,9 +31,9 @@ import org.springframework.util.Assert;
*/
public abstract class CacheOperation implements BasicOperation {
private Set<String> cacheNames = Collections.emptySet();
private String name = "";
private String condition = "";
private Set<String> cacheNames = Collections.emptySet();
private String key = "";
@ -43,36 +43,16 @@ public abstract class CacheOperation implements BasicOperation { @@ -43,36 +43,16 @@ public abstract class CacheOperation implements BasicOperation {
private String cacheResolver = "";
private String name = "";
@Override
public Set<String> getCacheNames() {
return cacheNames;
}
public String getCondition() {
return condition;
}
public String getKey() {
return key;
}
private String condition = "";
public String getKeyGenerator() {
return keyGenerator;
}
public String getCacheManager() {
return cacheManager;
}
public String getCacheResolver() {
return cacheResolver;
public void setName(String name) {
Assert.hasText(name);
this.name = name;
}
public String getName() {
return name;
return this.name;
}
public void setCacheName(String cacheName) {
@ -80,17 +60,17 @@ public abstract class CacheOperation implements BasicOperation { @@ -80,17 +60,17 @@ public abstract class CacheOperation implements BasicOperation {
this.cacheNames = Collections.singleton(cacheName);
}
public void setCacheNames(String[] cacheNames) {
public void setCacheNames(String... cacheNames) {
this.cacheNames = new LinkedHashSet<String>(cacheNames.length);
for (String cacheName : cacheNames) {
Assert.hasText(cacheName, "Cache name must be set if specified.");
Assert.hasText(cacheName, "Cache name must be non-null if specified");
this.cacheNames.add(cacheName);
}
}
public void setCondition(String condition) {
Assert.notNull(condition);
this.condition = condition;
@Override
public Set<String> getCacheNames() {
return this.cacheNames;
}
public void setKey(String key) {
@ -98,26 +78,47 @@ public abstract class CacheOperation implements BasicOperation { @@ -98,26 +78,47 @@ public abstract class CacheOperation implements BasicOperation {
this.key = key;
}
public String getKey() {
return this.key;
}
public void setKeyGenerator(String keyGenerator) {
Assert.notNull(keyGenerator);
this.keyGenerator = keyGenerator;
}
public String getKeyGenerator() {
return this.keyGenerator;
}
public void setCacheManager(String cacheManager) {
Assert.notNull(cacheManager);
this.cacheManager = cacheManager;
}
public String getCacheManager() {
return this.cacheManager;
}
public void setCacheResolver(String cacheResolver) {
Assert.notNull(cacheManager);
this.cacheResolver = cacheResolver;
}
public void setName(String name) {
Assert.hasText(name);
this.name = name;
public String getCacheResolver() {
return this.cacheResolver;
}
public void setCondition(String condition) {
Assert.notNull(condition);
this.condition = condition;
}
public String getCondition() {
return this.condition;
}
/**
* This implementation compares the {@code toString()} results.
* @see #toString()
@ -152,23 +153,15 @@ public abstract class CacheOperation implements BasicOperation { @@ -152,23 +153,15 @@ public abstract class CacheOperation implements BasicOperation {
* <p>Available to subclasses, for inclusion in their {@code toString()} result.
*/
protected StringBuilder getOperationDescription() {
StringBuilder result = new StringBuilder();
result.append(getClass().getSimpleName());
result.append("[");
result.append(this.name);
result.append("] caches=");
result.append(this.cacheNames);
result.append(" | key='");
result.append(this.key);
result.append("' | keyGenerator='");
result.append(this.keyGenerator);
result.append("' | cacheManager='");
result.append(this.cacheManager);
result.append("' | cacheResolver='");
result.append(this.cacheResolver);
result.append("' | condition='");
result.append(this.condition);
result.append("'");
StringBuilder result = new StringBuilder(getClass().getSimpleName());
result.append("[").append(this.name);
result.append("] caches=").append(this.cacheNames);
result.append(" | key='").append(this.key);
result.append("' | keyGenerator='").append(this.keyGenerator);
result.append("' | cacheManager='").append(this.cacheManager);
result.append("' | cacheResolver='").append(this.cacheResolver);
result.append("' | condition='").append(this.condition).append("'");
return result;
}
}

4
spring-context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java

@ -175,7 +175,7 @@ public class ClassPathBeanDefinitionScanner extends ClassPathScanningCandidateCo @@ -175,7 +175,7 @@ public class ClassPathBeanDefinitionScanner extends ClassPathScanningCandidateCo
* Set the name-matching patterns for determining autowire candidates.
* @param autowireCandidatePatterns the patterns to match against
*/
public void setAutowireCandidatePatterns(String[] autowireCandidatePatterns) {
public void setAutowireCandidatePatterns(String... autowireCandidatePatterns) {
this.autowireCandidatePatterns = autowireCandidatePatterns;
}
@ -232,7 +232,7 @@ public class ClassPathBeanDefinitionScanner extends ClassPathScanningCandidateCo @@ -232,7 +232,7 @@ public class ClassPathBeanDefinitionScanner extends ClassPathScanningCandidateCo
AnnotationConfigUtils.registerAnnotationConfigProcessors(this.registry);
}
return this.registry.getBeanDefinitionCount() - beanCountAtScanStart;
return (this.registry.getBeanDefinitionCount() - beanCountAtScanStart);
}
/**

4
spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableConfigApplicationContext.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -72,7 +72,7 @@ public abstract class AbstractRefreshableConfigApplicationContext extends Abstra @@ -72,7 +72,7 @@ public abstract class AbstractRefreshableConfigApplicationContext extends Abstra
* Set the config locations for this application context.
* <p>If not set, the implementation may use a default as appropriate.
*/
public void setConfigLocations(String[] locations) {
public void setConfigLocations(String... locations) {
if (locations != null) {
Assert.noNullElements(locations, "Config locations must not be null");
this.configLocations = new String[locations.length];

4
spring-context/src/main/java/org/springframework/jmx/export/assembler/MethodExclusionMBeanInfoAssembler.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -68,7 +68,7 @@ public class MethodExclusionMBeanInfoAssembler extends AbstractConfigurableMBean @@ -68,7 +68,7 @@ public class MethodExclusionMBeanInfoAssembler extends AbstractConfigurableMBean
* that bean is found in the {@code ignoredMethodsMappings} property.
* @see #setIgnoredMethodMappings(java.util.Properties)
*/
public void setIgnoredMethods(String[] ignoredMethodNames) {
public void setIgnoredMethods(String... ignoredMethodNames) {
this.ignoredMethods = new HashSet<String>(Arrays.asList(ignoredMethodNames));
}

4
spring-context/src/main/java/org/springframework/jmx/export/metadata/ManagedNotification.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2014 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.
@ -44,7 +44,7 @@ public class ManagedNotification { @@ -44,7 +44,7 @@ public class ManagedNotification {
/**
* Set a list of notification types.
*/
public void setNotificationTypes(String[] notificationTypes) {
public void setNotificationTypes(String... notificationTypes) {
this.notificationTypes = notificationTypes;
}

19
spring-context/src/main/java/org/springframework/jndi/support/SimpleJndiBeanFactory.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -21,7 +21,6 @@ import java.util.HashMap; @@ -21,7 +21,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
@ -75,23 +74,23 @@ public class SimpleJndiBeanFactory extends JndiLocatorSupport implements BeanFac @@ -75,23 +74,23 @@ public class SimpleJndiBeanFactory extends JndiLocatorSupport implements BeanFac
/**
* Set a list of names of shareable JNDI resources,
* Add the name of a shareable JNDI resource,
* which this factory is allowed to cache once obtained.
* @param shareableResources the JNDI names
* @param shareableResource the JNDI name
* (typically within the "java:comp/env/" namespace)
*/
public void setShareableResources(String[] shareableResources) {
this.shareableResources.addAll(Arrays.asList(shareableResources));
public void addShareableResource(String shareableResource) {
this.shareableResources.add(shareableResource);
}
/**
* Add the name of a shareable JNDI resource,
* Set a list of names of shareable JNDI resources,
* which this factory is allowed to cache once obtained.
* @param shareableResource the JNDI name
* @param shareableResources the JNDI names
* (typically within the "java:comp/env/" namespace)
*/
public void addShareableResource(String shareableResource) {
this.shareableResources.add(shareableResource);
public void setShareableResources(String... shareableResources) {
this.shareableResources.addAll(Arrays.asList(shareableResources));
}

2
spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java

@ -291,7 +291,7 @@ public interface JdbcOperations { @@ -291,7 +291,7 @@ public interface JdbcOperations {
* @return an array of the number of rows affected by each statement
* @throws DataAccessException if there is any problem executing the batch
*/
int[] batchUpdate(String[] sql) throws DataAccessException;
int[] batchUpdate(String... sql) throws DataAccessException;
//-------------------------------------------------------------------------

7
spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java

@ -547,10 +547,8 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { @@ -547,10 +547,8 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
@Override
public int[] batchUpdate(final String[] sql) throws DataAccessException {
public int[] batchUpdate(final String... sql) throws DataAccessException {
Assert.notEmpty(sql, "SQL array must not be empty");
if (logger.isDebugEnabled()) {
logger.debug("Executing SQL batch update of " + sql.length + " statements");
}
@ -561,9 +559,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { @@ -561,9 +559,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
@Override
public int[] doInStatement(Statement stmt) throws SQLException, DataAccessException {
int[] rowsAffected = new int[sql.length];
if (JdbcUtils.supportsBatchUpdates(stmt.getConnection())) {
for (String sqlStmt : sql) {
this.currSql = appendSql(this.currSql, sqlStmt);
@ -608,6 +604,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { @@ -608,6 +604,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
return this.currSql;
}
}
return execute(new BatchUpdateStatementCallback());
}

2
spring-jdbc/src/main/java/org/springframework/jdbc/core/PreparedStatementCreatorFactory.java

@ -129,7 +129,7 @@ public class PreparedStatementCreatorFactory { @@ -129,7 +129,7 @@ public class PreparedStatementCreatorFactory {
/**
* Set the column names of the auto-generated keys.
*/
public void setGeneratedKeysColumnNames(String[] names) {
public void setGeneratedKeysColumnNames(String... names) {
this.generatedKeysColumnNames = names;
}

5
spring-jdbc/src/main/java/org/springframework/jdbc/core/metadata/TableMetaDataContext.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2014 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.
@ -22,7 +22,6 @@ import java.util.HashSet; @@ -22,7 +22,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
@ -292,7 +291,7 @@ public class TableMetaDataContext { @@ -292,7 +291,7 @@ public class TableMetaDataContext {
* Build the insert string based on configuration and metadata information
* @return the insert string to be used
*/
public String createInsertString(String[] generatedKeyNames) {
public String createInsertString(String... generatedKeyNames) {
HashSet<String> keys = new HashSet<String>(generatedKeyNames.length);
for (String key : generatedKeyNames) {
keys.add(key.toUpperCase());

18
spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/AbstractJdbcInsert.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -180,26 +180,26 @@ public abstract class AbstractJdbcInsert { @@ -180,26 +180,26 @@ public abstract class AbstractJdbcInsert {
}
/**
* Get the names of any generated keys
* Specify the name of a single generated key column
*/
public String[] getGeneratedKeyNames() {
return this.generatedKeyNames;
public void setGeneratedKeyName(String generatedKeyName) {
checkIfConfigurationModificationIsAllowed();
this.generatedKeyNames = new String[] {generatedKeyName};
}
/**
* Set the names of any generated keys
*/
public void setGeneratedKeyNames(String[] generatedKeyNames) {
public void setGeneratedKeyNames(String... generatedKeyNames) {
checkIfConfigurationModificationIsAllowed();
this.generatedKeyNames = generatedKeyNames;
}
/**
* Specify the name of a single generated key column
* Get the names of any generated keys
*/
public void setGeneratedKeyName(String generatedKeyName) {
checkIfConfigurationModificationIsAllowed();
this.generatedKeyNames = new String[] {generatedKeyName};
public String[] getGeneratedKeyNames() {
return this.generatedKeyNames;
}
/**

4
spring-jdbc/src/main/java/org/springframework/jdbc/object/RdbmsOperation.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -210,7 +210,7 @@ public abstract class RdbmsOperation implements InitializingBean { @@ -210,7 +210,7 @@ public abstract class RdbmsOperation implements InitializingBean {
* Set the column names of the auto-generated keys.
* @see java.sql.Connection#prepareStatement(String, String[])
*/
public void setGeneratedKeysColumnNames(String[] names) {
public void setGeneratedKeysColumnNames(String... names) {
if (isCompiled()) {
throw new InvalidDataAccessApiUsageException(
"The column names for the generated keys must be set before the operation is compiled");

4
spring-jdbc/src/main/java/org/springframework/jdbc/support/CustomSQLErrorCodesTranslation.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2014 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,7 +38,7 @@ public class CustomSQLErrorCodesTranslation { @@ -38,7 +38,7 @@ public class CustomSQLErrorCodesTranslation {
/**
* Set the SQL error codes to match.
*/
public void setErrorCodes(String[] errorCodes) {
public void setErrorCodes(String... errorCodes) {
this.errorCodes = StringUtils.sortStringArray(errorCodes);
}

26
spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLErrorCodes.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -79,7 +79,7 @@ public class SQLErrorCodes { @@ -79,7 +79,7 @@ public class SQLErrorCodes {
* Set this property to specify multiple database names that contains spaces,
* in which case we can not use bean names for lookup.
*/
public void setDatabaseProductNames(String[] databaseProductNames) {
public void setDatabaseProductNames(String... databaseProductNames) {
this.databaseProductNames = databaseProductNames;
}
@ -99,7 +99,7 @@ public class SQLErrorCodes { @@ -99,7 +99,7 @@ public class SQLErrorCodes {
return this.useSqlStateForTranslation;
}
public void setBadSqlGrammarCodes(String[] badSqlGrammarCodes) {
public void setBadSqlGrammarCodes(String... badSqlGrammarCodes) {
this.badSqlGrammarCodes = StringUtils.sortStringArray(badSqlGrammarCodes);
}
@ -107,7 +107,7 @@ public class SQLErrorCodes { @@ -107,7 +107,7 @@ public class SQLErrorCodes {
return this.badSqlGrammarCodes;
}
public void setInvalidResultSetAccessCodes(String[] invalidResultSetAccessCodes) {
public void setInvalidResultSetAccessCodes(String... invalidResultSetAccessCodes) {
this.invalidResultSetAccessCodes = StringUtils.sortStringArray(invalidResultSetAccessCodes);
}
@ -119,11 +119,11 @@ public class SQLErrorCodes { @@ -119,11 +119,11 @@ public class SQLErrorCodes {
return duplicateKeyCodes;
}
public void setDuplicateKeyCodes(String[] duplicateKeyCodes) {
public void setDuplicateKeyCodes(String... duplicateKeyCodes) {
this.duplicateKeyCodes = duplicateKeyCodes;
}
public void setDataIntegrityViolationCodes(String[] dataIntegrityViolationCodes) {
public void setDataIntegrityViolationCodes(String... dataIntegrityViolationCodes) {
this.dataIntegrityViolationCodes = StringUtils.sortStringArray(dataIntegrityViolationCodes);
}
@ -131,7 +131,7 @@ public class SQLErrorCodes { @@ -131,7 +131,7 @@ public class SQLErrorCodes {
return this.dataIntegrityViolationCodes;
}
public void setPermissionDeniedCodes(String[] permissionDeniedCodes) {
public void setPermissionDeniedCodes(String... permissionDeniedCodes) {
this.permissionDeniedCodes = StringUtils.sortStringArray(permissionDeniedCodes);
}
@ -139,7 +139,7 @@ public class SQLErrorCodes { @@ -139,7 +139,7 @@ public class SQLErrorCodes {
return this.permissionDeniedCodes;
}
public void setDataAccessResourceFailureCodes(String[] dataAccessResourceFailureCodes) {
public void setDataAccessResourceFailureCodes(String... dataAccessResourceFailureCodes) {
this.dataAccessResourceFailureCodes = StringUtils.sortStringArray(dataAccessResourceFailureCodes);
}
@ -147,7 +147,7 @@ public class SQLErrorCodes { @@ -147,7 +147,7 @@ public class SQLErrorCodes {
return this.dataAccessResourceFailureCodes;
}
public void setTransientDataAccessResourceCodes(String[] transientDataAccessResourceCodes) {
public void setTransientDataAccessResourceCodes(String... transientDataAccessResourceCodes) {
this.transientDataAccessResourceCodes = StringUtils.sortStringArray(transientDataAccessResourceCodes);
}
@ -155,7 +155,7 @@ public class SQLErrorCodes { @@ -155,7 +155,7 @@ public class SQLErrorCodes {
return this.transientDataAccessResourceCodes;
}
public void setCannotAcquireLockCodes(String[] cannotAcquireLockCodes) {
public void setCannotAcquireLockCodes(String... cannotAcquireLockCodes) {
this.cannotAcquireLockCodes = StringUtils.sortStringArray(cannotAcquireLockCodes);
}
@ -163,7 +163,7 @@ public class SQLErrorCodes { @@ -163,7 +163,7 @@ public class SQLErrorCodes {
return this.cannotAcquireLockCodes;
}
public void setDeadlockLoserCodes(String[] deadlockLoserCodes) {
public void setDeadlockLoserCodes(String... deadlockLoserCodes) {
this.deadlockLoserCodes = StringUtils.sortStringArray(deadlockLoserCodes);
}
@ -171,7 +171,7 @@ public class SQLErrorCodes { @@ -171,7 +171,7 @@ public class SQLErrorCodes {
return this.deadlockLoserCodes;
}
public void setCannotSerializeTransactionCodes(String[] cannotSerializeTransactionCodes) {
public void setCannotSerializeTransactionCodes(String... cannotSerializeTransactionCodes) {
this.cannotSerializeTransactionCodes = StringUtils.sortStringArray(cannotSerializeTransactionCodes);
}
@ -179,7 +179,7 @@ public class SQLErrorCodes { @@ -179,7 +179,7 @@ public class SQLErrorCodes {
return this.cannotSerializeTransactionCodes;
}
public void setCustomTranslations(CustomSQLErrorCodesTranslation[] customTranslations) {
public void setCustomTranslations(CustomSQLErrorCodesTranslation... customTranslations) {
this.customTranslations = customTranslations;
}

2
spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java

@ -230,7 +230,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi @@ -230,7 +230,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
* <p>Setting either this property, {@link #setContextPath "contextPath"}
* or {@link #setClassesToBeBound "classesToBeBound"} is required.
*/
public void setPackagesToScan(String[] packagesToScan) {
public void setPackagesToScan(String... packagesToScan) {
this.packagesToScan = packagesToScan;
}

217
spring-test/src/main/java/org/springframework/test/context/ContextConfigurationAttributes.java

@ -20,6 +20,7 @@ import java.util.Arrays; @@ -20,6 +20,7 @@ import java.util.Arrays;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.annotation.AnnotationAttributes;
@ -44,10 +45,10 @@ public class ContextConfigurationAttributes { @@ -44,10 +45,10 @@ public class ContextConfigurationAttributes {
private final Class<?> declaringClass;
private String[] locations;
private Class<?>[] classes;
private String[] locations;
private final boolean inheritLocations;
private final Class<? extends ContextLoader> contextLoaderClass;
@ -59,42 +60,6 @@ public class ContextConfigurationAttributes { @@ -59,42 +60,6 @@ public class ContextConfigurationAttributes {
private final String name;
/**
* Resolve resource locations from the {@link ContextConfiguration#locations() locations}
* and {@link ContextConfiguration#value() value} attributes of the supplied
* {@link ContextConfiguration} annotation.
*
* @throws IllegalStateException if both the locations and value attributes have been declared
*/
private static String[] resolveLocations(Class<?> declaringClass, ContextConfiguration contextConfiguration) {
return resolveLocations(declaringClass, contextConfiguration.locations(), contextConfiguration.value());
}
/**
* Resolve resource locations from the supplied {@code locations} and
* {@code value} arrays, which correspond to attributes of the same names in
* the {@link ContextConfiguration} annotation.
*
* @throws IllegalStateException if both the locations and value attributes have been declared
*/
private static String[] resolveLocations(Class<?> declaringClass, String[] locations, String[] value) {
Assert.notNull(declaringClass, "declaringClass must not be null");
if (!ObjectUtils.isEmpty(value) && !ObjectUtils.isEmpty(locations)) {
String msg = String.format("Test class [%s] has been configured with @ContextConfiguration's 'value' %s "
+ "and 'locations' %s attributes. Only one declaration of resource "
+ "locations is permitted per @ContextConfiguration annotation.", declaringClass.getName(),
ObjectUtils.nullSafeToString(value), ObjectUtils.nullSafeToString(locations));
logger.error(msg);
throw new IllegalStateException(msg);
}
else if (!ObjectUtils.isEmpty(value)) {
locations = value;
}
return locations;
}
/**
* Construct a new {@link ContextConfigurationAttributes} instance for the
* supplied {@link ContextConfiguration @ContextConfiguration} annotation and
@ -118,11 +83,9 @@ public class ContextConfigurationAttributes { @@ -118,11 +83,9 @@ public class ContextConfigurationAttributes {
*/
@SuppressWarnings("unchecked")
public ContextConfigurationAttributes(Class<?> declaringClass, AnnotationAttributes annAttrs) {
this(
declaringClass,
this(declaringClass,
resolveLocations(declaringClass, annAttrs.getStringArray("locations"), annAttrs.getStringArray("value")),
annAttrs.getClassArray("classes"),
annAttrs.getBoolean("inheritLocations"),
annAttrs.getClassArray("classes"), annAttrs.getBoolean("inheritLocations"),
(Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>[]) annAttrs.getClassArray("initializers"),
annAttrs.getBoolean("inheritInitializers"), annAttrs.getString("name"),
(Class<? extends ContextLoader>) annAttrs.getClass("loader"));
@ -133,7 +96,6 @@ public class ContextConfigurationAttributes { @@ -133,7 +96,6 @@ public class ContextConfigurationAttributes {
* {@linkplain Class test class} that declared the
* {@link ContextConfiguration @ContextConfiguration} annotation and its
* corresponding attributes.
*
* @param declaringClass the test class that declared {@code @ContextConfiguration}
* @param locations the resource locations declared via {@code @ContextConfiguration}
* @param classes the annotated classes declared via {@code @ContextConfiguration}
@ -148,6 +110,7 @@ public class ContextConfigurationAttributes { @@ -148,6 +110,7 @@ public class ContextConfigurationAttributes {
@Deprecated
public ContextConfigurationAttributes(Class<?> declaringClass, String[] locations, Class<?>[] classes,
boolean inheritLocations, Class<? extends ContextLoader> contextLoaderClass) {
this(declaringClass, locations, classes, inheritLocations, null, true, null, contextLoaderClass);
}
@ -167,8 +130,8 @@ public class ContextConfigurationAttributes { @@ -167,8 +130,8 @@ public class ContextConfigurationAttributes {
* @throws IllegalArgumentException if the {@code declaringClass} or {@code contextLoaderClass} is
* {@code null}
*/
public ContextConfigurationAttributes(Class<?> declaringClass, String[] locations, Class<?>[] classes,
boolean inheritLocations,
public ContextConfigurationAttributes(
Class<?> declaringClass, String[] locations, Class<?>[] classes, boolean inheritLocations,
Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>[] initializers,
boolean inheritInitializers, Class<? extends ContextLoader> contextLoaderClass) {
this(declaringClass, locations, classes, inheritLocations, initializers, inheritInitializers, null,
@ -180,7 +143,6 @@ public class ContextConfigurationAttributes { @@ -180,7 +143,6 @@ public class ContextConfigurationAttributes {
* {@linkplain Class test class} that declared the
* {@link ContextConfiguration @ContextConfiguration} annotation and its
* corresponding attributes.
*
* @param declaringClass the test class that declared {@code @ContextConfiguration}
* @param locations the resource locations declared via {@code @ContextConfiguration}
* @param classes the annotated classes declared via {@code @ContextConfiguration}
@ -192,8 +154,8 @@ public class ContextConfigurationAttributes { @@ -192,8 +154,8 @@ public class ContextConfigurationAttributes {
* @throws IllegalArgumentException if the {@code declaringClass} or {@code contextLoaderClass} is
* {@code null}
*/
public ContextConfigurationAttributes(Class<?> declaringClass, String[] locations, Class<?>[] classes,
boolean inheritLocations,
public ContextConfigurationAttributes(
Class<?> declaringClass, String[] locations, Class<?>[] classes, boolean inheritLocations,
Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>[] initializers,
boolean inheritInitializers, String name, Class<? extends ContextLoader> contextLoaderClass) {
@ -219,73 +181,97 @@ public class ContextConfigurationAttributes { @@ -219,73 +181,97 @@ public class ContextConfigurationAttributes {
this.contextLoaderClass = contextLoaderClass;
}
/**
* Get the {@linkplain Class class} that declared the
* {@link ContextConfiguration @ContextConfiguration} annotation.
*
* @return the declaring class; never {@code null}
* Resolve resource locations from the {@link ContextConfiguration#locations() locations}
* and {@link ContextConfiguration#value() value} attributes of the supplied
* {@link ContextConfiguration} annotation.
* @throws IllegalStateException if both the locations and value attributes have been declared
*/
public Class<?> getDeclaringClass() {
return declaringClass;
private static String[] resolveLocations(Class<?> declaringClass, ContextConfiguration contextConfiguration) {
return resolveLocations(declaringClass, contextConfiguration.locations(), contextConfiguration.value());
}
/**
* Get the resource locations that were declared via
* {@link ContextConfiguration @ContextConfiguration}.
*
* <p>Note: this is a mutable property. The returned value may therefore
* represent a <em>processed</em> value that does not match the original value
* declared via {@link ContextConfiguration @ContextConfiguration}.
*
* @return the resource locations; potentially {@code null} or <em>empty</em>
* @see ContextConfiguration#value
* @see ContextConfiguration#locations
* @see #setLocations(String[])
* Resolve resource locations from the supplied {@code locations} and
* {@code value} arrays, which correspond to attributes of the same names in
* the {@link ContextConfiguration} annotation.
* @throws IllegalStateException if both the locations and value attributes have been declared
*/
public String[] getLocations() {
private static String[] resolveLocations(Class<?> declaringClass, String[] locations, String[] value) {
Assert.notNull(declaringClass, "declaringClass must not be null");
if (!ObjectUtils.isEmpty(value) && !ObjectUtils.isEmpty(locations)) {
throw new IllegalStateException(String.format("Test class [%s] has been configured with " +
"@ContextConfiguration's 'value' %s and 'locations' %s attributes. Only one declaration " +
"of resource locations is permitted per @ContextConfiguration annotation.",
declaringClass.getName(), ObjectUtils.nullSafeToString(value), ObjectUtils.nullSafeToString(locations)));
}
else if (!ObjectUtils.isEmpty(value)) {
locations = value;
}
return locations;
}
/**
* Set the <em>processed</em> resource locations, effectively overriding the
* Get the {@linkplain Class class} that declared the
* {@link ContextConfiguration @ContextConfiguration} annotation.
* @return the declaring class (never {@code null})
*/
public Class<?> getDeclaringClass() {
return this.declaringClass;
}
/**
* Set the <em>processed</em> annotated classes, effectively overriding the
* original value declared via {@link ContextConfiguration @ContextConfiguration}.
*
* @see #getLocations()
* @see #getClasses()
*/
public void setLocations(String[] locations) {
this.locations = locations;
public void setClasses(Class<?>... classes) {
this.classes = classes;
}
/**
* Get the annotated classes that were declared via
* {@link ContextConfiguration @ContextConfiguration}.
*
* <p>Note: this is a mutable property. The returned value may therefore
* represent a <em>processed</em> value that does not match the original value
* declared via {@link ContextConfiguration @ContextConfiguration}.
*
* @return the annotated classes; potentially {@code null} or <em>empty</em>
* @see ContextConfiguration#classes
* @see #setClasses(Class[])
*/
public Class<?>[] getClasses() {
return classes;
return this.classes;
}
/**
* Set the <em>processed</em> annotated classes, effectively overriding the
* Set the <em>processed</em> resource locations, effectively overriding the
* original value declared via {@link ContextConfiguration @ContextConfiguration}.
*
* @see #getClasses()
* @see #getLocations()
*/
public void setClasses(Class<?>[] classes) {
this.classes = classes;
public void setLocations(String... locations) {
this.locations = locations;
}
/**
* Get the resource locations that were declared via
* {@link ContextConfiguration @ContextConfiguration}.
* <p>Note: this is a mutable property. The returned value may therefore
* represent a <em>processed</em> value that does not match the original value
* declared via {@link ContextConfiguration @ContextConfiguration}.
* @return the resource locations; potentially {@code null} or <em>empty</em>
* @see ContextConfiguration#value
* @see ContextConfiguration#locations
* @see #setLocations(String[])
*/
public String[] getLocations() {
return this.locations;
}
/**
* Determine if this {@code ContextConfigurationAttributes} instance has
* path-based resource locations.
*
* @return {@code true} if the {@link #getLocations() locations} array is not empty
* @see #hasResources()
* @see #hasClasses()
@ -297,7 +283,6 @@ public class ContextConfigurationAttributes { @@ -297,7 +283,6 @@ public class ContextConfigurationAttributes {
/**
* Determine if this {@code ContextConfigurationAttributes} instance has
* class-based resources.
*
* @return {@code true} if the {@link #getClasses() classes} array is not empty
* @see #hasResources()
* @see #hasLocations()
@ -309,7 +294,6 @@ public class ContextConfigurationAttributes { @@ -309,7 +294,6 @@ public class ContextConfigurationAttributes {
/**
* Determine if this {@code ContextConfigurationAttributes} instance has
* either path-based resource locations or class-based resources.
*
* @return {@code true} if either the {@link #getLocations() locations}
* or the {@link #getClasses() classes} array is not empty
* @see #hasLocations()
@ -322,7 +306,6 @@ public class ContextConfigurationAttributes { @@ -322,7 +306,6 @@ public class ContextConfigurationAttributes {
/**
* Get the {@code inheritLocations} flag that was declared via
* {@link ContextConfiguration @ContextConfiguration}.
*
* @return the {@code inheritLocations} flag
* @see ContextConfiguration#inheritLocations
*/
@ -333,7 +316,6 @@ public class ContextConfigurationAttributes { @@ -333,7 +316,6 @@ public class ContextConfigurationAttributes {
/**
* Get the {@code ApplicationContextInitializer} classes that were declared via
* {@link ContextConfiguration @ContextConfiguration}.
*
* @return the {@code ApplicationContextInitializer} classes
* @since 3.2
*/
@ -344,7 +326,6 @@ public class ContextConfigurationAttributes { @@ -344,7 +326,6 @@ public class ContextConfigurationAttributes {
/**
* Get the {@code inheritInitializers} flag that was declared via
* {@link ContextConfiguration @ContextConfiguration}.
*
* @return the {@code inheritInitializers} flag
* @since 3.2
*/
@ -355,7 +336,6 @@ public class ContextConfigurationAttributes { @@ -355,7 +336,6 @@ public class ContextConfigurationAttributes {
/**
* Get the {@code ContextLoader} class that was declared via
* {@link ContextConfiguration @ContextConfiguration}.
*
* @return the {@code ContextLoader} class
* @see ContextConfiguration#loader
*/
@ -366,7 +346,6 @@ public class ContextConfigurationAttributes { @@ -366,7 +346,6 @@ public class ContextConfigurationAttributes {
/**
* Get the name of the context hierarchy level that was declared via
* {@link ContextConfiguration @ContextConfiguration}.
*
* @return the name of the context hierarchy level or {@code null} if not applicable
* @see ContextConfiguration#name()
* @since 3.2.2
@ -375,24 +354,6 @@ public class ContextConfigurationAttributes { @@ -375,24 +354,6 @@ public class ContextConfigurationAttributes {
return this.name;
}
/**
* Generate a unique hash code for all properties of this
* {@code ContextConfigurationAttributes} instance excluding the
* {@linkplain #getName() name}.
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + declaringClass.hashCode();
result = prime * result + Arrays.hashCode(locations);
result = prime * result + Arrays.hashCode(classes);
result = prime * result + (inheritLocations ? 1231 : 1237);
result = prime * result + Arrays.hashCode(initializers);
result = prime * result + (inheritInitializers ? 1231 : 1237);
result = prime * result + contextLoaderClass.hashCode();
return result;
}
/**
* Determine if the supplied object is equal to this
@ -407,7 +368,6 @@ public class ContextConfigurationAttributes { @@ -407,7 +368,6 @@ public class ContextConfigurationAttributes {
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
@ -415,8 +375,7 @@ public class ContextConfigurationAttributes { @@ -415,8 +375,7 @@ public class ContextConfigurationAttributes {
return false;
}
final ContextConfigurationAttributes that = (ContextConfigurationAttributes) obj;
ContextConfigurationAttributes that = (ContextConfigurationAttributes) obj;
if (this.declaringClass == null) {
if (that.declaringClass != null) {
return false;
@ -425,27 +384,21 @@ public class ContextConfigurationAttributes { @@ -425,27 +384,21 @@ public class ContextConfigurationAttributes {
else if (!this.declaringClass.equals(that.declaringClass)) {
return false;
}
if (!Arrays.equals(this.locations, that.locations)) {
return false;
}
if (!Arrays.equals(this.classes, that.classes)) {
return false;
}
if (this.inheritLocations != that.inheritLocations) {
return false;
}
if (!Arrays.equals(this.initializers, that.initializers)) {
return false;
}
if (this.inheritInitializers != that.inheritInitializers) {
return false;
}
if (this.contextLoaderClass == null) {
if (that.contextLoaderClass != null) {
return false;
@ -454,26 +407,40 @@ public class ContextConfigurationAttributes { @@ -454,26 +407,40 @@ public class ContextConfigurationAttributes {
else if (!this.contextLoaderClass.equals(that.contextLoaderClass)) {
return false;
}
return true;
}
/**
* Generate a unique hash code for all properties of this
* {@code ContextConfigurationAttributes} instance excluding the
* {@linkplain #getName() name}.
*/
@Override
public int hashCode() {
int result = this.declaringClass.hashCode();
result = 31 * result + Arrays.hashCode(this.locations);
result = 31 * result + Arrays.hashCode(this.classes);
result = 31 * result + Arrays.hashCode(this.initializers);
result = 31 * result + this.contextLoaderClass.hashCode();
return result;
}
/**
* Provide a String representation of the context configuration attributes
* and declaring class.
*/
@Override
public String toString() {
return new ToStringCreator(this)//
.append("declaringClass", declaringClass.getName())//
.append("locations", ObjectUtils.nullSafeToString(locations))//
.append("classes", ObjectUtils.nullSafeToString(classes))//
.append("inheritLocations", inheritLocations)//
.append("initializers", ObjectUtils.nullSafeToString(initializers))//
.append("inheritInitializers", inheritInitializers)//
.append("name", name)//
.append("contextLoaderClass", contextLoaderClass.getName())//
.toString();
return new ToStringCreator(this)
.append("declaringClass", this.declaringClass.getName())
.append("locations", ObjectUtils.nullSafeToString(this.locations))
.append("classes", ObjectUtils.nullSafeToString(this.classes))
.append("inheritLocations", this.inheritLocations)
.append("initializers", ObjectUtils.nullSafeToString(this.initializers))
.append("inheritInitializers", this.inheritInitializers)
.append("name", this.name)
.append("contextLoaderClass", this.contextLoaderClass.getName())
.toString();
}
}

4
spring-web/src/main/java/org/springframework/web/context/ConfigurableWebApplicationContext.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -96,7 +96,7 @@ public interface ConfigurableWebApplicationContext extends WebApplicationContext @@ -96,7 +96,7 @@ public interface ConfigurableWebApplicationContext extends WebApplicationContext
* <p>If not set, the implementation is supposed to use a default for the
* given namespace or the root web application context, as appropriate.
*/
void setConfigLocations(String[] configLocations);
void setConfigLocations(String... configLocations);
/**
* Return the config locations for this web application context,

4
spring-web/src/main/java/org/springframework/web/context/support/GenericWebApplicationContext.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -231,7 +231,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext @@ -231,7 +231,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext
}
@Override
public void setConfigLocations(String[] configLocations) {
public void setConfigLocations(String... configLocations) {
if (!ObjectUtils.isEmpty(configLocations)) {
throw new UnsupportedOperationException(
"GenericWebApplicationContext does not support setConfigLocations(). " +

4
spring-web/src/main/java/org/springframework/web/context/support/StaticWebApplicationContext.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -125,7 +125,7 @@ public class StaticWebApplicationContext extends StaticApplicationContext @@ -125,7 +125,7 @@ public class StaticWebApplicationContext extends StaticApplicationContext
* @throws UnsupportedOperationException <b>always</b>
*/
@Override
public void setConfigLocations(String[] configLocations) {
public void setConfigLocations(String... configLocations) {
if (configLocations != null) {
throw new UnsupportedOperationException("StaticWebApplicationContext does not support config locations");
}

4
spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/ConfigurablePortletApplicationContext.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -109,7 +109,7 @@ public interface ConfigurablePortletApplicationContext @@ -109,7 +109,7 @@ public interface ConfigurablePortletApplicationContext
* <p>If not set, the implementation is supposed to use a default for the
* given namespace.
*/
void setConfigLocations(String[] configLocations);
void setConfigLocations(String... configLocations);
/**
* Return the config locations for this web application context,

4
spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/context/StaticPortletApplicationContext.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -156,7 +156,7 @@ public class StaticPortletApplicationContext extends StaticApplicationContext @@ -156,7 +156,7 @@ public class StaticPortletApplicationContext extends StaticApplicationContext
* @throws UnsupportedOperationException <b>always</b>
*/
@Override
public void setConfigLocations(String[] configLocations) {
public void setConfigLocations(String... configLocations) {
if (configLocations != null) {
throw new UnsupportedOperationException("StaticPortletApplicationContext does not support config locations");
}

5
spring-webmvc-portlet/src/main/java/org/springframework/web/portlet/handler/UserRoleAuthorizationInterceptor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2014 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 @@ @@ -17,7 +17,6 @@
package org.springframework.web.portlet.handler;
import java.io.IOException;
import javax.portlet.PortletException;
import javax.portlet.PortletRequest;
import javax.portlet.PortletResponse;
@ -41,7 +40,7 @@ public class UserRoleAuthorizationInterceptor extends HandlerInterceptorAdapter @@ -41,7 +40,7 @@ public class UserRoleAuthorizationInterceptor extends HandlerInterceptorAdapter
* Set the roles that this interceptor should treat as authorized.
* @param authorizedRoles array of role names
*/
public final void setAuthorizedRoles(String[] authorizedRoles) {
public final void setAuthorizedRoles(String... authorizedRoles) {
this.authorizedRoles = authorizedRoles;
}

4
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/UserRoleAuthorizationInterceptor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2014 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,7 +38,7 @@ public class UserRoleAuthorizationInterceptor extends HandlerInterceptorAdapter @@ -38,7 +38,7 @@ public class UserRoleAuthorizationInterceptor extends HandlerInterceptorAdapter
* Set the roles that this interceptor should treat as authorized.
* @param authorizedRoles array of role names
*/
public final void setAuthorizedRoles(String[] authorizedRoles) {
public final void setAuthorizedRoles(String... authorizedRoles) {
this.authorizedRoles = authorizedRoles;
}

4
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/multiaction/ParameterMethodNameResolver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -124,7 +124,7 @@ public class ParameterMethodNameResolver implements MethodNameResolver { @@ -124,7 +124,7 @@ public class ParameterMethodNameResolver implements MethodNameResolver {
* can be considered a logical name only.
* @see #setParamName
*/
public void setMethodParamNames(String[] methodParamNames) {
public void setMethodParamNames(String... methodParamNames) {
this.methodParamNames = methodParamNames;
}

6
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/AbstractControllerUrlHandlerMapping.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -60,7 +60,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect @@ -60,7 +60,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
* e.g. a {@link org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping},
* alongside this ControllerClassNameHandlerMapping for application controllers.
*/
public void setExcludedPackages(String[] excludedPackages) {
public void setExcludedPackages(String... excludedPackages) {
this.excludedPackages = (excludedPackages != null) ?
new HashSet<String>(Arrays.asList(excludedPackages)) : new HashSet<String>();
}
@ -69,7 +69,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect @@ -69,7 +69,7 @@ public abstract class AbstractControllerUrlHandlerMapping extends AbstractDetect
* Specify controller classes that should be excluded from this mapping.
* Any such classes will simply be ignored by this HandlerMapping.
*/
public void setExcludedClasses(Class<?>[] excludedClasses) {
public void setExcludedClasses(Class<?>... excludedClasses) {
this.excludedClasses = (excludedClasses != null) ?
new HashSet<Class<?>>(Arrays.asList(excludedClasses)) : new HashSet<Class<?>>();
}

4
spring-webmvc/src/main/java/org/springframework/web/servlet/support/WebContentGenerator.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -120,7 +120,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport { @@ -120,7 +120,7 @@ public abstract class WebContentGenerator extends WebApplicationObjectSupport {
* <p>Default is GET, HEAD and POST for simple form controller types;
* unrestricted for general controllers and interceptors.
*/
public final void setSupportedMethods(String[] methods) {
public final void setSupportedMethods(String... methods) {
if (methods != null) {
this.supportedMethods = new HashSet<String>(Arrays.asList(methods));
}

4
spring-webmvc/src/main/java/org/springframework/web/servlet/view/ResourceBundleViewResolver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@ -130,7 +130,7 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver @@ -130,7 +130,7 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver
* @see #setBasename
* @see java.util.ResourceBundle#getBundle(String)
*/
public void setBasenames(String[] basenames) {
public void setBasenames(String... basenames) {
this.basenames = basenames;
}

2
spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/AbstractJasperReportsView.java

@ -232,7 +232,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView { @@ -232,7 +232,7 @@ public abstract class AbstractJasperReportsView extends AbstractUrlBasedView {
* @see net.sf.jasperreports.engine.data.JRBeanCollectionDataSource
* @see net.sf.jasperreports.engine.data.JRBeanArrayDataSource
*/
public void setSubReportDataKeys(String[] subReportDataKeys) {
public void setSubReportDataKeys(String... subReportDataKeys) {
this.subReportDataKeys = subReportDataKeys;
}

4
spring-webmvc/src/main/java/org/springframework/web/servlet/view/jasperreports/JasperReportsViewResolver.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 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.
@ -75,7 +75,7 @@ public class JasperReportsViewResolver extends UrlBasedViewResolver { @@ -75,7 +75,7 @@ public class JasperReportsViewResolver extends UrlBasedViewResolver {
* Set the {@code subReportDataKeys} the view class should use.
* @see AbstractJasperReportsView#setSubReportDataKeys
*/
public void setSubReportDataKeys(String[] subReportDataKeys) {
public void setSubReportDataKeys(String... subReportDataKeys) {
this.subReportDataKeys = subReportDataKeys;
}

Loading…
Cancel
Save