Class Stage.Continuation<DATA>

  • Type Parameters:
    DATA - processed data type.
    Enclosing interface:
    Stage<DATA>

    public static final class Stage.Continuation<DATA>
    extends java.lang.Object
    Data processing stage continuation.

    A continuation of a processing stage is a processing result represented by an (optional) stage that should be invoked next and the processed data result.

    • Constructor Summary

      Constructors 
      Constructor Description
      Continuation​(DATA result, Stage<DATA> next)
      Create a new continuation instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()
      Check if there is a next stage present in the continuation.
      Stage<DATA> next()
      Get the stage to be invoked next or null if no next stage is present.
      static <DATA> Stage.Continuation<DATA> of​(DATA result)
      Create a terminal continuation from the processed data result.
      static <DATA> Stage.Continuation<DATA> of​(DATA result, Stage<DATA> next)
      Create a continuation from the processed data result and the stage to be invoked next.
      DATA result()
      Get the data processing result.
      • Methods inherited from class java.lang.Object

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

      • result

        private final DATA result
    • Constructor Detail

      • Continuation

        Continuation​(DATA result,
                     Stage<DATA> next)
        Create a new continuation instance.
        Parameters:
        result - processed data.
        next - next processing stage.
    • Method Detail

      • of

        public static <DATA> Stage.Continuation<DATA> of​(DATA result,
                                                         Stage<DATA> next)
        Create a continuation from the processed data result and the stage to be invoked next.
        Type Parameters:
        DATA - processed data type.
        Parameters:
        result - data processing result.
        next - stage to be invoked next.
        Returns:
        a continuation with the supplied stage to be invoked next in the processing chain and the supplied processing result.
      • of

        public static <DATA> Stage.Continuation<DATA> of​(DATA result)
        Create a terminal continuation from the processed data result.
        Type Parameters:
        DATA - processed data type.
        Parameters:
        result - data processing result.
        Returns:
        terminal continuation with no next stage in the processing chain and the supplied processing result.
      • result

        public DATA result()
        Get the data processing result.
        Returns:
        data processing result.
      • next

        public Stage<DATA> next()
        Get the stage to be invoked next or null if no next stage is present.
        Returns:
        the stage to be invoked next or null if not present.
      • hasNext

        public boolean hasNext()
        Check if there is a next stage present in the continuation.

        The absence of a next stage in the continuation indicates that the data processing reached a terminal stage and the result of the continuation represents the final result of the whole processing chain.

        Returns:
        true if there is a next stage present in the continuation, false otherwise.