com.zeroleak.throwingsupplier.Throwing Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of throwing-supplier Show documentation
Show all versions of throwing-supplier Show documentation
Guava cache supplier extension to memoize exceptions, fallback, expiration control.
The newest version!
package com.zeroleak.throwingsupplier;
import java8.util.Optional;
import java8.util.function.Supplier;
public class Throwing extends Either {
public Throwing(T value) {
super(value);
}
public Throwing(Exception e) {
super((Optional) Optional.empty(), (E) e);
}
public T getOrThrow() throws Exception {
return getValue()
.orElseThrow(
new Supplier() {
@Override
public Exception get() {
return getFallback().get();
}
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy