Class SelectableNamedStorage<T extends IName>
java.lang.Object
de.florianmichael.rclasses.pattern.storage.Storage<T>
de.florianmichael.rclasses.pattern.storage.named.NamedStorage<T>
de.florianmichael.rclasses.pattern.storage.named.SelectableNamedStorage<T>
- Type Parameters:
T- The type of the objects that are stored in this storage.
- All Implemented Interfaces:
IName
public abstract class SelectableNamedStorage<T extends IName>
extends NamedStorage<T>
implements IName
Implementation of a named selectable storage. This storage is used to store objects that implement the
IName interface.
It also has a current object that can be set and retrieved. The current object is used for example to get the default object.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new named storage with aCopyOnWriteArrayList.SelectableNamedStorage(Supplier<List<T>> list) Creates a new named storage with the given list. -
Method Summary
Modifier and TypeMethodDescriptionGets the current object.abstract TGets the default object.voidsetCurrent(T current) voidsetCurrentByName(String name) Sets the current object by its name.Methods inherited from class de.florianmichael.rclasses.pattern.storage.named.NamedStorage
getByName, getByNameMethods inherited from class de.florianmichael.rclasses.pattern.storage.Storage
add, addBy, getByClass, getList, init, insert, remove, removeBy, setAddConsumer, setRemoveConsumer
-
Constructor Details
-
SelectableNamedStorage
public SelectableNamedStorage()Creates a new named storage with aCopyOnWriteArrayList. -
SelectableNamedStorage
Creates a new named storage with the given list.- Parameters:
list- The list.
-
-
Method Details
-
getDefault
Gets the default object. This is the object that is returned whengetCurrent()is called and the current object is null.- Returns:
- The default object.
-
getCurrent
Gets the current object. If the current object is null, the default object is returned.- Returns:
- The current object.
-
setCurrent
-
setCurrentByName
Sets the current object by its name.- Parameters:
name- The name.
-