GeneralCloser class

A class that implements the common Closer logic and provides the capability to manage collections of SingleAutoClosable and SubAutoClosable instances.

Other Closer should only implement HasCloser by this class instance, and call onClose when the time comes.

It facilitates the controlled closure of these instances in accordance with its own lifecycle. SingleAutoClosable instances are given priority during closure operations.

Implemented types

Constructors

GeneralCloser()

Properties

closables List<SingleAutoClosable>
simple closables
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subClosables List<SubAutoClosable>
subClosables list have higher priority
final

Methods

addClosable(SingleAutoClosable closable) → void
Add SingleAutoClosable instance to that Closer to handle its destruction when onClose called
override
addSubClosable(SubAutoClosable subClosable) → void
Add SubAutoClosable instance to that Closer to handle its destruction when onClose called
override
clearClosables(List<AutoClosable> closables, Set<AutoClosable> attachedSet) → void
Clears and closes the provided collection of closables and removes them from the attached set. This method is used during the onClose operation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onClose() → void
Initiates the closure of all managed SingleAutoClosable and SubAutoClosable instances. The onClose operation handles the closure of these instances in accordance with the Closer's own lifecycle.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

attachedAutoclosables Set<SingleAutoClosable>
SingleAutoClosable instances which already attached to their Closer's
final
attachedSubAutoclosables Set<SubAutoClosable>
SubAutoClosable instances which already attached to their Closer's
final