Interface MapperRegistry
- All Known Implementing Classes:
SimpleMapperRegistry
public interface MapperRegistry
Maps instances of one type to another. Originally implemented by Dozer, but now a generic interface due to the
deprecation of Dozer.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interfaceRepresents a mapping between two types.static interfaceRepresents a mapping between two types.static interface -
Method Summary
Modifier and TypeMethodDescriptionfindGenericTypeArgumentFromMapper(Class<?> aClass, int index) Finds the geneirc type argument for the supplied class..findGenericTypeArgumentFromUpdater(Class<?> aClass, int index) Finds the geneirc type argument for the supplied class..<SourceT,DestinationT>
Optional<MapperRegistry.Mapper<SourceT, DestinationT>> findMapper(Class<SourceT> source, Class<DestinationT> destination) Finds aMapperRegistry.Mapper.<SourceT,DestinationT>
Optional<MapperRegistry.Updater<SourceT, DestinationT>> findUpdater(Class<SourceT> source, Class<DestinationT> destination) Finds anMapperRegistry.Updater.default <SourceT,DestinationT>
MapperRegistry.Mapper<SourceT, DestinationT> Gets aMapperRegistry.Mapper.default <SourceT,DestinationT>
MapperRegistry.Updater<SourceT, DestinationT> getUpdater(Class<SourceT> source, Class<DestinationT> destination) Gets anMapperRegistry.Updater.default <SourceT,DestinationT>
voidmap(SourceT source, DestinationT destination) Maps the source Object into the supplied destination Object, mutating the destination while preserving the source w/o modification.default <SourceT,DestinationT>
DestinationTMaps instances of one type to another.Stream<MapperRegistry.Mapper<?, ?>> mappers()Gets all the mappers registered in this registry.Stream<MapperRegistry.Updater<?, ?>> updaters()Gets all the updaters registered in this registry.
-
Method Details
-
mappers
Stream<MapperRegistry.Mapper<?,?>> mappers()Gets all the mappers registered in this registry.- Returns:
- all mappers
-
updaters
Stream<MapperRegistry.Updater<?,?>> updaters()Gets all the updaters registered in this registry.- Returns:
- all updaters
-
map
default <SourceT,DestinationT> void map(SourceT source, DestinationT destination) Maps the source Object into the supplied destination Object, mutating the destination while preserving the source w/o modification.- Parameters:
source- the source objectdestination- the destination object
-
map
default <SourceT,DestinationT> DestinationT map(SourceT source, Class<DestinationT> destinationClass) Maps instances of one type to another.- Parameters:
source- the source typedestinationClass- the destination type- Returns:
- the destination object
-
getMapper
default <SourceT,DestinationT> MapperRegistry.Mapper<SourceT,DestinationT> getMapper(Class<SourceT> source, Class<DestinationT> destination) Gets aMapperRegistry.Mapper. ThrowingMapperExceptionin the event the mapping isn't found.- Type Parameters:
SourceT- the source typeDestinationT- the destination type- Parameters:
source- the source typedestination- the destination type- Returns:
- the
MapperRegistry.Mapper
-
findMapper
<SourceT,DestinationT> Optional<MapperRegistry.Mapper<SourceT,DestinationT>> findMapper(Class<SourceT> source, Class<DestinationT> destination) Finds aMapperRegistry.Mapper. ThrowingMapperExceptionin the event the mapping isn't found.- Type Parameters:
SourceT- the source typeDestinationT- the destination type- Parameters:
source- the source typedestination- the destination type- Returns:
- the
MapperRegistry.Mapper
-
getUpdater
default <SourceT,DestinationT> MapperRegistry.Updater<SourceT,DestinationT> getUpdater(Class<SourceT> source, Class<DestinationT> destination) Gets anMapperRegistry.Updater. ThrowingMapperExceptionin the event the mapping isn't found.- Type Parameters:
SourceT- the source typeDestinationT- the destination type- Parameters:
source- the source typedestination- the destination type- Returns:
- the
MapperRegistry.Mapper
-
findUpdater
<SourceT,DestinationT> Optional<MapperRegistry.Updater<SourceT,DestinationT>> findUpdater(Class<SourceT> source, Class<DestinationT> destination) Finds anMapperRegistry.Updater. ThrowingMapperExceptionin the event the mapping isn't found.- Type Parameters:
SourceT- the source typeDestinationT- the destination type- Parameters:
source- the source typedestination- the destination type- Returns:
- the
MapperRegistry.Mapper
-
findGenericTypeArgumentFromMapper
Finds the geneirc type argument for the supplied class..- Parameters:
aClass- the classindex- the index- Returns:
- the generic type argument
-
findGenericTypeArgumentFromUpdater
Finds the geneirc type argument for the supplied class..- Parameters:
aClass- the classindex- the index- Returns:
- the generic type argument
-