Class Either<L,R>
- java.lang.Object
-
- org.eclipse.lsp4j.jsonrpc.messages.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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static java.util.Collection<java.lang.reflect.Type>
collectDisjoinTypes(java.lang.Class<?> type, java.util.Collection<java.lang.reflect.Type> types)
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.protected static java.util.Collection<java.lang.reflect.Type>
collectDisjoinTypes(java.lang.reflect.Type type, java.util.Collection<java.lang.reflect.Type> types)
Deprecated.boolean
equals(java.lang.Object obj)
static <L,R>
Either<L,R>forLeft(L left)
static <L,R>
Either<L,R>forRight(R right)
java.lang.Object
get()
static java.util.Collection<java.lang.reflect.Type>
getAllDisjoinTypes(java.lang.reflect.Type type)
Deprecated.UseTypeUtils.getExpectedTypes(Type)
insteadL
getLeft()
static java.lang.reflect.Type
getLeftDisjointType(java.lang.reflect.Type type)
Deprecated.UseTypeUtils.getElementTypes(Type, Class, Class)
insteadR
getRight()
static java.lang.reflect.Type
getRightDisjointType(java.lang.reflect.Type type)
Deprecated.UseTypeUtils.getElementTypes(Type, Class, Class)
insteadint
hashCode()
static boolean
isEither(java.lang.Class<?> cls)
Deprecated.UseTypeUtils.isEither(Type)
insteadstatic boolean
isEither(java.lang.reflect.ParameterizedType type)
Deprecated.UseTypeUtils.isEither(Type)
insteadstatic boolean
isEither(java.lang.reflect.Type type)
Deprecated.UseTypeUtils.isEither(Type)
insteadboolean
isLeft()
boolean
isRight()
<T> T
map(java.util.function.Function<? super L,? extends T> mapLeft, java.util.function.Function<? super R,? extends T> mapRight)
java.lang.String
toString()
-
-
-
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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getLeftDisjointType
@Deprecated public static java.lang.reflect.Type getLeftDisjointType(java.lang.reflect.Type type)
Deprecated.UseTypeUtils.getElementTypes(Type, Class, Class)
insteadReturn a left disjoint type if the given type is either.
-
getRightDisjointType
@Deprecated public static java.lang.reflect.Type getRightDisjointType(java.lang.reflect.Type type)
Deprecated.UseTypeUtils.getElementTypes(Type, Class, Class)
insteadReturn 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.UseTypeUtils.getExpectedTypes(Type)
insteadReturn 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.UseTypeUtils.isEither(Type)
insteadTest whether the given type is Either.
-
isEither
@Deprecated public static boolean isEither(java.lang.reflect.ParameterizedType type)
Deprecated.UseTypeUtils.isEither(Type)
insteadTest whether the given type is Either.
-
isEither
@Deprecated public static boolean isEither(java.lang.Class<?> cls)
Deprecated.UseTypeUtils.isEither(Type)
insteadTest whether the given class is Either.
-
-