Change signatures to make use of Java 5 varargs

Issues: SWF-1532
This commit is contained in:
Phillip Webb
2012-04-05 16:23:38 -07:00
parent 53384adca9
commit 54a300e009
23 changed files with 39 additions and 39 deletions

View File

@@ -36,7 +36,7 @@ public class CompositeStringExpression implements Expression {
* @param expressions the ordered set of expressions that when evaluated will have their results stringed together
* to build the composite string
*/
public CompositeStringExpression(Expression[] expressions) {
public CompositeStringExpression(Expression... expressions) {
this.expressions = expressions;
}

View File

@@ -99,7 +99,7 @@ public class FluentParserContext implements ParserContext {
* @param variables the expression variables
* @return this
*/
public FluentParserContext variables(ExpressionVariable[] variables) {
public FluentParserContext variables(ExpressionVariable... variables) {
expressionVariables.addAll(Arrays.asList(variables));
return this;
}

View File

@@ -117,7 +117,7 @@ public class MessageBuilder {
* @param codes the message codes; if null, no changes will be made
* @return this, for fluent API usage
*/
public MessageBuilder codes(String[] codes) {
public MessageBuilder codes(String... codes) {
if (codes == null) {
return this;
}
@@ -142,7 +142,7 @@ public class MessageBuilder {
* @param args the message argument values, if null no changes will be made
* @return this, for fluent API usage
*/
public MessageBuilder args(Object[] args) {
public MessageBuilder args(Object... args) {
if (args == null) {
return this;
}
@@ -169,7 +169,7 @@ public class MessageBuilder {
* @param args the resolvable message arguments
* @return this, for fluent API usage
*/
public MessageBuilder resolvableArgs(Object[] args) {
public MessageBuilder resolvableArgs(Object... args) {
if (args == null) {
return this;
}

View File

@@ -58,7 +58,7 @@ public class MethodKey implements Serializable {
* @param methodName the method name
* @param parameterTypes the method's parameter types, or <code>null</code> if the method has no parameters
*/
public MethodKey(Class<?> declaredType, String methodName, Class<?>[] parameterTypes) {
public MethodKey(Class<?> declaredType, String methodName, Class<?>... parameterTypes) {
Assert.notNull(declaredType, "The method's declared type is required");
Assert.notNull(methodName, "The method name is required");
this.declaredType = declaredType;

View File

@@ -65,7 +65,7 @@ public class Parameters {
* Create a parameter list from the parameter array.
* @param parameters the parameters
*/
public Parameters(Parameter[] parameters) {
public Parameters(Parameter... parameters) {
this.parameters = new ArrayList<Parameter>(parameters.length);
addAll(parameters);
}
@@ -82,7 +82,7 @@ public class Parameters {
* Add new parameters to this list.
* @param parameters the parameters
*/
public boolean addAll(Parameter[] parameters) {
public boolean addAll(Parameter... parameters) {
return this.parameters.addAll(Arrays.asList(parameters));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2004-2010 the original author or authors.
* Copyright 2004-2012 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.
@@ -161,7 +161,7 @@ public class FlowApplication extends Application {
return delegate.createConverter(targetClass);
}
public MethodBinding createMethodBinding(String ref, Class<?>[] params) throws ReferenceSyntaxException {
public MethodBinding createMethodBinding(String ref, Class<?>... params) throws ReferenceSyntaxException {
return delegate.createMethodBinding(ref, params);
}

View File

@@ -83,7 +83,7 @@ public class FlowActionListenerTests extends TestCase {
return String.class;
}
public Object invoke(FacesContext context, Object[] args) throws EvaluationException, MethodNotFoundException {
public Object invoke(FacesContext context, Object... args) throws EvaluationException, MethodNotFoundException {
return this.result;
}

View File

@@ -141,7 +141,7 @@ public class MockApplication extends Application {
return null;
}
public MethodBinding createMethodBinding(String ref, Class<?>[] params) throws ReferenceSyntaxException {
public MethodBinding createMethodBinding(String ref, Class<?>... params) throws ReferenceSyntaxException {
return null;
}

View File

@@ -62,7 +62,7 @@ public class CompositeAction extends AbstractAction {
* Create a composite action composed of given actions.
* @param actions the actions
*/
public CompositeAction(Action[] actions) {
public CompositeAction(Action... actions) {
Assert.notEmpty(actions, "At least one action is required");
this.actions = actions;
}

View File

@@ -64,7 +64,7 @@ class DispatchMethodInvoker {
* @param target the target to dispatch to
* @param parameterTypes the parameter types defining the argument signature of the dispatch methods
*/
public DispatchMethodInvoker(Object target, Class<?>[] parameterTypes) {
public DispatchMethodInvoker(Object target, Class<?>... parameterTypes) {
Assert.notNull(target, "The target of a dispatch method invocation is required");
this.target = target;
this.parameterTypes = parameterTypes;
@@ -92,7 +92,7 @@ class DispatchMethodInvoker {
* @throws MethodLookupException when the method cannot be resolved
* @throws Exception when the invoked method throws an exception
*/
public Object invoke(String methodName, Object[] arguments) throws MethodLookupException, Exception {
public Object invoke(String methodName, Object... arguments) throws MethodLookupException, Exception {
try {
Method dispatchMethod = getDispatchMethod(methodName);
return dispatchMethod.invoke(target, arguments);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2004-2008 the original author or authors.
* Copyright 2004-2012 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 RenderAction extends AbstractAction {
* Creates a new render action.
* @param fragmentExpressions the set of expressions to resolve the view fragments to render
*/
public RenderAction(Expression[] fragmentExpressions) {
public RenderAction(Expression... fragmentExpressions) {
if (fragmentExpressions == null || fragmentExpressions.length == 0) {
throw new IllegalArgumentException(
"You must provide at least one fragment expression to this render action");
@@ -59,4 +59,4 @@ public class RenderAction extends AbstractAction {
public String toString() {
return new ToStringCreator(this).append("fragments", fragmentExpressions).toString();
}
}
}

View File

@@ -85,14 +85,14 @@ class FlowRegistryFactoryBean implements FactoryBean<FlowDefinitionRegistry>, Be
* Flow definitions defined in external files that should be registered in the registry produced by this factory
* bean.
*/
public void setFlowLocations(FlowLocation[] flowLocations) {
public void setFlowLocations(FlowLocation... flowLocations) {
this.flowLocations = flowLocations;
}
/**
* Resolvable path patterns to flows to register in the registry produced by this factory bean.
*/
public void setFlowLocationPatterns(String[] flowLocationPatterns) {
public void setFlowLocationPatterns(String... flowLocationPatterns) {
this.flowLocationPatterns = flowLocationPatterns;
}
@@ -100,7 +100,7 @@ class FlowRegistryFactoryBean implements FactoryBean<FlowDefinitionRegistry>, Be
* Java {@link FlowBuilder flow builder} classes that should be registered in the registry produced by this factory
* bean.
*/
public void setFlowBuilders(FlowBuilderInfo[] flowBuilders) {
public void setFlowBuilders(FlowBuilderInfo... flowBuilders) {
this.flowBuilders = flowBuilders;
}

View File

@@ -78,7 +78,7 @@ public class CollectionUtils {
* @param objects the objects to add
* @return whether or not the target collection changed
*/
public static <T> boolean addAllNoDuplicates(List<T> target, T[] objects) {
public static <T> boolean addAllNoDuplicates(List<T> target, T... objects) {
if (objects == null || objects.length == 0) {
return false;
} else {
@@ -137,4 +137,4 @@ public class CollectionUtils {
throw new UnsupportedOperationException("Not supported");
}
}
}
}

View File

@@ -59,7 +59,7 @@ public class ActionList implements Iterable<Action> {
* @param actions the actions to add
* @return true if this list's contents changed as a result of the add operation
*/
public boolean addAll(Action[] actions) {
public boolean addAll(Action... actions) {
if (actions == null) {
return false;
}

View File

@@ -369,7 +369,7 @@ public class Flow extends AnnotatedObject implements FlowDefinition {
* Adds flow variables.
* @param variables the variables
*/
public void addVariables(FlowVariable[] variables) {
public void addVariables(FlowVariable... variables) {
if (variables == null) {
return;
}

View File

@@ -56,7 +56,7 @@ public class FlowExecutionExceptionHandlerSet {
* @param exceptionHandlers the exception handlers to add
* @return true if this set's contents changed as a result of the add operation
*/
public boolean addAll(FlowExecutionExceptionHandler[] exceptionHandlers) {
public boolean addAll(FlowExecutionExceptionHandler... exceptionHandlers) {
return CollectionUtils.addAllNoDuplicates(this.exceptionHandlers, exceptionHandlers);
}

View File

@@ -55,7 +55,7 @@ public class TransitionSet implements Iterable<Transition> {
* @param transitions the transitions to add
* @return true if this set's contents changed as a result of the add operation
*/
public boolean addAll(Transition[] transitions) {
public boolean addAll(Transition... transitions) {
return CollectionUtils.addAllNoDuplicates(this.transitions, transitions);
}

View File

@@ -96,7 +96,7 @@ public class ViewState extends TransitionableState {
* Adds a set of view variables.
* @param variables the variables
*/
public void addVariables(ViewVariable[] variables) {
public void addVariables(ViewVariable... variables) {
for (ViewVariable variable : variables) {
addVariable(variable);
}

View File

@@ -56,7 +56,7 @@ class FlowExecutionListeners {
* Create a flow execution listener helper that wraps the specified listener array.
* @param listeners the listener array
*/
public FlowExecutionListeners(FlowExecutionListener[] listeners) {
public FlowExecutionListeners(FlowExecutionListener... listeners) {
if (listeners != null) {
this.listeners = listeners;
} else {

View File

@@ -66,7 +66,7 @@ public class ActionTransitionCriteria implements TransitionCriteria {
* false otherwise).
* @param trueEventIds the true result event IDs
*/
public void setTrueEventIds(String[] trueEventIds) {
public void setTrueEventIds(String... trueEventIds) {
this.trueEventIds = trueEventIds;
}
@@ -91,4 +91,4 @@ public class ActionTransitionCriteria implements TransitionCriteria {
}
return false;
}
}
}

View File

@@ -49,7 +49,7 @@ public class TransitionCriteriaChain implements TransitionCriteria {
* Creates a transition criteria chain with the specified criteria.
* @param criteria the criteria
*/
public TransitionCriteriaChain(TransitionCriteria[] criteria) {
public TransitionCriteriaChain(TransitionCriteria... criteria) {
criteriaChain.addAll(Arrays.asList(criteria));
}
@@ -82,7 +82,7 @@ public class TransitionCriteriaChain implements TransitionCriteria {
* Create a transition criteria chain chaining given list of actions.
* @param actions the actions (and their execution properties) to chain together
*/
public static TransitionCriteria criteriaChainFor(Action[] actions) {
public static TransitionCriteria criteriaChainFor(Action... actions) {
if (actions == null || actions.length == 0) {
return WildcardTransitionCriteria.INSTANCE;
}

View File

@@ -64,7 +64,7 @@ public class FlowExecutionListenerCriteriaFactory {
* Returns a criteria that just matches a flow if it is identified by one of the specified ids.
* @param flowIds the flow ids to match
*/
public FlowExecutionListenerCriteria flows(String[] flowIds) {
public FlowExecutionListenerCriteria flows(String... flowIds) {
return new FlowIdFlowExecutionListenerCriteria(flowIds);
}
@@ -96,7 +96,7 @@ public class FlowExecutionListenerCriteriaFactory {
* Create a new flow id matching flow execution listener criteria implementation.
* @param flowIds the flow ids to match
*/
public FlowIdFlowExecutionListenerCriteria(String[] flowIds) {
public FlowIdFlowExecutionListenerCriteria(String... flowIds) {
Assert.notEmpty(flowIds, "The flow id array is required");
this.flowIds = flowIds;
}
@@ -114,4 +114,4 @@ public class FlowExecutionListenerCriteriaFactory {
return new ToStringCreator(this).append("flowIds", StylerUtils.style(flowIds)).toString();
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2004-2008 the original author or authors.
* Copyright 2004-2012 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 final class StaticFlowExecutionListenerLoader implements FlowExecutionLis
* should not attempt to modify the passed in array as no deep copy is made.
* @param listeners the listener array.
*/
public StaticFlowExecutionListenerLoader(FlowExecutionListener[] listeners) {
public StaticFlowExecutionListenerLoader(FlowExecutionListener... listeners) {
Assert.notNull(listeners, "The flow execution listener array is required");
this.listeners = listeners;
}
@@ -67,4 +67,4 @@ public final class StaticFlowExecutionListenerLoader implements FlowExecutionLis
public FlowExecutionListener[] getListeners(FlowDefinition flowDefinition) {
return listeners;
}
}
}