Package cloud.commandframework.meta
Interface CommandMeta.Key<V>
- Type Parameters:
V
- value type
- All Superinterfaces:
CloudKey<V>
- Enclosing class:
- CommandMeta
A key into the metadata map.
- Since:
- 1.3.0
-
Method Summary
Modifier and TypeMethodDescription@Nullable Function<@NonNull CommandMeta,
@Nullable V> Get a function that can be used to compute a fallback based on existing meta.@NonNull String
getName()
Get the name of this keydefault @NonNull io.leangen.geantyref.TypeToken<@NonNull V>
getType()
Get the type of the value that this key holds.@NonNull io.leangen.geantyref.TypeToken<V>
Get a representation of the type of value this key holds.static <T> @NonNull CommandMeta.Key<T>
Create a new metadata key.static <T> @NonNull CommandMeta.Key<T>
of
(@NonNull io.leangen.geantyref.TypeToken<T> type, @NonNull String key, @NonNull Function<@NonNull CommandMeta, @Nullable T> fallbackDerivation) Create a new metadata key.static <T> @NonNull CommandMeta.Key<T>
Create a new metadata key.static <T> @NonNull CommandMeta.Key<T>
of
(@NonNull Class<T> type, @NonNull String key, @NonNull Function<@NonNull CommandMeta, @Nullable T> fallbackDerivation) Create a new metadata key.
-
Method Details
-
of
Create a new metadata key.- Type Parameters:
T
- the value type- Parameters:
type
- the value typekey
- the name for the key- Returns:
- a new key
-
of
static <T> @NonNull CommandMeta.Key<T> of(@NonNull io.leangen.geantyref.TypeToken<T> type, @NonNull String key) Create a new metadata key.- Type Parameters:
T
- the value type- Parameters:
type
- the value typekey
- the name for the key- Returns:
- a new key
-
of
static <T> @NonNull CommandMeta.Key<T> of(@NonNull Class<T> type, @NonNull String key, @NonNull Function<@NonNull CommandMeta, @Nullable T> fallbackDerivation) Create a new metadata key.- Type Parameters:
T
- the value type- Parameters:
type
- the value typekey
- the name for the keyfallbackDerivation
- A function that will be called if no value is present for the key- Returns:
- a new key
-
of
static <T> @NonNull CommandMeta.Key<T> of(@NonNull io.leangen.geantyref.TypeToken<T> type, @NonNull String key, @NonNull Function<@NonNull CommandMeta, @Nullable T> fallbackDerivation) Create a new metadata key.- Type Parameters:
T
- the value type- Parameters:
type
- the value typekey
- the name for the keyfallbackDerivation
- A function that will be called if no value is present for the key- Returns:
- a new key
-
getType
Description copied from interface:CloudKey
Get the type of the value that this key holds. -
getValueType
@NonNull io.leangen.geantyref.TypeToken<V> getValueType()Get a representation of the type of value this key holds.- Returns:
- the value type
-
getName
@NonNull String getName()Get the name of this key -
getFallbackDerivation
@Nullable Function<@NonNull CommandMeta,@Nullable V> getFallbackDerivation()Get a function that can be used to compute a fallback based on existing meta.This function will only be used if no value is directly for the key.
- Returns:
- the fallback derivation
-