Package cloud.commandframework.meta
Class CommandMeta
java.lang.Object
cloud.commandframework.meta.CommandMeta
- Direct Known Subclasses:
SimpleCommandMeta
Object that is associated with a
Command.
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 ClassesModifier and TypeClassDescriptionstatic interfaceA key into the metadata map. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CommandMeta.Key<String>static final CommandMeta.Key<Boolean>static final CommandMeta.Key<String> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <V> @NonNull Optional<V>get(@NonNull CommandMeta.Key<V> key) Get the value associated with a key.getAll()Deprecated.Get a copy of the meta map, without type information.abstract <V> @NonNull VgetOrDefault(@NonNull CommandMeta.Key<V> key, @NonNull V defaultValue) Get the value if it exists, else return the default value.abstract @NonNull StringgetOrDefault(@NonNull String key, @NonNull String defaultValue) Deprecated.for removal since 1.3.0, see typesafe variant atgetOrDefault(Key, Object)insteadDeprecated.for removal since 1.3.0, see typesafe variant atget(Key)insteadstatic @NonNull SimpleCommandMeta.Buildersimple()Create a new simple command meta builderfinal @NonNull StringtoString()
-
Field Details
-
DESCRIPTION
-
LONG_DESCRIPTION
-
HIDDEN
-
-
Constructor Details
-
CommandMeta
public CommandMeta()
-
-
Method Details
-
simple
Create a new simple command meta builder- Returns:
- Builder instance
-
toString
-
getValue
@Deprecated @API(status=DEPRECATED, since="1.3.0") public abstract @NonNull Optional<String> getValue(@NonNull 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 @API(status=DEPRECATED, since="1.3.0") public abstract @NonNull String getOrDefault(@NonNull String key, @NonNull 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
@API(status=STABLE, since="1.3.0") public abstract <V> @NonNull 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
@API(status=STABLE, since="1.3.0") 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 @API(status=DEPRECATED, since="1.3.0") public abstract @NonNull Map<@NonNull String,@NonNull String> getAll()Deprecated.for removal since 1.3.0, usegetAllValues()instead.Get a copy of the meta map- Returns:
- Copy of meta map
-
getAllValues
@API(status=STABLE, since="1.3.0") public abstract @NonNull Map<@NonNull String,@NonNull ?> getAllValues()Get a copy of the meta map, without type information.- Returns:
- Copy of meta map
- Since:
- 1.3.0
-
getAllValues()instead.