Package cloud.commandframework.meta
Class CommandMeta
- java.lang.Object
-
- cloud.commandframework.meta.CommandMeta
-
- Direct Known Subclasses:
SimpleCommandMeta
public abstract class CommandMeta extends java.lang.Object
Object that is associated with aCommand
. Command meta should not be mutable, as one fixed instance will be used per command.Appropriate use for command meta would be fixed state, such as command descriptions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
CommandMeta.Key<V>
A key into the metadata map.
-
Field Summary
Fields Modifier and Type Field Description static CommandMeta.Key<java.lang.String>
DESCRIPTION
static CommandMeta.Key<java.lang.Boolean>
HIDDEN
static CommandMeta.Key<java.lang.String>
LONG_DESCRIPTION
-
Constructor Summary
Constructors Constructor Description CommandMeta()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract <V> @NonNull java.util.Optional<V>
get(@NonNull CommandMeta.Key<V> key)
Get the value associated with a key.abstract @NonNull java.util.Map<@NonNull java.lang.String,@NonNull java.lang.String>
getAll()
Deprecated.for removal since 1.3.0, usegetAllValues()
instead.abstract @NonNull java.util.Map<@NonNull java.lang.String,?>
getAllValues()
Get a copy of the meta map, without type information.abstract <V> @NonNull V
getOrDefault(@NonNull CommandMeta.Key<V> key, @NonNull V defaultValue)
Get the value if it exists, else return the default value.abstract @NonNull java.lang.String
getOrDefault(@NonNull java.lang.String key, @NonNull java.lang.String defaultValue)
Deprecated.for removal since 1.3.0, see typesafe variant atgetOrDefault(Key, Object)
insteadabstract @NonNull java.util.Optional<java.lang.String>
getValue(@NonNull java.lang.String key)
Deprecated.for removal since 1.3.0, see typesafe variant atget(Key)
insteadstatic @NonNull SimpleCommandMeta.Builder
simple()
Create a new simple command meta builder@NonNull java.lang.String
toString()
-
-
-
Field Detail
-
DESCRIPTION
public static final CommandMeta.Key<java.lang.String> DESCRIPTION
-
LONG_DESCRIPTION
public static final CommandMeta.Key<java.lang.String> LONG_DESCRIPTION
-
HIDDEN
public static final CommandMeta.Key<java.lang.Boolean> HIDDEN
-
-
Method Detail
-
simple
public static @NonNull SimpleCommandMeta.Builder simple()
Create a new simple command meta builder- Returns:
- Builder instance
-
toString
public final @NonNull java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getValue
@Deprecated public abstract @NonNull java.util.Optional<java.lang.String> getValue(@NonNull java.lang.String key)
Deprecated.for removal since 1.3.0, see typesafe variant atget(Key)
insteadGet the value associated with a key- Parameters:
key
- Key- Returns:
- Optional that may contain the associated value
-
getOrDefault
@Deprecated public abstract @NonNull java.lang.String getOrDefault(@NonNull java.lang.String key, @NonNull java.lang.String defaultValue)
Deprecated.for removal since 1.3.0, see typesafe variant atgetOrDefault(Key, Object)
insteadGet the value if it exists, else return the default value- Parameters:
key
- KeydefaultValue
- Default value- Returns:
- Value, or default value
-
get
public abstract <V> @NonNull java.util.Optional<V> get(@NonNull CommandMeta.Key<V> key)
Get the value associated with a key.- Type Parameters:
V
- Value type- Parameters:
key
- Key- Returns:
- Optional that may contain the associated value
- Since:
- 1.3.0
-
getOrDefault
public abstract <V> @NonNull V getOrDefault(@NonNull CommandMeta.Key<V> key, @NonNull V defaultValue)
Get the value if it exists, else return the default value.- Type Parameters:
V
- Value type- Parameters:
key
- KeydefaultValue
- Default value- Returns:
- Value, or default value
- Since:
- 1.3.0
-
getAll
@Deprecated public abstract @NonNull java.util.Map<@NonNull java.lang.String,@NonNull java.lang.String> getAll()
Deprecated.for removal since 1.3.0, usegetAllValues()
instead.Get a copy of the meta map- Returns:
- Copy of meta map
-
getAllValues
public abstract @NonNull java.util.Map<@NonNull java.lang.String,?> getAllValues()
Get a copy of the meta map, without type information.- Returns:
- Copy of meta map
- Since:
- 1.3.0
-
-