Package no.digipost.util
Class ThrowingAutoClosed<T,X extends Exception>
java.lang.Object
no.digipost.util.ThrowingAutoClosed<T,X>
- Type Parameters:
T- The type of the arbitrary object which will have an operation invoked on exiting from a try-with-resources block.X- The type of exception which may be throwed by thecloseOperation
- All Implemented Interfaces:
AutoCloseable
public final class ThrowingAutoClosed<T,X extends Exception>
extends Object
implements AutoCloseable
An adapter to enable any arbitrary object to be managed by the
try-with-resources facility of Java >= 7, i.e. it will have a
closing operation invoked when exiting the
try-block.-
Constructor Summary
ConstructorsConstructorDescriptionThrowingAutoClosed(T managedObject, ThrowingConsumer<? super T, X> closeOperation) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
close