Package net.kyori.adventure.text.event
Class DataComponentValueConverterRegistry
java.lang.Object
net.kyori.adventure.text.event.DataComponentValueConverterRegistry
A registry for conversions between different data component value holder classes.
Conversions are discovered by ServiceLoader
lookup of implementations of the DataComponentValueConverterRegistry.Provider
interface (on the classloader which loaded Adventure).
- Since:
- 4.17.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A single conversion that may be provided by a provider.static interface
A provider for data component value converters. -
Method Summary
Modifier and TypeMethodDescriptionstatic <O extends DataComponentValue>
Oconvert
(@NotNull Class<O> target, @NotNull Key key, @NotNull DataComponentValue in) Try to convert the data component valuein
to the provided output type.Get the id's of all registered conversion providers.
-
Method Details
-
knownProviders
Get the id's of all registered conversion providers.- Returns:
- an unmodifiable set of the known provider ids
- Since:
- 4.1.7.0
-
convert
@NotNull public static <O extends DataComponentValue> O convert(@NotNull @NotNull Class<O> target, @NotNull @NotNull Key key, @NotNull @NotNull DataComponentValue in) Try to convert the data component valuein
to the provided output type.- Type Parameters:
O
- the output type- Parameters:
target
- the target typekey
- the key this value is forin
- the input value- Returns:
- a value of target type
- Since:
- 4.17.0
-