@FunctionalInterface
public interface CloseableResource
extends java.lang.AutoCloseable
AutoCloseable type without a throws declaration.
For use in try-with-resources blocks.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Overrides the parent method which throws
Exception. |
default <T extends java.lang.Throwable> |
expected()
Fluent method for allowing an instance to declare it throws any
Throwable. |
void close()
Exception.
Combined with expected() this type can declare checked it throws any type.close in interface java.lang.AutoCloseabledefault <T extends java.lang.Throwable> CloseableResource expected() throws T extends java.lang.Throwable
Throwable.T - the type of exception to expectT extends java.lang.ThrowableExceptions.expected()