Package cloud.commandframework.meta
Interface CommandMeta.Key<V>
-
- Type Parameters:
V
- value type
- Enclosing class:
- CommandMeta
public static interface CommandMeta.Key<V>
A key into the metadata map.- Since:
- 1.3.0
-
-
Method Summary
Modifier and Type Method Description @Nullable java.util.function.Function<@NonNull CommandMeta,@Nullable V>
getFallbackDerivation()
Get a function that can be used to compute a fallback based on existing meta.@NonNull java.lang.String
getName()
Get the name of this key@NonNull io.leangen.geantyref.TypeToken<V>
getValueType()
Get a representation of the type of value this key holds.static <T> @NonNull CommandMeta.Key<T>
of(@NonNull io.leangen.geantyref.TypeToken<T> type, @NonNull java.lang.String key)
Create a new metadata key.static <T> @NonNull CommandMeta.Key<T>
of(@NonNull io.leangen.geantyref.TypeToken<T> type, @NonNull java.lang.String key, @NonNull java.util.function.Function<@NonNull CommandMeta,@Nullable T> fallbackDerivation)
Create a new metadata key.static <T> @NonNull CommandMeta.Key<T>
of(@NonNull java.lang.Class<T> type, @NonNull java.lang.String key)
Create a new metadata key.static <T> @NonNull CommandMeta.Key<T>
of(@NonNull java.lang.Class<T> type, @NonNull java.lang.String key, @NonNull java.util.function.Function<@NonNull CommandMeta,@Nullable T> fallbackDerivation)
Create a new metadata key.
-
-
-
Method Detail
-
of
static <T> @NonNull CommandMeta.Key<T> of(@NonNull java.lang.Class<T> type, @NonNull java.lang.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 io.leangen.geantyref.TypeToken<T> type, @NonNull java.lang.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 java.lang.Class<T> type, @NonNull java.lang.String key, @NonNull java.util.function.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 java.lang.String key, @NonNull java.util.function.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
-
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 java.lang.String getName()
Get the name of this key- Returns:
- the key type
-
getFallbackDerivation
@Nullable java.util.function.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
-
-