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.

    Methods inherited from interface java.lang.AutoCloseable

    close
  • Method Details

    • reflectionCleanup

      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. Call this from your `close()` method with the class level you want to close.
      Parameters:
      cls - the class level to clean up