Class OperationAggregator<T,K,R>
- java.lang.Object
-
- com.inductiveautomation.ignition.common.util.OperationAggregator<T,K,R>
-
- All Implemented Interfaces:
java.lang.Iterable<AggregationSet<T,K,R>>
public class OperationAggregator<T,K,R> extends java.lang.Object implements java.lang.Iterable<AggregationSet<T,K,R>>
The OperationAggregator takes a set of objects, splits them up based on keys determined by a KeyProvider, and then aggregates the results back together in the correct order, after some execution has occured.
Parameters: T - Request type K - Key type R - Result type
Usage:- Create new aggregator with correct types.
- Call aggregator.put() with the input list, and a (usually anonymous) implementation of KeyProvider that returns the key for the given input.
- Iterate through the AggregationSet<T,K,R\> now contained in the aggregator, do something.
- Return aggregator.getResults()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
OperationAggregator.AggregationEntry
static interface
OperationAggregator.InputValidator<T,R>
The InputValidator provides a way to validate input values before they get to execution.static interface
OperationAggregator.KeyProvider<T,K>
protected class
OperationAggregator.ValueEntry
-
Constructor Summary
Constructors Constructor Description OperationAggregator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<K>
getKeys()
java.util.List<R>
getResults()
java.util.Iterator<AggregationSet<T,K,R>>
iterator()
void
put(java.util.List<T> values, OperationAggregator.KeyProvider<T,K> provider)
void
put(java.util.List<T> values, OperationAggregator.KeyProvider<T,K> provider, OperationAggregator.InputValidator<T,R> validator)
-
-
-
Field Detail
-
breakup
protected java.util.Map<K,AggregationSet<T,K,R>> breakup
-
-
Method Detail
-
put
public void put(java.util.List<T> values, OperationAggregator.KeyProvider<T,K> provider)
-
put
public void put(java.util.List<T> values, OperationAggregator.KeyProvider<T,K> provider, OperationAggregator.InputValidator<T,R> validator)
-
getResults
public java.util.List<R> getResults()
-
getKeys
public java.util.Set<K> getKeys()
- Returns:
- The
Set
of keys that have been provided to this OperationAggregator.
-
iterator
public java.util.Iterator<AggregationSet<T,K,R>> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
-
-