Class MappersConfig.BuilderBase<BUILDER extends MappersConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends MappersConfig>
- Type Parameters:
BUILDER
- type of the builder extending this abstract builderPROTOTYPE
- type of the prototype interface that would be built byPrototype.Builder.buildPrototype()
- All Implemented Interfaces:
Prototype.Builder<BUILDER,
PROTOTYPE>
- Direct Known Subclasses:
MappersConfig.Builder
- Enclosing interface:
MappersConfig
Mappers
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Generated implementation of the prototype, can be extended by descendant prototype implementations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionMappers discovered throughServiceRegistry
, or explicitly created that implement bothMapper.sourceType()
andMapper.targetType()
methods.<S,
T> BUILDER addMapper
(Mapper<S, T> mapper, GenericType<S> sourceType, GenericType<T> targetType, double weight, String... qualifiers) Add a mapper to the list of mapper with custom priority.<S,
T> BUILDER addMapper
(Mapper<S, T> mapper, GenericType<S> sourceType, GenericType<T> targetType, String... qualifiers) Add a mapper to the list of mapper.<S,
T> BUILDER addMapper
(Mapper<S, T> mapper, Class<S> sourceType, Class<T> targetType, double weight, String... qualifiers) Add a mapper to the list of mapper with a custom priority.<S,
T> BUILDER Add a mapper to the list of mapper.addMapperProvider
(MapperProvider mapperProvider) Mapper providers allow for introduction of new mappers into the system.addMapperProviders
(List<? extends MapperProvider> mapperProviders) Mapper providers allow for introduction of new mappers into the system.addMappers
(List<Mapper<?, ?>> mappers) Mappers discovered throughServiceRegistry
, or explicitly created that implement bothMapper.sourceType()
andMapper.targetType()
methods.from
(MappersConfig prototype) Update this builder from an existing prototype instance.from
(MappersConfig.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.Mapper providers allow for introduction of new mappers into the system.mapperProviders
(List<? extends MapperProvider> mapperProviders) Mapper providers allow for introduction of new mappers into the system.mapperProvidersDiscoverServices
(boolean discoverServices) Mapper providers allow for introduction of new mappers into the system.mappers()
Mappers discovered throughServiceRegistry
, or explicitly created that implement bothMapper.sourceType()
andMapper.targetType()
methods.Mappers discovered throughServiceRegistry
, or explicitly created that implement bothMapper.sourceType()
andMapper.targetType()
methods.mappersDiscoverServices
(boolean discoverServices) Mappers discovered throughServiceRegistry
, or explicitly created that implement bothMapper.sourceType()
andMapper.targetType()
methods.protected void
Handles providers and decorators.serviceRegistry
(ServiceRegistry registry) Provide an explicit registry instance to use.toString()
boolean
Whether to use built-in mappers.useBuiltInMappers
(boolean useBuiltInMappers) Whether to use built-in mappers.protected void
Validates required properties.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.helidon.builder.api.Prototype.Builder
buildPrototype, self
-
Constructor Details
-
BuilderBase
protected BuilderBase()Protected to support extensibility.
-
-
Method Details
-
from
Update this builder from an existing prototype instance. This method disables automatic service discovery.- Parameters:
prototype
- existing prototype to update this builder from- Returns:
- updated builder instance
-
from
Update this builder from an existing prototype builder instance.- Parameters:
builder
- existing builder prototype to update this builder from- Returns:
- updated builder instance
-
addMapper
public <S,T> BUILDER addMapper(Mapper<S, T> mapper, Class<S> sourceType, Class<T> targetType, String... qualifiers) Add a mapper to the list of mapper.- Type Parameters:
S
- type of sourceT
- type of target- Parameters:
mapper
- the mapper to map source instances to target instancessourceType
- class of the source instancetargetType
- class of the target instancequalifiers
- supported qualifiers of this mapper (if none provided, will return a compatible response)- Returns:
- updated builder instance
-
addMapper
public <S,T> BUILDER addMapper(Mapper<S, T> mapper, GenericType<S> sourceType, GenericType<T> targetType, String... qualifiers) Add a mapper to the list of mapper.- Type Parameters:
S
- type of sourceT
- type of target- Parameters:
mapper
- the mapper to map source instances to target instancessourceType
- generic type of the source instancetargetType
- generic type of the target instancequalifiers
- qualifiers of this mapper, if empty, will be a compatible mapper- Returns:
- updated builder instance
-
addMapper
public <S,T> BUILDER addMapper(Mapper<S, T> mapper, Class<S> sourceType, Class<T> targetType, double weight, String... qualifiers) Add a mapper to the list of mapper with a custom priority.- Type Parameters:
S
- type of sourceT
- type of target- Parameters:
mapper
- the mapper to map source instances to target instancessourceType
- class of the source instancetargetType
- class of the target instanceweight
- weight of the mapperqualifiers
- supported qualifiers of this mapper (if none provided, will return a compatible response)- Returns:
- updated builder instance
-
addMapper
public <S,T> BUILDER addMapper(Mapper<S, T> mapper, GenericType<S> sourceType, GenericType<T> targetType, double weight, String... qualifiers) Add a mapper to the list of mapper with custom priority.- Type Parameters:
S
- type of sourceT
- type of target- Parameters:
mapper
- the mapper to map source instances to target instancessourceType
- generic type of the source instancetargetType
- generic type of the target instanceweight
- weight of the mapperqualifiers
- qualifiers of this mapper, if empty, will be a compatible mapper- Returns:
- updated builder instance
-
serviceRegistry
Provide an explicit registry instance to use.If not configured, the
GlobalServiceRegistry
would be used to discover services.- Parameters:
registry
- service registry instance- Returns:
- updated builder instance
-
mapperProvidersDiscoverServices
Mapper providers allow for introduction of new mappers into the system. A mapper provider can be exposed either as aServiceRegistry
service, or aServiceLoader
, but never both.Mapper providers are ordered by their
Weight
.- Parameters:
discoverServices
- whether to discover implementations through service loader- Returns:
- updated builder instance
- See Also:
-
mapperProviders
Mapper providers allow for introduction of new mappers into the system. A mapper provider can be exposed either as aServiceRegistry
service, or aServiceLoader
, but never both.Mapper providers are ordered by their
Weight
.- Parameters:
mapperProviders
- a list of configured mapper providers- Returns:
- updated builder instance
- See Also:
-
addMapperProviders
Mapper providers allow for introduction of new mappers into the system. A mapper provider can be exposed either as aServiceRegistry
service, or aServiceLoader
, but never both.Mapper providers are ordered by their
Weight
.- Parameters:
mapperProviders
- a list of configured mapper providers- Returns:
- updated builder instance
- See Also:
-
addMapperProvider
Mapper providers allow for introduction of new mappers into the system. A mapper provider can be exposed either as aServiceRegistry
service, or aServiceLoader
, but never both.Mapper providers are ordered by their
Weight
.- Parameters:
mapperProvider
- a list of configured mapper providers- Returns:
- updated builder instance
- See Also:
-
mappersDiscoverServices
Mappers discovered throughServiceRegistry
, or explicitly created that implement bothMapper.sourceType()
andMapper.targetType()
methods.Mappers are ordered by
Weight
together withMappersConfigBlueprint.mapperProviders()
to create a single list.- Parameters:
discoverServices
- whether to discover implementations through service loader- Returns:
- updated builder instance
- See Also:
-
mappers
Mappers discovered throughServiceRegistry
, or explicitly created that implement bothMapper.sourceType()
andMapper.targetType()
methods.Mappers are ordered by
Weight
together withMappersConfigBlueprint.mapperProviders()
to create a single list.- Parameters:
mappers
- list of mappers- Returns:
- updated builder instance
- See Also:
-
addMappers
Mappers discovered throughServiceRegistry
, or explicitly created that implement bothMapper.sourceType()
andMapper.targetType()
methods.Mappers are ordered by
Weight
together withMappersConfigBlueprint.mapperProviders()
to create a single list.- Parameters:
mappers
- list of mappers- Returns:
- updated builder instance
- See Also:
-
addMapper
Mappers discovered throughServiceRegistry
, or explicitly created that implement bothMapper.sourceType()
andMapper.targetType()
methods.Mappers are ordered by
Weight
together withMappersConfigBlueprint.mapperProviders()
to create a single list.- Parameters:
mapper
- list of mappers- Returns:
- updated builder instance
- See Also:
-
useBuiltInMappers
Whether to use built-in mappers. Defaults totrue
.- Parameters:
useBuiltInMappers
- whether to use built in mappers (such as String to Integer)- Returns:
- updated builder instance
- See Also:
-
mapperProviders
Mapper providers allow for introduction of new mappers into the system. A mapper provider can be exposed either as aServiceRegistry
service, or aServiceLoader
, but never both.Mapper providers are ordered by their
Weight
.- Returns:
- the mapper providers
-
mappers
Mappers discovered throughServiceRegistry
, or explicitly created that implement bothMapper.sourceType()
andMapper.targetType()
methods.Mappers are ordered by
Weight
together withMappersConfigBlueprint.mapperProviders()
to create a single list.- Returns:
- the mappers
-
useBuiltInMappers
public boolean useBuiltInMappers()Whether to use built-in mappers. Defaults totrue
.- Returns:
- the use built in mappers
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties.
-