Class ResultHolder.Single<T>

java.lang.Object
spoon.pattern.internal.ResultHolder<T>
spoon.pattern.internal.ResultHolder.Single<T>
Type Parameters:
T -
Enclosing class:
ResultHolder<T>

public static class ResultHolder.Single<T> extends ResultHolder<T>
Container of single value of required type
  • Constructor Details

    • Single

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

    • isMultiple

      public boolean isMultiple()
      Specified by:
      isMultiple in class ResultHolder<T>
      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 void addResult(T value)
      Description copied from class: ResultHolder
      adds a result into this result holder
      Specified by:
      addResult in class ResultHolder<T>
      Parameters:
      value - a new value of result holder
    • getResult

      public T getResult()
    • mapEachResult

      public void mapEachResult(Function<T,​T> consumer)
      Description copied from class: ResultHolder
      calls consumer.accept(value) once for each contained value
      Specified by:
      mapEachResult in class ResultHolder<T>
    • getResults

      public List<T> getResults()
      Specified by:
      getResults in class ResultHolder<T>
      Returns:
      List of actually stored results