Add constructors with var args/Lists

For classes that have a setter for a List<T> field,
create Constructors that take List<T> and var args of T.

Issue #686
This commit is contained in:
Drummond Dawson
2019-02-21 21:02:01 -05:00
committed by Mahmoud Ben Hassine
parent 968a5b5b2e
commit 15e18e5fcd
5 changed files with 147 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2013 the original author or authors.
* Copyright 2006-2022 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.
@@ -15,6 +15,7 @@
*/
package org.springframework.batch.core.listener;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -30,6 +31,31 @@ public class CompositeChunkListener implements ChunkListener {
private OrderedComposite<ChunkListener> listeners = new OrderedComposite<>();
/**
* Default constrcutor
*/
public CompositeChunkListener() {
}
/**
* Convenience constructor for setting the {@link ChunkListener}s.
*
* @param listeners list of {@link ChunkListener}.
*/
public CompositeChunkListener(List<? extends ChunkListener> listeners) {
setListeners(listeners);
}
/**
* Convenience constructor for setting the {@link ChunkListener}s.
*
* @param listeners array of {@link ChunkListener}.
*/
public CompositeChunkListener(ChunkListener... listeners) {
this(Arrays.asList(listeners));
}
/**
* Public setter for the listeners.
*