-
public interface MapperManager
Mapper manager of all configured mappers.To map a source to target, you can use either of the
map
methods defined in this interface, as they make sure that the mapping exists in either space.- If you call
map(Object, Class, Class)
and no mapper is found for the class pair, the implementation calls themap(Object, io.helidon.common.GenericType, io.helidon.common.GenericType)
withGenericType
s created for each parameters - If you call
map(Object, io.helidon.common.GenericType, io.helidon.common.GenericType)
and no mapper is found for theGenericType
pair, an attempt is to locate a mapper for the underlying class *IF* the generic type represents a simple class (e.g. not a generic type declaration)
- If you call
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
MapperManager.Builder
Fluent API builder forMapperManager
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static MapperManager.Builder
builder()
Create a fluent API builder to create a customized mapper manager.static MapperManager.Builder
builder(HelidonServiceLoader<MapperProvider> serviceLoader)
Create a fluent API builder to create a customized mapper manager based on the provided Helidon Service loader.static MapperManager
create()
Create a mapper manager using only Java Service loader loadedMapperProviders
.static MapperManager
create(HelidonServiceLoader<MapperProvider> serviceLoader)
Create a mapper manager using only the provided Helidon Service loader.<SOURCE,TARGET>
TARGETmap(SOURCE source, GenericType<SOURCE> sourceType, GenericType<TARGET> targetType)
Map from source to target.<SOURCE,TARGET>
TARGETmap(SOURCE source, Class<SOURCE> sourceType, Class<TARGET> targetType)
Map from source to target.
-
-
-
Method Detail
-
builder
static MapperManager.Builder builder()
Create a fluent API builder to create a customized mapper manager.- Returns:
- a new builder
-
create
static MapperManager create()
Create a mapper manager using only Java Service loader loadedMapperProviders
.- Returns:
- create a new mapper manager from service loader
-
builder
static MapperManager.Builder builder(HelidonServiceLoader<MapperProvider> serviceLoader)
Create a fluent API builder to create a customized mapper manager based on the provided Helidon Service loader.- Parameters:
serviceLoader
- fully configured service loader- Returns:
- a new builder
-
create
static MapperManager create(HelidonServiceLoader<MapperProvider> serviceLoader)
Create a mapper manager using only the provided Helidon Service loader. loadedMapperProviders
.- Parameters:
serviceLoader
- fully configured service loader- Returns:
- create a new mapper manager from service loader
-
map
<SOURCE,TARGET> TARGET map(SOURCE source, GenericType<SOURCE> sourceType, GenericType<TARGET> targetType) throws MapperException
Map from source to target.- Type Parameters:
SOURCE
- type of the sourceTARGET
- type of the target- Parameters:
source
- object to mapsourceType
- type of the source object (to locate the mapper)targetType
- type of the target object (to locate the mapper)- Returns:
- result of the mapping
- Throws:
MapperException
- in case the mapper was not found or failed
-
map
<SOURCE,TARGET> TARGET map(SOURCE source, Class<SOURCE> sourceType, Class<TARGET> targetType) throws MapperException
Map from source to target.- Type Parameters:
SOURCE
- type of the sourceTARGET
- type of the target- Parameters:
source
- object to mapsourceType
- class of the source object (to locate the mapper)targetType
- class of the target object (to locate the mapper)- Returns:
- result of the mapping
- Throws:
MapperException
- in case the mapper was not found or failed
-
-