Class Transform<A,B>

Type Parameters:
A - the target type of the containing pattern
B - the target type of the contained subpattern
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
RestrictedTransform, TotalTransform

public abstract class Transform<A,B> extends Unary<B,A>
Abstract base class for patterns that delegate transformed targets to a subpattern.

Subclasses must implement the apply(A) and Pattern#isApplicable methods.

See Also:
  • Constructor Details

    • Transform

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

    • apply

      public abstract B apply(A target)
      Transforms a target to be matched into a target for the subpattern.
      Parameters:
      target - the target for this pattern to be matched against.
      Returns:
      a target for Unary.body to be matched against.
    • compileApply

      protected void compileApply(CompilationContext context)