Interface ComponentFlattener.Builder
-
- All Superinterfaces:
AbstractBuilder<ComponentFlattener>
,Buildable.Builder<ComponentFlattener>
- Enclosing interface:
- ComponentFlattener
public static interface ComponentFlattener.Builder extends AbstractBuilder<ComponentFlattener>, Buildable.Builder<ComponentFlattener>
A builder for a component flattener.A new builder will start out empty, providing empty strings for all component types.
- Since:
- 4.7.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends Component>
@NotNull ComponentFlattener.BuildercomplexMapper(@NotNull java.lang.Class<T> type, @NotNull java.util.function.BiConsumer<T,java.util.function.Consumer<Component>> converter)
Register a type of component that needs to be flattened to an intermediate stage.<T extends Component>
@NotNull ComponentFlattener.Buildermapper(@NotNull java.lang.Class<T> type, @NotNull java.util.function.Function<T,java.lang.String> converter)
Register a type of component to be handled.@NotNull ComponentFlattener.Builder
unknownMapper(@Nullable java.util.function.Function<Component,java.lang.String> converter)
Register a handler for unknown component types.-
Methods inherited from interface net.kyori.adventure.util.Buildable.Builder
build
-
-
-
-
Method Detail
-
mapper
@NotNull <T extends Component> @NotNull ComponentFlattener.Builder mapper(@NotNull @NotNull java.lang.Class<T> type, @NotNull @NotNull java.util.function.Function<T,java.lang.String> converter)
Register a type of component to be handled.- Type Parameters:
T
- component type- Parameters:
type
- the component typeconverter
- the converter to map that component to a string- Returns:
- this builder
- Since:
- 4.7.0
- See Also:
for component types that are too complex to be directly rendered to a string
-
complexMapper
@NotNull <T extends Component> @NotNull ComponentFlattener.Builder complexMapper(@NotNull @NotNull java.lang.Class<T> type, @NotNull @NotNull java.util.function.BiConsumer<T,java.util.function.Consumer<Component>> converter)
Register a type of component that needs to be flattened to an intermediate stage.- Type Parameters:
T
- component type- Parameters:
type
- the component typeconverter
- a provider of contained Components- Returns:
- this builder
- Since:
- 4.7.0
-
unknownMapper
@NotNull @NotNull ComponentFlattener.Builder unknownMapper(@Nullable @Nullable java.util.function.Function<Component,java.lang.String> converter)
Register a handler for unknown component types.This will be called if no other converter can be found.
- Parameters:
converter
- the converter, may be null to ignore unknown components- Returns:
- this builder
- Since:
- 4.7.0
-
-