Class SqlJsonColumnMapperProvider<S>
java.lang.Object
io.micronaut.data.runtime.operations.internal.sql.SqlJsonColumnMapperProvider<S>
- Type Parameters:
S
- the reader result set type
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
- Author:
- radovanradic
-
Constructor Summary
ConstructorDescriptionSqlJsonColumnMapperProvider
(@Nullable io.micronaut.json.JsonMapper jsonMapper, List<SqlJsonColumnReader<S>> sqlJsonColumnReaders, List<SqlJsonValueMapper> sqlJsonValueMappers) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptiongetJsonColumnReader
(SqlPreparedQuery<?, ?> sqlPreparedQuery, Class<S> resultSetType) ProvidesSqlJsonColumnReader
for given SQL prepared query.getJsonValueMapper
(SqlStoredQuery<?, ?> sqlStoredQuery, JsonDataType jsonDataType, Object value) ProvidesSqlJsonValueMapper
for given SQL stored query.
-
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 mappersqlJsonColumnReaders
- list of custom SQL JSON column readerssqlJsonValueMappers
- list of custom SQL JSON value mappers
-
-
Method Details
-
getJsonColumnReader
public SqlJsonColumnReader<S> getJsonColumnReader(SqlPreparedQuery<?, ?> sqlPreparedQuery, Class<S> resultSetType) ProvidesSqlJsonColumnReader
for given SQL prepared query. If there is specificSqlJsonColumnReader
that supports given prepared query and result set type then it will be returned. Otherwise, it will return defaultSqlJsonColumnReader
.- Parameters:
sqlPreparedQuery
- the SQL prepared queryresultSetType
- the result set type (for R2Dbc and Jdbc it is different for example)- Returns:
- the
SqlJsonColumnReader
for given SQL prepared query, or defaultSqlJsonColumnReader
if prepared query does not have specific one that it supports
-
getJsonValueMapper
public SqlJsonValueMapper getJsonValueMapper(SqlStoredQuery<?, ?> sqlStoredQuery, JsonDataType jsonDataType, Object value) ProvidesSqlJsonValueMapper
for given SQL stored query. If there is specificSqlJsonValueMapper
that supports given stored query then it will be returned. Otherwise, it will return defaultSqlJsonValueMapper
.- Parameters:
sqlStoredQuery
- the SQL stored queryjsonDataType
- the JSON representation typevalue
- the value to be mapped- Returns:
- the
SqlJsonValueMapper
for given SQL stored query, or defaultSqlJsonValueMapper
if stored query does not have specific one that it supports
-