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
  • Constructor Details

    • ResultHolder

      public ResultHolder(Class<T> requiredClass)
  • Method Details

    • 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 -
    • getResults

      public abstract List<T> getResults()
      Returns:
      List of actually stored results