Package de.aristaflow.adept2.util
Class Cleanup.Builder
- java.lang.Object
-
- de.aristaflow.adept2.util.Cleanup.Builder
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Cleanup.Buildercleaner(Cleaner cleaner)Sets a specific cleaner to be used.Cleanup.Builderdescriptor(String descriptor)Sets the designated string that meaningfully describes this task when used for logging etc.Cleanup.Builderlogger(Logger logger)Sets the logger for messages and/or problems, e. g.Cleanup<RuntimeException>register(Object object)Finishes creating aCleanupfor the given object using the other provided information.<EX extends Exception>
Cleanup<EX>register(Object object, Class<EX> checkedExceptionType)Finishes creating aCleanupfor the given object using the other provided information.
-
-
-
Method Detail
-
cleaner
public Cleanup.Builder cleaner(Cleaner cleaner)
Sets a specific cleaner to be used. Otherwise the default cleaner will be used.- Parameters:
cleaner- The custom cleaner to be used for clean-up.- Returns:
- This builder.
-
descriptor
public Cleanup.Builder descriptor(String descriptor)
Sets the designated string that meaningfully describes this task when used for logging etc. Otherwise the class name of the registered object will be used.- Parameters:
descriptor- The custom descriptor to be used for logging.- Returns:
- This builder.
-
logger
public Cleanup.Builder logger(Logger logger)
Sets the logger for messages and/or problems, e. g. unexpected exceptions. Otherwise the default logger will be used.- Parameters:
logger- The custom logger to be used for logging.- Returns:
- This builder.
-
register
public Cleanup<RuntimeException> register(Object object)
Finishes creating aCleanupfor the given object using the other provided information. There will be no transparent pass-through for a checked exception inCleanup.clean().- Parameters:
object- The object for which to register post-mortem clean-up.- Returns:
- A new
Cleanupallowing to perform post-mortem clean-up.
-
register
public <EX extends Exception> Cleanup<EX> register(Object object, Class<EX> checkedExceptionType)
Finishes creating aCleanupfor the given object using the other provided information. There will be transparent pass-through for the provided checked exception type inCleanup.clean().- Parameters:
object- The object for which to register post-mortem clean-up.checkedExceptionType- The exception that is expected by the clean-up. This will be forwarded when manually triggering clean-up.- Returns:
- A new
Cleanupallowing to perform post-mortem clean-up.
-
-