/** * In case of failure wrap an exception matching the given predicate to something else. * * @param wrapper Exception mapper. * @return This try for success or a new failure with exception wrapped. */ public Try wrap(Throwing.Function<Throwable, Throwable> wrapper) { return wrap(Throwable.class, wrapper); }
/** * In case of failure wrap an exception matching the given predicate to something else. * * @param predicate Exception predicate. * @param wrapper Exception mapper. * @param <X> Exception type. * @return This try for success or a new failure with exception wrapped. */ public <X extends Throwable> Try wrap(Class<? extends X> predicate, Throwing.Function<X, Throwable> wrapper) { return wrap(predicate::isInstance, wrapper); }
@Override public <X extends Throwable> Value<V> wrap(final Class<? extends X> predicate, final Throwing.Function<X, Throwable> wrapper) { return (Value<V>) super.wrap(predicate, wrapper); }
@Override public <X extends Throwable> Value<V> wrap(final Throwing.Predicate<X> predicate, final Throwing.Function<X, Throwable> wrapper) { return (Value<V>) super.wrap(predicate, wrapper); } }
@Override public Value<V> wrap(final Throwing.Function<Throwable, Throwable> wrapper) { return (Value<V>) super.wrap(wrapper); }