クラス Try
java.lang.Object
org.nkjmlab.util.java.function.Try
-
ネストされたクラスの概要
修飾子とタイプクラス説明static interface
static interface
static interface
static interface
static interface
-
メソッドの概要
修飾子とタイプメソッド説明static <T,
S> BiConsumer<T, S> createBiConsumer
(Try.ThrowableBiConsumer<T, S> onTry, Consumer<Exception> exceptionConsumer) static <T,
S, X extends RuntimeException>
BiConsumer<T,S> createBiConsumerWithThrow
(Try.ThrowableBiConsumer<T, S> onTry, Function<Exception, ? extends X> exeptionThrower) static <T,
R> Consumer<T> createConsumer
(Try.ThrowableConsumer<T> onTry, Consumer<Exception> exceptionConsumer) static <T,
X extends RuntimeException>
Consumer<T>createConsumerWithThrow
(Try.ThrowableConsumer<T> onTry, Function<Exception, ? extends X> exeptionThrower) static <T,
R> Function<T, R> createFunction
(Try.ThrowableFunction<T, R> onTry, Function<Exception, R> exceptionHandler) static <T,
R, X extends RuntimeException>
Function<T,R> createFunctionWithThrow
(Try.ThrowableFunction<T, R> onTry, Function<Exception, ? extends X> exceptionThrower) static Runnable
createRunnable
(Try.ThrowableRunnable onTry, Consumer<Exception> exceptionConsumer) static <X extends RuntimeException>
RunnablecreateRunnableWithThrow
(Try.ThrowableRunnable onTry, Function<Exception, ? extends X> exceptionThrower) static <T> Supplier<T>
createSupplier
(Try.ThrowableSupplier<T> onTry, Function<Exception, T> exceptionHandler) static <T,
X extends RuntimeException>
Supplier<T>createSupplierWithThrow
(Try.ThrowableSupplier<T> onTry, Function<Exception, ? extends X> exceptionThrower) static <T> T
getOrElse
(Try.ThrowableSupplier<T> onTry, T other) Tries to get a value or gets other value if an exception occurs.static <T,
X extends RuntimeException>
TgetOrElseGet
(Try.ThrowableSupplier<T> onTry, Function<Exception, T> ohterSupplier) Tries to get a value or get other value if an exception occurs..static <T> T
getOrElseNull
(Try.ThrowableSupplier<T> onTry) Tries to get a value or gets null if an exception occurs.static <T,
X extends RuntimeException>
TgetOrElseThrow
(Try.ThrowableSupplier<T> onTry, Function<Exception, ? extends X> exceptionSupplier) Tries to get a value or throws an exception if an exception occurs.static <T extends Throwable>
RuntimeExceptionRethrows an exception.static void
runOrElseDo
(Try.ThrowableRunnable onTry, Consumer<Exception> exceptionHandler) Tries to run and applies the exception handler if an exception occurs.static <T,
X extends RuntimeException>
voidrunOrElseThrow
(Try.ThrowableRunnable onTry, Function<Exception, ? extends X> exceptionThrower) Tries to run and applies the exception thrower if an exception occurs.
-
メソッドの詳細
-
createBiConsumer
public static <T,S> BiConsumer<T,S> createBiConsumer(Try.ThrowableBiConsumer<T, S> onTry, Consumer<Exception> exceptionConsumer) - 型パラメータ:
T
-S
-- パラメータ:
onTry
-exceptionConsumer
-- 戻り値:
-
createBiConsumerWithThrow
public static <T,S, BiConsumer<T,X extends RuntimeException> S> createBiConsumerWithThrow(Try.ThrowableBiConsumer<T, S> onTry, Function<Exception, throws X? extends X> exeptionThrower) - 型パラメータ:
T
-S
-X
-- パラメータ:
onTry
-exeptionThrower
-- 戻り値:
- 例外:
X
-
createConsumer
public static <T,R> Consumer<T> createConsumer(Try.ThrowableConsumer<T> onTry, Consumer<Exception> exceptionConsumer) - 型パラメータ:
T
-R
-- パラメータ:
onTry
-exceptionConsumer
-- 戻り値:
-
createConsumerWithThrow
public static <T,X extends RuntimeException> Consumer<T> createConsumerWithThrow(Try.ThrowableConsumer<T> onTry, Function<Exception, ? extends X> exeptionThrower) throws X- 型パラメータ:
T
-X
-- パラメータ:
onTry
-exeptionThrower
-- 戻り値:
- 例外:
X
-
createFunction
public static <T,R> Function<T,R> createFunction(Try.ThrowableFunction<T, R> onTry, Function<Exception, R> exceptionHandler) - 型パラメータ:
T
-R
-- パラメータ:
onTry
-exceptionHandler
-- 戻り値:
-
createFunctionWithThrow
public static <T,R, Function<T,X extends RuntimeException> R> createFunctionWithThrow(Try.ThrowableFunction<T, R> onTry, Function<Exception, throws X? extends X> exceptionThrower) - 型パラメータ:
T
-R
-X
-- パラメータ:
onTry
-exceptionThrower
-- 戻り値:
- 例外:
X
-
createRunnable
public static Runnable createRunnable(Try.ThrowableRunnable onTry, Consumer<Exception> exceptionConsumer) - パラメータ:
onTry
-exceptionConsumer
-- 戻り値:
-
createRunnableWithThrow
public static <X extends RuntimeException> Runnable createRunnableWithThrow(Try.ThrowableRunnable onTry, Function<Exception, ? extends X> exceptionThrower) throws X- 型パラメータ:
X
-- パラメータ:
onTry
-exceptionThrower
-- 戻り値:
- 例外:
X
-
createSupplier
public static <T> Supplier<T> createSupplier(Try.ThrowableSupplier<T> onTry, Function<Exception, T> exceptionHandler) - 型パラメータ:
T
-- パラメータ:
onTry
-exceptionHandler
-- 戻り値:
-
createSupplierWithThrow
public static <T,X extends RuntimeException> Supplier<T> createSupplierWithThrow(Try.ThrowableSupplier<T> onTry, Function<Exception, ? extends X> exceptionThrower) throws X- 型パラメータ:
T
-X
-- パラメータ:
onTry
-exceptionThrower
-- 戻り値:
- 例外:
X
-
getOrElse
Tries to get a value or gets other value if an exception occurs.- 型パラメータ:
T
-- パラメータ:
onTry
-other
-- 戻り値:
-
getOrElseGet
public static <T,X extends RuntimeException> T getOrElseGet(Try.ThrowableSupplier<T> onTry, Function<Exception, T> ohterSupplier) Tries to get a value or get other value if an exception occurs..- 型パラメータ:
T
-X
-- パラメータ:
onTry
-ohterSupplier
-- 戻り値:
-
getOrElseThrow
public static <T,X extends RuntimeException> T getOrElseThrow(Try.ThrowableSupplier<T> onTry, Function<Exception, ? extends X> exceptionSupplier) throws XTries to get a value or throws an exception if an exception occurs.- 型パラメータ:
T
-X
-- パラメータ:
onTry
-exceptionSupplier
-- 戻り値:
- 例外:
X
-
getOrElseNull
Tries to get a value or gets null if an exception occurs.- 型パラメータ:
T
-- パラメータ:
onTry
-- 戻り値:
-
rethrow
Rethrows an exception.- 型パラメータ:
T
-- パラメータ:
throwable
-- 戻り値:
- 例外:
T
-
runOrElseDo
Tries to run and applies the exception handler if an exception occurs.- パラメータ:
onTry
-exceptionHandler
-
-
runOrElseThrow
public static <T,X extends RuntimeException> void runOrElseThrow(Try.ThrowableRunnable onTry, Function<Exception, ? extends X> exceptionThrower) throws XTries to run and applies the exception thrower if an exception occurs.- 型パラメータ:
T
-X
-- パラメータ:
onTry
-exceptionThrower
-- 例外:
X
-