Class LocalVariables


  • public final class LocalVariables
    extends Object
    A set of named variables that can grow over time. Alternatively, this class could also be called a staged builder for an n-tuple.

    This is intended to be used with CompletionStage to avoid heavy nesting of transformers when values of previous stages are required for dependent stages. For example:

    See the JavaDocs for StageChain for an example how this can simplify code with stages a lot.

    Since:
    8.0.0
    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • next

        public <X1> LocalVariables.L1<X1> next​(X1 x1)
        Type Parameters:
        X1 - Type of the next local variable to add.
        Parameters:
        x1 - The next local variable to add.
        Returns:
        A set of local variables which includes the new one.
      • nextChain

        public <X1,​R> StageChain<LocalVariables.L1<X1>,​R> nextChain​(StageChain<X1,​R> x1)
        Type Parameters:
        X1 - Type of the next local variable to add.
        Parameters:
        x1 - A completion stage that resolves to the next local variable to add.
        Returns:
        A completion stage that resolves to a set of local variables which includes the new one.
      • nextStage

        public <X1> CompletionStage<LocalVariables.L1<X1>> nextStage​(CompletionStage<X1> x1)
        Type Parameters:
        X1 - Type of the next local variable to add.
        Parameters:
        x1 - A completion stage that resolves to the next local variable to add.
        Returns:
        A completion stage that resolves to a set of local variables which includes the new one.
      • empty

        public static LocalVariables empty()
        Returns:
        A new set without any variables.