RS - The result set typeR - The result type@Internal public final class SqlResultEntityTypeMapper<RS,R> extends java.lang.Object implements SqlTypeMapper<RS,R>
TypeMapper that can take a RuntimePersistentEntity and a ResultReader and materialize an instance using
using column naming conventions mapped by the entity.| Modifier and Type | Class and Description |
|---|---|
static interface |
SqlResultEntityTypeMapper.PushingMapper<RS,R>
The pushing mapper helper interface.
|
| Constructor and Description |
|---|
SqlResultEntityTypeMapper(io.micronaut.data.model.runtime.RuntimePersistentEntity<R> entity,
ResultReader<RS,java.lang.String> resultReader,
java.util.Set<io.micronaut.data.model.query.JoinPath> joinPaths,
io.micronaut.http.codec.MediaTypeCodec jsonCodec,
java.util.function.BiFunction<io.micronaut.data.model.runtime.RuntimePersistentEntity<java.lang.Object>,java.lang.Object,java.lang.Object> loadListener,
DataConversionService<?> conversionService)
Constructor used to customize the join paths.
|
SqlResultEntityTypeMapper(io.micronaut.data.model.runtime.RuntimePersistentEntity<R> entity,
ResultReader<RS,java.lang.String> resultReader,
java.util.Set<io.micronaut.data.model.query.JoinPath> joinPaths,
io.micronaut.http.codec.MediaTypeCodec jsonCodec,
DataConversionService<?> conversionService)
Constructor used to customize the join paths.
|
SqlResultEntityTypeMapper(java.lang.String prefix,
io.micronaut.data.model.runtime.RuntimePersistentEntity<R> entity,
ResultReader<RS,java.lang.String> resultReader,
io.micronaut.http.codec.MediaTypeCodec jsonCodec,
DataConversionService<?> conversionService)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
DataConversionService<?> |
getConversionService() |
io.micronaut.data.model.runtime.RuntimePersistentEntity<R> |
getEntity() |
io.micronaut.data.model.runtime.RuntimePersistentEntity<R> |
getPersistentEntity() |
ResultReader<RS,java.lang.String> |
getResultReader() |
boolean |
hasNext(RS resultSet)
Is another result available.
|
R |
map(RS rs,
java.lang.Class<R> type)
Map the given result set to the given object.
|
java.lang.Object |
read(RS resultSet,
io.micronaut.core.type.Argument<?> argument)
Read a value for the given name from the given object.
|
java.lang.Object |
read(RS resultSet,
java.lang.String name)
Read a value for the given name from the given object.
|
SqlResultEntityTypeMapper.PushingMapper<RS,java.util.List<R>> |
readAllWithJoins()
Read multiple entities with a pushing mapper.
|
SqlResultEntityTypeMapper.PushingMapper<RS,R> |
readOneWithJoins()
Read one entity with a pushing mapper.
|
public SqlResultEntityTypeMapper(java.lang.String prefix,
@NonNull
io.micronaut.data.model.runtime.RuntimePersistentEntity<R> entity,
@NonNull
ResultReader<RS,java.lang.String> resultReader,
@Nullable
io.micronaut.http.codec.MediaTypeCodec jsonCodec,
DataConversionService<?> conversionService)
prefix - The prefix to startup from.entity - The entityresultReader - The result readerjsonCodec - The JSON codecconversionService - The conversion servicepublic SqlResultEntityTypeMapper(@NonNull
io.micronaut.data.model.runtime.RuntimePersistentEntity<R> entity,
@NonNull
ResultReader<RS,java.lang.String> resultReader,
@Nullable
java.util.Set<io.micronaut.data.model.query.JoinPath> joinPaths,
@Nullable
io.micronaut.http.codec.MediaTypeCodec jsonCodec,
DataConversionService<?> conversionService)
entity - The entityresultReader - The result readerjoinPaths - The join pathsjsonCodec - The JSON codecconversionService - The conversion servicepublic SqlResultEntityTypeMapper(@NonNull
io.micronaut.data.model.runtime.RuntimePersistentEntity<R> entity,
@NonNull
ResultReader<RS,java.lang.String> resultReader,
@Nullable
java.util.Set<io.micronaut.data.model.query.JoinPath> joinPaths,
@Nullable
io.micronaut.http.codec.MediaTypeCodec jsonCodec,
@Nullable
java.util.function.BiFunction<io.micronaut.data.model.runtime.RuntimePersistentEntity<java.lang.Object>,java.lang.Object,java.lang.Object> loadListener,
DataConversionService<?> conversionService)
entity - The entityresultReader - The result readerjoinPaths - The join pathsjsonCodec - The JSON codecloadListener - The event listenerconversionService - The conversion servicepublic DataConversionService<?> getConversionService()
getConversionService in interface TypeMapper<RS,R>@NonNull public io.micronaut.data.model.runtime.RuntimePersistentEntity<R> getEntity()
@NonNull public ResultReader<RS,java.lang.String> getResultReader()
@NonNull public R map(@NonNull RS rs, @NonNull java.lang.Class<R> type) throws io.micronaut.data.exceptions.DataAccessException
TypeMappermap in interface TypeMapper<RS,R>rs - The object to maptype - The typeio.micronaut.data.exceptions.DataAccessException - If the object cannot be mapped.@Nullable
public java.lang.Object read(@NonNull
RS resultSet,
@NonNull
java.lang.String name)
TypeMapperread in interface TypeMapper<RS,R>resultSet - The object to read fromname - The name@Nullable
public java.lang.Object read(@NonNull
RS resultSet,
@NonNull
io.micronaut.core.type.Argument<?> argument)
TypeMapperread in interface TypeMapper<RS,R>resultSet - The object to read fromargument - The argumentpublic boolean hasNext(RS resultSet)
SqlTypeMapperhasNext in interface SqlTypeMapper<RS,R>resultSet - The result setpublic SqlResultEntityTypeMapper.PushingMapper<RS,R> readOneWithJoins()
public SqlResultEntityTypeMapper.PushingMapper<RS,java.util.List<R>> readAllWithJoins()
public io.micronaut.data.model.runtime.RuntimePersistentEntity<R> getPersistentEntity()