Interface ComponentFlattener.Builder
- All Superinterfaces:
AbstractBuilder<ComponentFlattener>
- Enclosing interface:
ComponentFlattener
public static sealed interface ComponentFlattener.Builder
extends AbstractBuilder<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
Modifier and TypeMethodDescription<T extends Component>
ComponentFlattener.BuildercomplexMapper(Class<T> type, BiConsumer<T, Consumer<Component>> converter) Register a type of component that needs to be flattened to an intermediate stage.<T extends Component>
ComponentFlattener.BuilderRegister a type of component to be handled.nestingLimit(@Range(from=1L,to=2147483647L) int limit) Sets the limit of nested flatten calls.unknownMapper(@Nullable Function<Component, String> converter) Register a handler for unknown component types.Methods inherited from interface AbstractBuilder
build
-
Method Details
-
mapper
<T extends Component> ComponentFlattener.Builder mapper(Class<T> type, Function<T, 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:
-
complexMapper
<T extends Component> ComponentFlattener.Builder complexMapper(Class<T> type, BiConsumer<T, 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
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
-
nestingLimit
Sets the limit of nested flatten calls.Unless the property is changed, the default value is
ComponentFlattener.NO_NESTING_LIMIT, which means there is no limit on nesting.- Parameters:
limit- the new limit (must be a positive integer, orComponentFlattener.NO_NESTING_LIMIT)- Returns:
- this builder
- Since:
- 4.22.0
-