Uses of Class
io.reacted.patterns.Try
Packages that use Try
-
Uses of Try in io.reacted.patterns
Subclasses of Try in io.reacted.patternsModifier and TypeClassDescriptionstatic final classTry.Failure<T>static final classTry.Success<T>Fields in io.reacted.patterns declared as TryMethods in io.reacted.patterns that return TryModifier and TypeMethodDescriptionTry.filter(UnChecked.CheckedPredicate<? super T> predicate) If the Try is a failure, the current Try is returned.Try.filter(UnChecked.CheckedPredicate<? super T> predicate, Supplier<? extends Throwable> exceptionOnTestFailure) If the Try is a failure, the current Try is returned.<U> Try<U>Try.flatMap(Try.TryMapper<? super T, Try<? extends U>> flatMapper) Like Stream.flatMap(), Try.flatMap flattens two nested Try.static <U> Try<U>Identity Try function.Try.ifError(Try.TryConsumer<? super Throwable> consumer) If Try is a failure, the provided consumer will be applied to the generated Throwable.Try.ifSuccess(Try.TryConsumer<? super T> consumer) If the Try is a success, the provided consumer is applied to the result.Try.ifSuccessOrElse(Try.TryConsumer<? super T> successConsumer, Try.TryConsumer<? super Throwable> failureConsumer) A functional if then else: if the Try is successful the successConsumer is used, otherwise the throwable consumer.<U> Try<U>Try.map(Try.TryMapper<? super T, ? extends U> mapper) If the Try is successful, another Try will be returned with the result of the specified mapper, otherwise the current Try is returned<U> Try<U>Try.mapOrElse(Try.TryMapper<? super T, ? extends U> ifSuccess, Try.TryMapper<? super Throwable, ? extends U> orElse) A functional if then else: if the Try is successful the ifSuccess mapper is used, otherwise the throwable mapper.static <T> Try<T>Try.of(Try.TryValueSupplier<? extends T> supplier) Creates a Try monad with the result of a computationstatic <T> Try<T>Try.ofCallable(UnChecked.CheckedCallable<? extends T> function) Try.ofRunnable(UnChecked.CheckedRunnable function) Try.orElseTry(Try.TryMapper<Throwable, Try<? extends T>> excToAlternative) Gets the current Try or if it is a failure maps the generated exception into an alternative Try using the specified mapperTry.orElseTry(Try.TryValueSupplier<? extends T> supplier) Gets the current Try or if it is a failure, the result of the provided TrySupplierTry.orElseTry(Try.TryValueSupplier<? extends T> supplier, UnChecked.CheckedConsumer<? super Throwable> exceptionConsumer) Gets the current Try or if it is a failure, the result of the provided TrySupplier and the specified consumer process the exception that has generated the failureGets the value contained in Try on success, otherwise returns the specified TryTry.peek(Class<? extends ExceptionT> throwableClass, Consumer<? super T> ifSuccess, Consumer<? super ExceptionT> ifError) Check the status of the current Try and apply accordingly one of the provided consumers.Check the status of the current Try and apply accordingly one of the provided consumers.Try.peekFailure(Class<ExceptionT> throwableClass, Consumer<ExceptionT> ifError) Check if the status of the current Try is a failure of the specified class and in that case apply the specified consumer to its failure cause.Try.peekFailure(Consumer<? super Throwable> ifError) Check if the current Try is a Failure and in that case apply the specified consumer to its failure cause.Try.peekSuccess(Consumer<? super T> ifSuccess) Check the status of the current Try and if it is a success apply the specified consumer to its value.Try.recover(Class<X> exception, Try.TryMapper<? super Throwable, ? extends T> alternativeMapper) Recover the status of a Try, if failed, mapping the generated exception to another org .reacted.patterns.Try Will be returned the original Try if it is successful, otherwise the try returned by the mapper Different recover calls can be chains for fine exception handlingTry.recover(Class<X> exception, Try.TryValueSupplier<? extends T> successValGenerator) Recover the status of a Try, if failed.Recover the status of a Try, if failed.Try.recover(Class<X> exception, UnChecked.CheckedSupplier<Try<? extends T>> successProvider) Recover the status of a Try, if failed, a success Try is generated using the provided supplier Will be returned the original Try if it is successful, otherwise the try returned by the mapper Different recover calls can be chains for fine exception handlingstatic <T,A extends AutoCloseable, A1 extends AutoCloseable>
Try<T>Try.withChainedResources(Try.TryResourceSupplier<? extends A> resourceSupplier1, Try.TryMapper<A, ? extends A1> resourceMapper, UnChecked.CheckedBiFunction<? super A, ? super A1, ? extends T> resourceToResult) static <T,A extends AutoCloseable>
Try<T>Try.withResources(Try.TryResourceSupplier<? extends A> resourceSupplier, Try.TryMapper<? super A, ? extends T> resourceToResult) Applies a consumer on a resource.static <T,A extends AutoCloseable, A1 extends AutoCloseable>
Try<T>Try.withResources(Try.TryResourceSupplier<? extends A> resourceSupplier1, Try.TryResourceSupplier<? extends A1> resourceSupplier2, UnChecked.CheckedBiFunction<? super A, ? super A1, ? extends T> resourceToResult) Applies a consumer on two resources.Methods in io.reacted.patterns with parameters of type TryModifier and TypeMethodDescriptionstatic <U> Try<U>Identity Try function.Gets the value contained in Try on success, otherwise returns the specified TryRecover the status of a Try, if failed.Method parameters in io.reacted.patterns with type arguments of type TryModifier and TypeMethodDescription<U> Try<U>Try.flatMap(Try.TryMapper<? super T, Try<? extends U>> flatMapper) Like Stream.flatMap(), Try.flatMap flattens two nested Try.Try.orElseTry(Try.TryMapper<Throwable, Try<? extends T>> excToAlternative) Gets the current Try or if it is a failure maps the generated exception into an alternative Try using the specified mapperTry.recover(Class<X> exception, UnChecked.CheckedSupplier<Try<? extends T>> successProvider) Recover the status of a Try, if failed, a success Try is generated using the provided supplier Will be returned the original Try if it is successful, otherwise the try returned by the mapper Different recover calls can be chains for fine exception handling