Class SqlJsonColumnMapperProvider<S>

java.lang.Object
io.micronaut.data.runtime.operations.internal.sql.SqlJsonColumnMapperProvider<S>
Type Parameters:
S - the reader result set type

@Internal @Singleton public final class SqlJsonColumnMapperProvider<S> extends Object
The provider for SqlJsonValueMapper when JSON columns are being written using SqlStoredQuery and for SqlJsonColumnReader when JSON columns are being read from SqlPreparedQuery results.
Since:
4.0.0
  • Constructor Details

    • SqlJsonColumnMapperProvider

      public SqlJsonColumnMapperProvider(@Nullable @Nullable io.micronaut.json.JsonMapper jsonMapper, List<SqlJsonColumnReader<S>> sqlJsonColumnReaders, List<SqlJsonValueMapper> sqlJsonValueMappers)
      Default constructor.
      Parameters:
      jsonMapper - the default JSON mapper
      sqlJsonColumnReaders - list of custom SQL JSON column readers
      sqlJsonValueMappers - list of custom SQL JSON value mappers
  • Method Details

    • getJsonColumnReader

      public SqlJsonColumnReader<S> getJsonColumnReader(SqlStoredQuery<?,?> sqlStoredQuery, Class<S> resultSetType)
      Provides SqlJsonColumnReader for given SQL prepared query. If there is specific SqlJsonColumnReader that supports given prepared query and result set type then it will be returned. Otherwise, it will return default SqlJsonColumnReader.
      Parameters:
      sqlStoredQuery - the SQL stored query
      resultSetType - the result set type (for R2Dbc and Jdbc it is different for example)
      Returns:
      the SqlJsonColumnReader for given SQL prepared query, or default SqlJsonColumnReader if prepared query does not have specific one that it supports
    • getJsonValueMapper

      public SqlJsonValueMapper getJsonValueMapper(SqlStoredQuery<?,?> sqlStoredQuery, io.micronaut.data.model.JsonDataType jsonDataType, Object value)
      Provides SqlJsonValueMapper for given SQL stored query. If there is specific SqlJsonValueMapper that supports given stored query then it will be returned. Otherwise, it will return default SqlJsonValueMapper.
      Parameters:
      sqlStoredQuery - the SQL stored query
      jsonDataType - the JSON representation type
      value - the value to be mapped
      Returns:
      the SqlJsonValueMapper for given SQL stored query, or default SqlJsonValueMapper if stored query does not have specific one that it supports