T
- the type of items that get registeredpublic abstract class Registry<T>
extends java.lang.Object
Constructor and Description |
---|
Registry() |
Modifier and Type | Method and Description |
---|---|
protected void |
addItem(T item)
Adds an item to the list of registered items.
|
javafx.collections.ObservableList<T> |
getItems()
Gets a read-only view of the list of registered items.
|
boolean |
isRegistered(T item)
Checks if the given item has been registered with this registry.
|
abstract void |
register(T item)
Registers an item with this registry.
|
void |
registerAll(java.util.Collection<? extends T> items)
Registers many items at once.
|
void |
registerAll(T... items)
Registers many items at once.
|
boolean |
registerIfAbsent(T item)
Registers an item only if it is not already registered.
|
protected void |
removeItem(T item)
Removes an item from the list of registered items.
|
abstract void |
unregister(T item)
Unregisters an item from this registry.
|
void |
unregisterAll(java.util.Collection<? extends T> items)
Unregisters many items at once.
|
void |
unregisterAll(T... items)
Unregisters many items at once.
|
public abstract void register(T item)
unregistered
.item
- the item to registerjava.lang.IllegalArgumentException
- if the item has already been registeredjava.lang.NullPointerException
- if the item is nullpublic final boolean registerIfAbsent(T item)
item
- the item to registerpublic abstract void unregister(T item)
item
- the item to unregisterprotected final void addItem(T item)
register(T)
.protected final void removeItem(T item)
unregister(T)
.public final boolean isRegistered(T item)
public final void registerAll(T... items)
for (T item : items) {
register(item);
}
items
- the items to registerjava.lang.IllegalArgumentException
- if any of the items is already registeredpublic final void registerAll(java.util.Collection<? extends T> items)
items
- the items to registerjava.lang.IllegalArgumentException
- if any of the items in the collection is already registeredpublic final void unregisterAll(T... items)
items
- the items to unregisterpublic final void unregisterAll(java.util.Collection<? extends T> items)
items
- the items to unregisterpublic final javafx.collections.ObservableList<T> getItems()