Interface CleanAction<ResourceDescriptionT>

Type Parameters:
ResourceDescriptionT - type of resource this action cleans (usually, an instance of Class, String, Enum)
All Known Subinterfaces:
CancellableCleanAction<ResourceDescriptionT>
All Known Implementing Classes:
ProxyDestructor
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 CleanAction<ResourceDescriptionT>
A clean action is an operation that is performed to release some resources. The type of resource may be optionally specified.
  • Method Summary

    Modifier and Type Method Description
    void clean()
    A clean operation to perform.
    static <ResourceDescriptionT>
    CleanAction<ResourceDescriptionT>
    from​(java.lang.Runnable action, ResourceDescriptionT resourceType)
    Creates a clean action with a given type.
    default java.util.Optional<ResourceDescriptionT> resourceType()
    Returns the description of the type of resource this action corresponds to.
  • Method Details

    • clean

      void clean() throws java.lang.Exception
      A clean operation to perform. It is recommended that this operation is idempotent.
      Throws:
      java.lang.Exception
    • resourceType

      default java.util.Optional<ResourceDescriptionT> resourceType()
      Returns the description of the type of resource this action corresponds to.
    • from

      static <ResourceDescriptionT> CleanAction<ResourceDescriptionT> from​(java.lang.Runnable action, ResourceDescriptionT resourceType)
      Creates a clean action with a given type.
      Type Parameters:
      ResourceDescriptionT - a type of the resource description
      Parameters:
      action - a clean operation
      resourceType - a description of the resource (its class, textual description, etc.)