Interface TypeMapper<D,R>

Type Parameters:
D - The source type.
R - The result type
All Known Subinterfaces:
BeanIntrospectionMapper<D,R>, SqlTypeMapper<RS,R>
All Known Implementing Classes:
DTOMapper, JsonQueryResultMapper, SqlDTOMapper, SqlResultEntityTypeMapper

public interface TypeMapper<D,R>
A context object to facilitate and ease mapping objects programmatically.
Since:
1.0.0
Author:
graemerocher
  • Method Summary

    Modifier and Type
    Method
    Description
    default @NonNull io.micronaut.core.convert.ConversionService
     
    map(D object, @NonNull Class<R> type)
    Map the given result set to the given object.
    default @Nullable Object
    read(D object, @NonNull io.micronaut.core.type.Argument<?> argument)
    Read a value for the given name from the given object.
    @Nullable Object
    read(D object, @NonNull String name)
    Read a value for the given name from the given object.
  • Method Details

    • map

      @NonNull R map(@NonNull D object, @NonNull @NonNull Class<R> type) throws DataAccessException
      Map the given result set to the given object.
      Parameters:
      object - The object to map
      type - The type
      Returns:
      The mapped object
      Throws:
      DataAccessException - If the object cannot be mapped.
    • read

      @Nullable @Nullable Object read(@NonNull D object, @NonNull @NonNull String name)
      Read a value for the given name from the given object.
      Parameters:
      object - The object to read from
      name - The name
      Returns:
      The value
    • read

      @Nullable default @Nullable Object read(@NonNull D object, @NonNull @NonNull io.micronaut.core.type.Argument<?> argument)
      Read a value for the given name from the given object.
      Parameters:
      object - The object to read from
      argument - The argument
      Returns:
      The value
    • getConversionService

      @NonNull default @NonNull io.micronaut.core.convert.ConversionService getConversionService()
      Returns:
      The conversion service to use.