Uses of Interface
io.reacted.patterns.Try.TryMapper
Packages that use Try.TryMapper
-
Uses of Try.TryMapper in io.reacted.patterns
Methods in io.reacted.patterns with parameters of type Try.TryMapperModifier and TypeMethodDescription<U> Try<U>Try.flatMap(Try.TryMapper<? super T, Try<? extends U>> flatMapper) Like Stream.flatMap(), Try.flatMap flattens two nested Try.<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.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, 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 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.