public class DestroyableBag extends Object
Destroyable
instances which can all be cleared at once. This is
useful for tracking connections and other managed resources on a screen and then clearing them
all at once when the screen is hidden or removed.Constructor and Description |
---|
DestroyableBag() |
Modifier and Type | Method and Description |
---|---|
DestroyableBag |
add(react.Connection conn)
Adds
conn to this bag. |
DestroyableBag |
add(Connection conn)
Adds
conn to this bag. |
DestroyableBag |
add(Destroyable dable)
Adds
dable to this bag. |
DestroyableBag |
add(Layer layer)
Adds
layer to this bag. |
void |
clear()
Destroys all destroyables in this bag and clears its contents.
|
boolean |
remove(Destroyable dable)
Removes, and does not destroy,
dable from this bag. |
public DestroyableBag add(Destroyable dable)
dable
to this bag. No check is made to see if dable
is already in the
bag. If you add something twice, it gets destroyed twice, so don't do that.public DestroyableBag add(Layer layer)
layer
to this bag. Layer.destroy()
will be called on destruction.public DestroyableBag add(react.Connection conn)
conn
to this bag. disconnect
will be called on destruction.public DestroyableBag add(Connection conn)
conn
to this bag. disconnect
will be called on destruction.public boolean remove(Destroyable dable)
dable
from this bag.dable
was found and removed from the bag, false if it was not in the
bag.public void clear()
react.MultiFailureException
- containing one or more exceptions if any destroyable throws an
exception while being destroyed. destroy
will always be called on all destroyables
regardless of whether any throw an exception.Copyright © 2015. All Rights Reserved.