Interface Mapper<S,T>
- Type Parameters:
S
- the source typeT
- the target type
- All Known Subinterfaces:
Mapper.BiMapper<S,
,T> Mapper.UniMapper<S,
T>
A mapper is responsible for converting a source type
S
into a target type T
.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A subtype ofMapper
that can convert the source typeS
into the target typeT
, but can also convert the target typeT
back into the source typeS
.static final record
Provides additional information about the mapping.static interface
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <S,
T> Mapper.BiMapper <S, T> bi
(@NotNull BiFunction<S, Mapper.MappingContext<S, T>, MappingResult<T>> from, @NotNull BiFunction<T, Mapper.MappingContext<T, S>, MappingResult<S>> into) Creates anMapper.BiMapper
that can convert from a source typeS
into a target typeT
, but can also reversely convert from the target typeT
into the source typeS
.static <S,
T> Mapper.UniMapper <S, T> uni
(@NotNull BiFunction<S, Mapper.MappingContext<S, T>, MappingResult<T>> mapper)
-
Method Details
-
uni
static <S,T> Mapper.UniMapper<S,T> uni(@NotNull @NotNull BiFunction<S, Mapper.MappingContext<S, T>, MappingResult<T>> mapper) - Type Parameters:
S
- the source typeT
- the target type- Parameters:
mapper
- theBiFunction
that converts the source type into the target type- Returns:
- a new
Mapper.UniMapper
-
bi
static <S,T> Mapper.BiMapper<S,T> bi(@NotNull @NotNull BiFunction<S, Mapper.MappingContext<S, T>, MappingResult<T>> from, @NotNull @NotNull BiFunction<T, Mapper.MappingContext<T, S>, MappingResult<S>> into) Creates anMapper.BiMapper
that can convert from a source typeS
into a target typeT
, but can also reversely convert from the target typeT
into the source typeS
.- Type Parameters:
S
- the source typeT
- the target type- Parameters:
from
- theBiFunction
that converts the source type into the target typeinto
- theBiFunction
that converts the target type into the source type- Returns:
- a new
Mapper.UniMapper
-