ArrayCreatingInputMerger
public
final
class
ArrayCreatingInputMerger
extends InputMerger
An InputMerger
that attempts to merge the inputs, creating arrays when necessary. For
each input, we look at each key:
- If this is the first time we encountered the key:
- If it's an array, put it in the output
- If it's a primitive, turn it into a size 1 array and put it in the output
- Else (we have encountered the key before):
- If the value type matches the old value type:
- If they are arrays, concatenate them
- If they are primitives, turn them into a size 2 array
- Else if one is an array and the other is a primitive of that type:
- Make a longer array and concatenate them
- Else throw an
IllegalArgumentException
because the types don't match
Summary
Public methods |
Data
|
merge(List<Data> inputs)
Merges a list of Data and outputs a single Data object.
|
Inherited methods |
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public constructors
public ArrayCreatingInputMerger ()
Public methods
merge
public Data merge (List<Data> inputs)
Merges a list of Data
and outputs a single Data object.
Parameters |
inputs |
List : A list of Data |
Returns |
Data |
The merged output
|