T - the type of target to manage data forpublic abstract class Data<T> extends java.lang.Object implements Annoyable
| Modifier and Type | Field and Description |
|---|---|
protected @NotNull AnnoyingPlugin |
plugin
The
plugin instance |
T |
target
The target to manage data for
|
| Constructor and Description |
|---|
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 |
protected @NotNull java.lang.String |
getTargetName()
Get the name of the target used for warning messages
|
boolean |
has(@NotNull java.lang.String key)
Check if the data value exists for the given key
|
abstract @NotNull Data<T> |
remove(@NotNull java.lang.String key)
Remove the data value with the given key
|
protected void |
sendError(@NotNull java.lang.String action)
Send an error message to the console
|
@NotNull Data<T> |
set(@NotNull java.lang.String key,
@Nullable java.lang.Object value)
Set the data value for the given key.
|
protected abstract @NotNull Data<T> |
set(@NotNull java.lang.String key,
@NotNull java.lang.String value)
Set the data value for the given key.
|
@NotNull protected final @NotNull AnnoyingPlugin plugin
plugin instance@NotNull public final T target
public Data(@NotNull
@NotNull AnnoyingPlugin plugin,
@NotNull
T target)
Data for the given target@NotNull public @NotNull AnnoyingPlugin getAnnoyingPlugin()
AnnoyableAnnoyingPlugin instancegetAnnoyingPlugin in interface Annoyable@NotNull protected @NotNull java.lang.String getTargetName()
public boolean has(@NotNull
@NotNull java.lang.String key)
key - the key to check for@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 found@NotNull public @NotNull Data<T> 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 valueData instance@NotNull protected abstract @NotNull Data<T> 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 setData instance@NotNull public abstract @NotNull Data<T> remove(@NotNull @NotNull java.lang.String key)
key - the key to remove the data value forData instanceprotected void sendError(@NotNull
@NotNull java.lang.String action)
action - the action that failed