Package com.atlassian.confluence.core
Class None<T>
- java.lang.Object
-
- com.atlassian.confluence.core.None<T>
-
- Type Parameters:
T- the typeMaybeis 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- Since:
- 7.0.1
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> io.atlassian.fugue.Maybe<T>becauseOf(String message, Object... args)Constructs aMaybewhich will escape with the given message on acall.Maybe.get()static <T> io.atlassian.fugue.Maybe<T>becauseOfException(Exception exception)Constructs aMaybewhich will escape with the given exception on acall.Maybe.get()static <T> io.atlassian.fugue.Maybe<T>becauseOfNoResult(io.atlassian.fugue.Maybe<?> maybe)Will cast the givenMaybeto one with the expected parametrisation.booleanexists(Predicate<? super T> p)booleanforall(Predicate<? super T> p)voidforeach(io.atlassian.fugue.Effect<? super T> effect)TgetOr(Supplier<? extends T> supplier)<B extends T>
TgetOrElse(B other)TgetOrElse(Supplier<? extends T> supplier)TgetOrError(Supplier<String> msg)TgetOrNull()<X extends Throwable>
TgetOrThrow(Supplier<X> xSupplier)booleanisDefined()booleanisEmpty()@NonNull Iterator<T>iterator()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
becauseOfNoResult
public static <T> io.atlassian.fugue.Maybe<T> becauseOfNoResult(io.atlassian.fugue.Maybe<?> maybe)
Will cast the givenMaybeto one with the expected parametrisation.This has to be
since it is expected to escape on aMaybe.isEmpty()Maybe.get()call.- Parameters:
maybe- to be casted to the target type- Returns:
- the casted
Maybeadhering to the taget type
-
becauseOf
public static <T> io.atlassian.fugue.Maybe<T> becauseOf(String message, Object... args)
Constructs aMaybewhich will escape with the given message on acall.Maybe.get()- Parameters:
message- the message used for the escape, may be formatted for application ofString.format(String, Object...)args- the arguments used for formatting the message, may be null- Returns:
- the
Maybeescaping on realization
-
becauseOfException
public static <T> io.atlassian.fugue.Maybe<T> becauseOfException(Exception exception)
Constructs aMaybewhich will escape with the given exception on acall.Maybe.get()- Parameters:
exception- the exception to be thrown, will be nested in aif it is checkedRuntimeException
-
getOrError
public T getOrError(Supplier<String> msg)
- Specified by:
getOrErrorin interfaceio.atlassian.fugue.Maybe<T>
-
getOr
public T getOr(Supplier<? extends T> supplier)
- Specified by:
getOrin interfaceio.atlassian.fugue.Maybe<T>
-
getOrElse
public T getOrElse(Supplier<? extends T> supplier)
- Specified by:
getOrElsein interfaceio.atlassian.fugue.Maybe<T>
-
getOrThrow
public <X extends Throwable> T getOrThrow(Supplier<X> xSupplier) throws X extends Throwable
-
getOrElse
public <B extends T> T getOrElse(B other)
- Specified by:
getOrElsein interfaceio.atlassian.fugue.Maybe<T>
-
foreach
public void foreach(io.atlassian.fugue.Effect<? super T> effect)
- Specified by:
foreachin interfaceio.atlassian.fugue.Effect.Applicant<T>
-
exists
public boolean exists(Predicate<? super T> p)
- Specified by:
existsin interfaceio.atlassian.fugue.Maybe<T>
-
forall
public boolean forall(Predicate<? super T> p)
- Specified by:
forallin interfaceio.atlassian.fugue.Maybe<T>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceio.atlassian.fugue.Maybe<T>
-
isDefined
public boolean isDefined()
- Specified by:
isDefinedin interfaceio.atlassian.fugue.Maybe<T>
-
-