public class ReturnOrException extends NoStackRuntimeException
| Constructor and Description |
|---|
ReturnOrException(Object value,
Throwable cause) |
ReturnOrException(String message,
Object value,
Throwable cause) |
| Modifier and Type | Method and Description |
|---|---|
@Nullable Throwable |
getException() |
<T,S extends T> |
getOrElse(S elze,
@NotNull Class<T> type)
return elze if type not match
|
<T> T |
getOrElse(T elze)
return elze if null
|
<T> T |
getValue() |
<T> T |
returnOrThrow()
throw the exception if there is, otherwise return a result.
|
<T,S extends T> |
returnOrThrow(S elze,
@NotNull Class<T> type)
throw the exception if there is, otherwise return a result.
|
<T> T |
returnOrThrow(T elze)
throw the exception if there is, otherwise return a result.
|
String |
toString() |
fillInStackTraceaddSuppressed, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace@Nullable public @Nullable Throwable getException()
@Nullable public <T> T getValue()
@Nullable
@Contract(value="!null -> !null")
public <T> T getOrElse(@Nullable
T elze)
@Contract(value="!null,_ -> !null")
public <T,S extends T> T getOrElse(@Nullable
S elze,
@NotNull
@NotNull Class<T> type)
T - type of return valueS - subclass type of Telze - elsetype - type to match@Nullable public <T> T returnOrThrow()
@Contract(value="!null -> !null")
public <T> T returnOrThrow(@Nullable
T elze)
@Nullable
@Contract(value="!null,_ -> !null")
public <T,S extends T> T returnOrThrow(@Nullable
S elze,
@NotNull
@NotNull Class<T> type)
T - type of return valueS - subclass type of Telze - elsetype - type to matchCopyright © 2023. All rights reserved.