Interface Applier<T>

Type Parameters:
T - the type of the object being transformed.
All Known Subinterfaces:
StringApplier

public interface Applier<T>
Represents a generic applier that allows successive transformations on an object.

Implementations of ObjectApplier enable chaining of UnaryOperator transformations based on an optional priority. After applying a series of operators, the final result can be obtained via the result() method.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Represents the priority levels for transformation operators.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Applier<T>
    apply(UnaryOperator<T> operator)
    Applies the given transformation operator at the default priority (NORMAL).
    @NotNull Applier<T>
    apply(Applier.Priority priority, UnaryOperator<T> operator)
    Applies the given transformation operator with the specified priority.
    static <T> Applier<T>
    prioritized(Applier<T> applier)
    Creates a prioritized ObjectApplier by extracting the result from an existing applier.
    static <T> Applier<T>
    prioritized(T object)
    Creates a prioritized ObjectApplier for the provided object.
    Returns the final result after applying all the transformations.
    static <T> Applier<T>
    simplified(Applier<T> applier)
    Creates a simplified ObjectApplier by extracting the result from an existing applier.
    static <T> Applier<T>
    simplified(T object)
    Creates a simplified ObjectApplier for the provided object.
  • Method Details

    • apply

      @NotNull @NotNull Applier<T> apply(Applier.Priority priority, UnaryOperator<T> operator)
      Applies the given transformation operator with the specified priority.
      Parameters:
      priority - the priority at which to apply the operator.
      operator - the transformation to apply.
      Returns:
      this ObjectApplier instance for chaining.
      Throws:
      NullPointerException - if operator is null.
    • apply

      @NotNull @NotNull Applier<T> apply(UnaryOperator<T> operator)
      Applies the given transformation operator at the default priority (NORMAL).
      Parameters:
      operator - the transformation to apply.
      Returns:
      this ObjectApplier instance for chaining.
      Throws:
      NullPointerException - if operator is null.
    • result

      T result()
      Returns the final result after applying all the transformations.
      Returns:
      the transformed object.
    • simplified

      static <T> Applier<T> simplified(T object)
      Creates a simplified ObjectApplier for the provided object.
      Type Parameters:
      T - the type of the object.
      Parameters:
      object - the object to transform.
      Returns:
      a new instance of a simplified ObjectApplier.
    • simplified

      static <T> Applier<T> simplified(Applier<T> applier)
      Creates a simplified ObjectApplier by extracting the result from an existing applier.
      Type Parameters:
      T - the type of the object.
      Parameters:
      applier - the existing applier.
      Returns:
      a new instance of a simplified ObjectApplier initialized with the result.
    • prioritized

      static <T> Applier<T> prioritized(T object)
      Creates a prioritized ObjectApplier for the provided object.
      Type Parameters:
      T - the type of the object.
      Parameters:
      object - the object to transform.
      Returns:
      a new instance of a prioritized ObjectApplier.
    • prioritized

      static <T> Applier<T> prioritized(Applier<T> applier)
      Creates a prioritized ObjectApplier by extracting the result from an existing applier.
      Type Parameters:
      T - the type of the object.
      Parameters:
      applier - the existing applier.
      Returns:
      a new instance of a prioritized ObjectApplier initialized with the result.