Package io.vavr

Class API.Match.Pattern1<T,​T1>

  • Type Parameters:
    T - Class type that is matched by this pattern
    T1 - Member type 1 of the composite part this pattern decomposes
    All Implemented Interfaces:
    API.Match.Pattern<T,​T1>, Function1<T,​T1>, PartialFunction<T,​T1>, java.io.Serializable, java.util.function.Function<T,​T1>
    Enclosing class:
    API.Match<T>

    public abstract static class API.Match.Pattern1<T,​T1>
    extends java.lang.Object
    implements API.Match.Pattern<T,​T1>
    A API.Match.Pattern implementation for the pattern with 1 intermediate type
    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        The serial version UID for serialization.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Pattern1

        protected Pattern1()
        Creates a new Pattern1.

        This constructor is protected because Pattern1 is abstract and intended to be subclassed rather than instantiated directly.

    • Method Detail

      • of

        public static <T,​T1 extends U1,​U1> API.Match.Pattern1<T,​T1> of​(@NonNull java.lang.Class<? super T> type,
                                                                                         @NonNull API.Match.Pattern<T1,​?> p1,
                                                                                         @NonNull java.util.function.Function<T,​Tuple1<U1>> unapply)
        Static factory for a API.Match.Pattern1 based on a Class, API.Match.Pattern to decompose it to and a mapper to aggregate result back into a Tuple1
        Type Parameters:
        T - Class type matched by this pattern
        T1 - Member type 1 of the composite part this pattern decomposes
        U1 - Member type 1 of the Tuple the composite part of this pattern decomposes to
        Parameters:
        type - Class to build the pattern from
        p1 - API.Match.Pattern matching the intermediate type 1
        unapply - Mapper function from T to a Tuple1
        Returns:
        new Pattern1