Class JsonQueryResultMapper<T,RS,R>

java.lang.Object
io.micronaut.data.runtime.mapper.sql.JsonQueryResultMapper<T,RS,R>
Type Parameters:
T - The entity type
RS - The result set type
R - The result type
All Implemented Interfaces:
SqlTypeMapper<RS,R>, TypeMapper<RS,R>

public class JsonQueryResultMapper<T,RS,R> extends Object implements SqlTypeMapper<RS,R>
The JSON query result mapper. Transforms result from single column with JSON value into the given entity.
Since:
4.0.0.
  • Constructor Details

    • JsonQueryResultMapper

      public JsonQueryResultMapper(@NonNull @NonNull String columnName, @NonNull @NonNull io.micronaut.data.model.JsonDataType jsonDataType, @NonNull @NonNull io.micronaut.data.model.runtime.RuntimePersistentEntity<T> entity, @NonNull @NonNull ResultReader<RS,String> resultReader, @NonNull @NonNull SqlJsonColumnReader<RS> sqlJsonColumnReader, @Nullable @Nullable BiFunction<io.micronaut.data.model.runtime.RuntimePersistentEntity<Object>,Object,Object> eventListener)
  • Method Details

    • map

      public R map(RS rs, Class<R> type) throws io.micronaut.data.exceptions.DataAccessException
      Description copied from interface: TypeMapper
      Map the given result set to the given object.
      Specified by:
      map in interface TypeMapper<T,RS>
      Parameters:
      rs - The object to map
      type - The type
      Returns:
      The mapped object
      Throws:
      io.micronaut.data.exceptions.DataAccessException - If the object cannot be mapped.
    • read

      public Object read(RS object, String name)
      Description copied from interface: TypeMapper
      Read a value for the given name from the given object.
      Specified by:
      read in interface TypeMapper<T,RS>
      Parameters:
      object - The object to read from
      name - The name
      Returns:
      The value
    • hasNext

      public boolean hasNext(RS resultSet)
      Description copied from interface: SqlTypeMapper
      Is another result available.
      Specified by:
      hasNext in interface SqlTypeMapper<T,RS>
      Parameters:
      resultSet - The result set
      Returns:
      True if it is