T - the type of target to manage data forpublic abstract class Data<T> extends xyz.srnyx.javautilities.parents.Stringable implements Annoyable
| Modifier and Type | Field and Description |
|---|---|
protected @NotNull AnnoyingPlugin |
plugin
The
plugin instance |
T |
target
The target to manage data for
|
| Modifier | Constructor and Description |
|---|---|
protected |
Data(@NotNull AnnoyingPlugin plugin,
T target)
Construct a new
Data for the given target |
| Modifier and Type | Method and Description |
|---|---|
abstract @Nullable java.lang.String |
get(@NotNull java.lang.String key)
Get the data value for the given key
|
@NotNull java.lang.String |
get(@NotNull java.lang.String key,
@NotNull java.lang.String def)
Get the data value for the given key, or the default value if not found
|
@NotNull AnnoyingPlugin |
getAnnoyingPlugin()
The
AnnoyingPlugin instance |
boolean |
has(@NotNull java.lang.String key)
Check if the data value exists for the given key
|
abstract boolean |
remove(@NotNull java.lang.String key)
Remove the data value with the given key
|
@NotNull Data<T> |
removeChain(@NotNull java.lang.String key)
Remove the data value with the given key
|
protected void |
sendError(@NotNull java.lang.String action,
@Nullable java.lang.Throwable t)
Send an error message to the console
|
boolean |
set(@NotNull java.lang.String key,
@Nullable java.lang.Object value)
Set the data value for the given key.
|
protected abstract boolean |
set(@NotNull java.lang.String key,
@NotNull java.lang.String value)
Set the data value for the given key.
|
@NotNull Data<T> |
setChain(@NotNull java.lang.String key,
@Nullable java.lang.Object value)
Set the data value for the given key.
|
@NotNull protected final @NotNull AnnoyingPlugin plugin
plugin instance@NotNull public final T target
protected Data(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
T target)
Data for the given target@NotNull public @NotNull AnnoyingPlugin getAnnoyingPlugin()
AnnoyableAnnoyingPlugin instancegetAnnoyingPlugin in interface Annoyablepublic boolean has(@NotNull
@NotNull java.lang.String key)
key - the key to check fortrue if the data value exists, false otherwise@Nullable
public abstract @Nullable java.lang.String get(@NotNull
@NotNull java.lang.String key)
key - the key to get the data value for@NotNull
public @NotNull java.lang.String get(@NotNull
@NotNull java.lang.String key,
@NotNull
@NotNull java.lang.String def)
key - the key to get the data value fordef - the default value to return if the data value is not foundprotected abstract boolean set(@NotNull
@NotNull java.lang.String key,
@NotNull
@NotNull java.lang.String value)
key - the key to set the data value forvalue - the data value to settrue if the data value was set successfully, false otherwisepublic boolean set(@NotNull
@NotNull java.lang.String key,
@Nullable
@Nullable java.lang.Object value)
key - the key to set the data value forvalue - the data value to set, or null to remove the data valuetrue if the data value was set successfully, false otherwise@NotNull public @NotNull Data<T> setChain(@NotNull @NotNull java.lang.String key, @Nullable @Nullable java.lang.Object value)
key - the key to set the data value forvalue - the data value to set, or null to remove the data valueData instance for chainingpublic abstract boolean remove(@NotNull
@NotNull java.lang.String key)
key - the key to remove the data value fortrue if the data value was removed successfully, false otherwise@NotNull public @NotNull Data<T> removeChain(@NotNull @NotNull java.lang.String key)
key - the key to remove the data value forData instance for chainingprotected void sendError(@NotNull
@NotNull java.lang.String action,
@Nullable
@Nullable java.lang.Throwable t)
action - the action that failedt - the Throwable that caused the error