Interface Container<T>
- Type Parameters:
T
- Type of contained entries.
- All Known Subinterfaces:
BrushContainer
,PresetContainer
public interface Container<T>
An interface which represents a container which holds named entries of any type.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdd an entryall()
Get all presets in this containerGet a entry by namedefault boolean
default void
Migrate the container into this container.names()
Returns all names in this container@NotNull UUID
owner()
Get the owner of the container.CompletableFuture
<? extends ContainerPagedAccess<T>> paged()
Returns an object which should provide access to entry pages of this container.Remove a entry by namesize()
Get the amount of entries in this container.
-
Field Details
-
GLOBAL
-
-
Method Details
-
get
Get a entry by name- Parameters:
name
- name of entry- Returns:
- optional containing the entry if found
-
add
Add an entry- Parameters:
preset
- entry to add- Returns:
- A future which will completes once the entry was added
-
all
CompletableFuture<Collection<T>> all()Get all presets in this container- Returns:
- A future which contains an unmodifiable collection of all entries.
-
paged
CompletableFuture<? extends ContainerPagedAccess<T>> paged()Returns an object which should provide access to entry pages of this container.- Returns:
- container pages
-
remove
Remove a entry by name- Parameters:
name
- name of entry- Returns:
- A future which completes once the entry got remove. Will be true if the entry was removed.
-
names
Returns all names in this container- Returns:
- set of names
-
size
CompletableFuture<Integer> size()Get the amount of entries in this container.- Returns:
- A future providing the size of the container.
-
owner
Get the owner of the container.This might be the uuid of the owning player or
GLOBAL
when it is a global container.- Returns:
- owner uuid
-
isGlobalContainer
default boolean isGlobalContainer()- Returns:
- true if this container has the global UUID
-
migrate
Migrate the container into this container. This will override entries if they already exist with the same name. This will not remove already existing entries.- Parameters:
container
- container with entries to add.
-