Class Either<L,​R>

  • Direct Known Subclasses:
    Either3

    public class Either<L,​R>
    extends java.lang.Object
    An either type maps union types in protocol specifications.
    • Constructor Detail

      • Either

        protected Either​(L left,
                         R right)
    • Method Detail

      • forLeft

        public static <L,​R> Either<L,​R> forLeft​(L left)
      • forRight

        public static <L,​R> Either<L,​R> forRight​(R right)
      • getLeft

        public L getLeft()
      • getRight

        public R getRight()
      • get

        public java.lang.Object get()
      • isLeft

        public boolean isLeft()
      • isRight

        public boolean isRight()
      • map

        public <T> T map​(java.util.function.Function<? super L,​? extends T> mapLeft,
                         java.util.function.Function<? super R,​? extends T> mapRight)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getLeftDisjointType

        @Deprecated
        public static java.lang.reflect.Type getLeftDisjointType​(java.lang.reflect.Type type)
        Return a left disjoint type if the given type is either.
      • getRightDisjointType

        @Deprecated
        public static java.lang.reflect.Type getRightDisjointType​(java.lang.reflect.Type type)
        Return a right disjoint type if the given type is either.
      • getAllDisjoinTypes

        @Deprecated
        public static java.util.Collection<java.lang.reflect.Type> getAllDisjoinTypes​(java.lang.reflect.Type type)
        Deprecated.
        Return all disjoint types.
      • collectDisjoinTypes

        @Deprecated
        protected static java.util.Collection<java.lang.reflect.Type> collectDisjoinTypes​(java.lang.reflect.Type type,
                                                                                          java.util.Collection<java.lang.reflect.Type> types)
        Deprecated.
      • collectDisjoinTypes

        @Deprecated
        protected static java.util.Collection<java.lang.reflect.Type> collectDisjoinTypes​(java.lang.reflect.ParameterizedType type,
                                                                                          java.util.Collection<java.lang.reflect.Type> types)
        Deprecated.
      • collectDisjoinTypes

        @Deprecated
        protected static java.util.Collection<java.lang.reflect.Type> collectDisjoinTypes​(java.lang.Class<?> type,
                                                                                          java.util.Collection<java.lang.reflect.Type> types)
        Deprecated.
      • isEither

        @Deprecated
        public static boolean isEither​(java.lang.reflect.Type type)
        Deprecated.
        Test whether the given type is Either.
      • isEither

        @Deprecated
        public static boolean isEither​(java.lang.reflect.ParameterizedType type)
        Deprecated.
        Test whether the given type is Either.
      • isEither

        @Deprecated
        public static boolean isEither​(java.lang.Class<?> cls)
        Deprecated.
        Test whether the given class is Either.