Interface DestructorTree
- All Superinterfaces:
AutoCloseable,DestructorRegistry
- All Known Implementing Classes:
DefaultDestructorTree
A hierarchical
DestructorRegistry that is AutoCloseable.
This interface is often used by ReferencesSelector implementors, and normally by no
other kinds of users.
- Author:
- Laird Nelson
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.microbean.reference.DestructorRegistry
DestructorRegistry.Destructor -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes thisDestructorTreeimplementation by effectively removing all registered contextual instances and running their affiliatedDestructors.newChild()Creates a new child instance of this implementation, or a subtype, registers it with this implementation, using a method reference to itsclose()method as theDestructorRegistry.Destructor, and returns it.Removes the supplied contextual instance and theDestructorRegistry.Destructorthat was registered with it.Methods inherited from interface org.microbean.reference.DestructorRegistry
register
-
Method Details
-
newChild
Creates a new child instance of this implementation, or a subtype, registers it with this implementation, using a method reference to itsclose()method as theDestructorRegistry.Destructor, and returns it.- Returns:
- a new (non-
null) child instance of this implementation, or a subtype, registered with this implementation such thatclosingthis implementation will also close the child instance - See Also:
-
close
void close()Closes thisDestructorTreeimplementation by effectively removing all registered contextual instances and running their affiliatedDestructors.- Specified by:
closein interfaceAutoCloseable- See Also:
-
remove
Removes the supplied contextual instance and theDestructorRegistry.Destructorthat was registered with it.The
DestructorRegistry.Destructor.destroy()will not be invoked by implementations of this method.- Parameters:
instance- the contextual instance to remove; may benullin which casenullwill be returned- Returns:
- a
DestructorRegistry.Destructorregistered with the supplied instance, ornullif no suchDestructorRegistry.Destructorexists
-