Class TotalTransform<A,B>

Type Parameters:
A - the target type of the containing pattern
B - the target type of the contained subpattern
All Implemented Interfaces:
Pattern<A>, Serializable, Cloneable

@Generated(generator="eu.bandm.tools.expander", version="", timestamp="2026-01-12T17:56:31") public abstract class TotalTransform<A,B> extends Transform<A,B>
Abstract base class for patterns that delegate transformed targets to a subpattern.

Subclasses must implement the Transform.apply(A) method.

See Also:
  • Constructor Details

    • TotalTransform

      protected TotalTransform(Pattern<? super B> body)
      Creates a new instance.
  • Method Details

    • match

      public boolean match(A target)
      Attempts to match this pattern against a given object.

      If the class of this pattern imposes a specific order on matches, the first one is chosen.

      The null target is generally allowed.

      This implementation matches the subpattern against the result of apply(target).

      Parameters:
      target - the object to match against
      Returns:
      true if the matching is successful, false if it fails. Which Variables are bound by a successful or failed match depends.
      See Also:
    • of

      public static <A, B> TotalTransform<A,B> of(Function<? super A,? extends B> fun, Pattern<? super B> body)
    • with

      public static <A, B> Motif<B,A> with(Function<? super A,? extends B> fun)