Class ResultHolder<T>

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ResultHolder.Multiple<T>
      Container of multiple values of required type
      static class  ResultHolder.Single<T>
      Container of single value of required type
    • Constructor Summary

      Constructors 
      Constructor Description
      ResultHolder​(java.lang.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 holder
      java.lang.Class<T> getRequiredClass()  
      abstract java.util.List<T> getResults()  
      abstract boolean isMultiple()  
      abstract void mapEachResult​(java.util.function.Function<T,​T> consumer)
      calls consumer.accept(value) once for each contained value
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResultHolder

        public ResultHolder​(java.lang.Class<T> requiredClass)
    • Method Detail

      • getRequiredClass

        public java.lang.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​(java.util.function.Function<T,​T> consumer)
        calls consumer.accept(value) once for each contained value
        Parameters:
        consumer -
      • getResults

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