Package com.suse.salt.netapi.utils
Class Xor<L,R>
- java.lang.Object
-
- com.suse.salt.netapi.utils.Xor<L,R>
-
- Type Parameters:
L- type of the left valueR- type of the right value
public abstract class Xor<L,R> extends java.lang.ObjectRight biased disjunction mainly based on the Xor type from scala cats library. This type is used for collecting salt errors that are in the place of a normal result.
-
-
Constructor Summary
Constructors Constructor Description Xor()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidconsume(java.util.function.Consumer<? super L> consumerLeft, java.util.function.Consumer<? super R> consumerRight)abstract booleanexists(java.util.function.Predicate<R> p)abstract <T> Xor<? super L,T>flatMap(java.util.function.Function<? super R,Xor<? super L,T>> mapper)abstract <T> Tfold(java.util.function.Function<? super L,? extends T> mapLeft, java.util.function.Function<? super R,? extends T> mapRight)abstract RgetOrElse(java.util.function.Supplier<? extends R> supplier)abstract booleanisLeft()abstract booleanisRight()abstract java.util.Optional<L>left()static <L,R>
Xor.Left<L,R>left(L value)abstract <T> Xor<L,T>map(java.util.function.Function<? super R,? extends T> mapper)java.util.Optional<R>option()abstract RorElse(R value)abstract java.util.Optional<R>right()static <L,R>
Xor.Right<L,R>right(R value)
-
-
-
Method Detail
-
left
public static <L,R> Xor.Left<L,R> left(L value)
-
right
public static <L,R> Xor.Right<L,R> right(R value)
-
isRight
public abstract boolean isRight()
-
isLeft
public abstract boolean isLeft()
-
fold
public abstract <T> T fold(java.util.function.Function<? super L,? extends T> mapLeft, java.util.function.Function<? super R,? extends T> mapRight)
-
consume
public abstract void consume(java.util.function.Consumer<? super L> consumerLeft, java.util.function.Consumer<? super R> consumerRight)
-
flatMap
public abstract <T> Xor<? super L,T> flatMap(java.util.function.Function<? super R,Xor<? super L,T>> mapper)
-
left
public abstract java.util.Optional<L> left()
-
right
public abstract java.util.Optional<R> right()
-
exists
public abstract boolean exists(java.util.function.Predicate<R> p)
-
option
public final java.util.Optional<R> option()
-
-