public class EitherTypeAdapter<L,R> extends com.google.gson.TypeAdapter<Either<L,R>>
Modifier and Type | Class and Description |
---|---|
protected static class |
EitherTypeAdapter.EitherTypeArgument<T> |
static class |
EitherTypeAdapter.Factory |
static class |
EitherTypeAdapter.ListChecker
A predicate for the case that a type alternative is a list.
|
static class |
EitherTypeAdapter.PropertyChecker
A predicate that is usedful for checking alternatives in case both the left and the right type
are JSON object types.
|
Modifier and Type | Field and Description |
---|---|
protected EitherTypeAdapter.EitherTypeArgument<L> |
left |
protected java.util.function.Predicate<com.google.gson.JsonElement> |
leftChecker |
protected EitherTypeAdapter.EitherTypeArgument<R> |
right |
protected java.util.function.Predicate<com.google.gson.JsonElement> |
rightChecker |
protected com.google.gson.reflect.TypeToken<Either<L,R>> |
typeToken |
Constructor and Description |
---|
EitherTypeAdapter(com.google.gson.Gson gson,
com.google.gson.reflect.TypeToken<Either<L,R>> typeToken) |
EitherTypeAdapter(com.google.gson.Gson gson,
com.google.gson.reflect.TypeToken<Either<L,R>> typeToken,
java.util.function.Predicate<com.google.gson.JsonElement> leftChecker,
java.util.function.Predicate<com.google.gson.JsonElement> rightChecker) |
Modifier and Type | Method and Description |
---|---|
protected Either<L,R> |
create(com.google.gson.stream.JsonToken nextToken,
com.google.gson.stream.JsonReader in) |
protected Either<L,R> |
createLeft(L obj) |
protected Either<L,R> |
createRight(R obj) |
Either<L,R> |
read(com.google.gson.stream.JsonReader in) |
void |
write(com.google.gson.stream.JsonWriter out,
Either<L,R> value) |
protected final EitherTypeAdapter.EitherTypeArgument<L> left
protected final EitherTypeAdapter.EitherTypeArgument<R> right
protected final java.util.function.Predicate<com.google.gson.JsonElement> leftChecker
protected final java.util.function.Predicate<com.google.gson.JsonElement> rightChecker
public EitherTypeAdapter(com.google.gson.Gson gson, com.google.gson.reflect.TypeToken<Either<L,R>> typeToken)
public void write(com.google.gson.stream.JsonWriter out, Either<L,R> value) throws java.io.IOException
protected Either<L,R> create(com.google.gson.stream.JsonToken nextToken, com.google.gson.stream.JsonReader in) throws java.io.IOException
java.io.IOException
protected Either<L,R> createLeft(L obj) throws java.io.IOException
java.io.IOException