use of eu.ggnet.saft.core.ops.DescriptiveConsumerRunner in project dwoss by gg-net.
the class Ops method staticOf.
/**
* Returns all registered dependent actions for this instance as runners, or an empty list never null.
* <p>
* @param <T>
* @param t this instance as dependent reference
* @param enhancer an optional enhancer
* @return all registered dependent actions for this instance as runners, or an empty list never null.
*/
public static <T> List<DescriptiveConsumerRunner<?>> staticOf(T t, SelectionEnhancer<T> enhancer) {
Stream<DescriptiveConsumerRunner<T>> map = safeNull(REGISTERED_ACTIONS.get(t.getClass())).stream().map(d -> new DescriptiveConsumerRunner<T>(d, t));
List<DescriptiveConsumerRunner<?>> result = map.collect(Collectors.toList());
if (enhancer == null)
return result;
for (Object other : enhancer.enhance(t)) {
for (DescriptiveConsumer otherAction : safeNull(REGISTERED_ACTIONS.get(other.getClass()))) {
result.add(new DescriptiveConsumerRunner<>(otherAction, other));
}
}
return result;
}
Aggregations