Class Xor<L,R>

java.lang.Object
com.suse.salt.netapi.utils.Xor<L,R>
Type Parameters:
L - type of the left value
R - type of the right value
Direct Known Subclasses:
Xor.Left, Xor.Right

public abstract class Xor<L,R> extends Object
Right 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 Details

    • Xor

      public Xor()
  • Method Details

    • 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(Function<? super L, ? extends T> mapLeft, Function<? super R, ? extends T> mapRight)
    • consume

      public abstract void consume(Consumer<? super L> consumerLeft, Consumer<? super R> consumerRight)
    • map

      public abstract <T> Xor<L,T> map(Function<? super R, ? extends T> mapper)
    • flatMap

      public abstract <T> Xor<? super L, T> flatMap(Function<? super R, Xor<? super L, T>> mapper)
    • left

      public abstract Optional<L> left()
    • right

      public abstract Optional<R> right()
    • orElse

      public abstract R orElse(R value)
    • getOrElse

      public abstract R getOrElse(Supplier<? extends R> supplier)
    • exists

      public abstract boolean exists(Predicate<R> p)
    • option

      public final Optional<R> option()