Package edu.wpi.first.util.cleanup
Interface ReflectionCleanup
- All Superinterfaces:
AutoCloseable
public interface ReflectionCleanup extends AutoCloseable
Implement this interface to have access to a `reflectionCleanup` method that can be called from
your `close` method, that will use reflection to find all `AutoCloseable` instance members and
close them.
-
Method Summary
Modifier and Type Method Description default void
reflectionCleanup(Class<? extends ReflectionCleanup> cls)
Default implementation that uses reflection to find all AutoCloseable fields not marked SkipCleanup and call close() on them.
-
Method Details
-
reflectionCleanup
Default implementation that uses reflection to find all AutoCloseable fields not marked SkipCleanup and call close() on them. Call this from your `close()` method with the class level you want to close.- Parameters:
cls
- the class level to clean up
-