|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.stjs.generator.utils.Option<T>
public abstract class Option<T>
| Constructor Summary | |
|---|---|
Option()
|
|
| Method Summary | ||
|---|---|---|
abstract T |
getOrElse(T defaultValue)
If the option is nonempty returns its value, otherwise returns defaultValue. |
|
abstract T |
getOrNull()
If the option is nonempty returns its value, otherwise returns null. |
|
abstract T |
getOrThrow()
Gets the value of this option. |
|
abstract
|
getOrThrow(E e)
Returns its value if not empty, otherwise throws e. |
|
abstract T |
getOrThrow(String message)
Gets the value of this option. |
|
boolean |
isDefined()
Returns true if the option is a Some(...). |
|
abstract boolean |
isEmpty()
Returns true if the option is the None value. |
|
static
|
none()
Gets the none object for the given type. |
|
static
|
of(T t)
Wraps anything. |
|
static
|
some(T t)
Gets the some object wrapping the given value. |
|
abstract String |
toStringOr(String defaultValue)
|
|
| 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 |
|---|
iterator |
| Constructor Detail |
|---|
public Option()
| Method Detail |
|---|
public abstract T getOrNull()
null.
public abstract T getOrElse(T defaultValue)
defaultValue. Note that
defaultValue is eagerly evaluated.
public abstract T getOrThrow()
IllegalArgumentException is thrown.
public abstract T getOrThrow(String message)
IllegalArgumentException is thrown with the specifed message.
public abstract <E extends Throwable> T getOrThrow(E e)
throws E extends Throwable
e.
E extends Throwablepublic abstract String toStringOr(String defaultValue)
public abstract boolean isEmpty()
true if the option is the None value.
public boolean isDefined()
true if the option is a Some(...).
public static <T> Option<T> none()
T with an unchecked
warning allows to simulate a bottom type in Java.
public static <T> Option<T> some(T t)
public static <T> Option<T> of(T t)
T - t -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||