Class ThrowingAutoClosed<T,​X extends Exception>

  • 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 the closeOperation
    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 Detail

      • ThrowingAutoClosed

        public ThrowingAutoClosed​(T managedObject,
                                  ThrowingConsumer<? super T,​X> closeOperation)