Interface Transformer<Input,​Output>

  • Type Parameters:
    Input - input type
    Output - output type
    All Known Subinterfaces:
    GraphTransformer<InputV,​InputE,​Output>
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface Transformer<Input,​Output>

    Interface to apply a transformation on a given input and output

    Since:
    1.0
    Author:
    Andreas Pointner
    • Method Detail

      • applyTransformation

        Output applyTransformation​(Input input)
        Transforms an input into an output
        Parameters:
        input - the input
        Returns:
        the result
      • verificateBefore

        default Transformer<Input,​Output> verificateBefore​(Predicate<Input> inputVerificator)
        Verifies before applying the transformation
        Parameters:
        inputVerificator - input verificator
        Returns:
        a new transformer which calls the verificator first on input only, and then executes the "applyTransformation()" method of this transformer
      • verificateAfter

        default Transformer<Input,​Output> verificateAfter​(BiPredicate<Input,​Output> inputOutputVerificator)
        Verifies after applying the transformation
        Parameters:
        inputOutputVerificator - input-/output verificator
        Returns:
        a new transformer which execute the applyTransformation of this transformer first, and then calls the verificator
      • andThen

        default <NewOutput> Transformer<Input,​NewOutput> andThen​(Transformer<? super Output,​? extends NewOutput> after)
        Applies the current transformer first, and then executes the after transformer
        Type Parameters:
        NewOutput - the new output of the next transformer
        Parameters:
        after - the transformer to be executed next
        Returns:
        a new transformer which apply this transformer first, and then the after transformer
      • andThenConsumeResult

        default Transformer<Input,​Output> andThenConsumeResult​(BiConsumer<Input,​Output> consumer)
        Applies the current transformer first, and then executes the consumer.
        Parameters:
        consumer - the consumer to be executed after the transformation.
        Returns:
        new transformer which execute the applyTransformation of this transformer first, and then calls the consumer