Package spoon.pattern.internal
Class ResultHolder<T>
- java.lang.Object
-
- spoon.pattern.internal.ResultHolder<T>
-
- Direct Known Subclasses:
ResultHolder.Multiple
,ResultHolder.Single
public abstract class ResultHolder<T> extends Object
Container for single or multiple values of required type
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ResultHolder.Multiple<T>
Container of multiple values of required typestatic class
ResultHolder.Single<T>
Container of single value of required type
-
Constructor Summary
Constructors Constructor Description ResultHolder(Class<T> requiredClass)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addResult(T value)
adds a result into this result holderClass<T>
getRequiredClass()
abstract List<T>
getResults()
abstract boolean
isMultiple()
abstract void
mapEachResult(Function<T,T> consumer)
calls consumer.accept(value) once for each contained value
-
-
-
Method Detail
-
getRequiredClass
public Class<T> getRequiredClass()
- Returns:
- the class of values, which acceptable by this result holder
-
isMultiple
public abstract boolean isMultiple()
- Returns:
- true if it accepts 0, 1 or more values. false if it accepts exactly one value. If none, then value is null
-
addResult
public abstract void addResult(T value)
adds a result into this result holder- Parameters:
value
- a new value of result holder
-
mapEachResult
public abstract void mapEachResult(Function<T,T> consumer)
calls consumer.accept(value) once for each contained value- Parameters:
consumer
-
-
-