Package org.omnifaces.utils.function
Interface ExceptionlessAutoCloseable
-
- All Superinterfaces:
AutoCloseable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ExceptionlessAutoCloseable extends AutoCloseable
Functional helper-interface to allow for use of closeable resources that don't implement AutoCloseable in a try-with-resources statement.This interface can be used with any object instance that doesn't implement AutoCloseable, but does have a close or similar method that needs to be called to free up resources. This functional interface is useable for any close method that doesn't throw any checked exceptions, for methods that throw a more specific exception than Exception, please see @link{ThrowingAutoCloseable}.
Example:
CloseableResource resource = ... try (ExceptionlessAutoCloseable eac = resource::close) { // Use resource }
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
-
-
-
Method Detail
-
close
void close()
- Specified by:
close
in interfaceAutoCloseable
-
-