Package net.kyori.adventure.text.event
Class DataComponentValueConverterRegistry
- java.lang.Object
-
- net.kyori.adventure.text.event.DataComponentValueConverterRegistry
-
public final class DataComponentValueConverterRegistry extends java.lang.Object
A registry for conversions between different data component value holder classes.Conversions are discovered by
ServiceLoader
lookup of implementations of theDataComponentValueConverterRegistry.Provider
interface (on the classloader which loaded Adventure).- Since:
- 4.17.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DataComponentValueConverterRegistry.Conversion<I,O>
A single conversion that may be provided by a provider.static interface
DataComponentValueConverterRegistry.Provider
A provider for data component value converters.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <O extends DataComponentValue>
Oconvert(@NotNull java.lang.Class<O> target, @NotNull Key key, @NotNull DataComponentValue in)
Try to convert the data component valuein
to the provided output type.static java.util.Set<Key>
knownProviders()
Get the id's of all registered conversion providers.
-
-
-
Method Detail
-
knownProviders
public static java.util.Set<Key> 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 java.lang.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
-
-