addCloseable
Adds an AutoCloseable resource with an associated key to this ComponentModel. The resource will be closed right before the onCleared method is called.
If the key already has a resource associated with it, the old resource will be replaced and closed immediately.
If onCleared has already been called, the provided resource will not be added and will be closed immediately.
Parameters
the key to associate with the resource, for retrieval with getCloseable.
the resource to be closed when the ComponentModel is cleared, right before the onCleared method is called.
Adds an AutoCloseable resource to this ComponentModel. The resource will be closed right before the onCleared method is called.
If onCleared has already been called, the provided resource will not be added and will be closed immediately.
Parameters
the resource to be closed when the ComponentModel is cleared, right before the onCleared method is called.