Class None<T>

  • Type Parameters:
    T - the type Maybe is wrapping
    All Implemented Interfaces:
    io.atlassian.fugue.Effect.Applicant<T>, io.atlassian.fugue.Maybe<T>, Iterable<T>

    public abstract class None<T>
    extends Object
    implements io.atlassian.fugue.Maybe<T>
    Helps constructing the left, erroneous case of a Maybe.
    • Method Detail

      • becauseOfNoResult

        public static <T> io.atlassian.fugue.Maybe<T> becauseOfNoResult​(io.atlassian.fugue.Maybe<?> maybe)
        Will cast the given Maybe to one with the expected parametrisation.

        This has to be Maybe.isEmpty() since it is expected to escape on a Maybe.get() call.

        maybe - to be casted to the target type
        the casted Maybe adhering to the taget type
      • becauseOf

        public static <T> io.atlassian.fugue.Maybe<T> becauseOf​(String message,
                                                                Object... args)
        Constructs a Maybe which will escape with the given message on a Maybe.get() call.
        message - the message used for the escape, may be formatted for application of String.format(String, Object...)
        args - the arguments used for formatting the message, may be null
        the Maybe escaping on realization
      • becauseOfException

        public static <T> io.atlassian.fugue.Maybe<T> becauseOfException​(Exception exception)
        Constructs a Maybe which will escape with the given exception on a Maybe.get() call.
        exception - the exception to be thrown, will be nested in a RuntimeException if it is checked
      • getOrError

        public T getOrError​(Supplier<String> msg)
        Specified by:
        getOrError in interface io.atlassian.fugue.Maybe<T>
      • getOr

        public T getOr​(Supplier<? extends T> supplier)
        Specified by:
        getOr in interface io.atlassian.fugue.Maybe<T>
      • getOrElse

        public T getOrElse​(Supplier<? extends T> supplier)
        Specified by:
        getOrElse in interface io.atlassian.fugue.Maybe<T>
      • getOrThrow

        public <X extends ThrowableT getOrThrow​(Supplier<X> xSupplier)
                                           throws X extends Throwable
        Specified by:
        getOrThrow in interface io.atlassian.fugue.Maybe<T>
        X extends Throwable
      • getOrElse

        public <B extends TT getOrElse​(B other)
        Specified by:
        getOrElse in interface io.atlassian.fugue.Maybe<T>
      • foreach

        public void foreach​(io.atlassian.fugue.Effect<? super T> effect)
        Specified by:
        foreach in interface io.atlassian.fugue.Effect.Applicant<T>
      • getOrNull

        public T getOrNull()
        Specified by:
        getOrNull in interface io.atlassian.fugue.Maybe<T>
      • exists

        public boolean exists​(Predicate<? super T> p)
        Specified by:
        exists in interface io.atlassian.fugue.Maybe<T>
      • iterator

        public @NonNull Iterator<T> iterator()
        Specified by:
        iterator in interface Iterable<T>
        Specified by:
        iterator in interface io.atlassian.fugue.Maybe<T>
      • forall

        public boolean forall​(Predicate<? super T> p)
        Specified by:
        forall in interface io.atlassian.fugue.Maybe<T>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface io.atlassian.fugue.Maybe<T>
      • isDefined

        public boolean isDefined()
        Specified by:
        isDefined in interface io.atlassian.fugue.Maybe<T>