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(RuntimePersistentEntity<R> entity,
ResultReader<RS,java.lang.String> resultReader,
java.util.Set<JoinPath> joinPaths,
io.micronaut.http.codec.MediaTypeCodec jsonCodec,
java.util.function.BiFunction<RuntimePersistentEntity<java.lang.Object>,java.lang.Object,java.lang.Object> loadListener,
DataConversionService<?> conversionService)
Constructor used to customize the join paths.
|
SqlResultEntityTypeMapper(RuntimePersistentEntity<R> entity,
ResultReader<RS,java.lang.String> resultReader,
java.util.Set<JoinPath> joinPaths,
io.micronaut.http.codec.MediaTypeCodec jsonCodec,
DataConversionService<?> conversionService)
Constructor used to customize the join paths.
|
SqlResultEntityTypeMapper(java.lang.String prefix,
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() |
RuntimePersistentEntity<R> |
getEntity() |
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 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 RuntimePersistentEntity<R> entity, @NonNull ResultReader<RS,java.lang.String> resultReader, @Nullable java.util.Set<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 RuntimePersistentEntity<R> entity, @NonNull ResultReader<RS,java.lang.String> resultReader, @Nullable java.util.Set<JoinPath> joinPaths, @Nullable io.micronaut.http.codec.MediaTypeCodec jsonCodec, @Nullable java.util.function.BiFunction<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 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 DataAccessException
TypeMapper
map
in interface TypeMapper<RS,R>
rs
- The object to maptype
- The typeDataAccessException
- If the object cannot be mapped.@Nullable public java.lang.Object read(@NonNull RS resultSet, @NonNull java.lang.String name)
TypeMapper
read
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)
TypeMapper
read
in interface TypeMapper<RS,R>
resultSet
- The object to read fromargument
- The argumentpublic boolean hasNext(RS resultSet)
SqlTypeMapper
hasNext
in interface SqlTypeMapper<RS,R>
resultSet
- The result setpublic SqlResultEntityTypeMapper.PushingMapper<RS,R> readOneWithJoins()
public SqlResultEntityTypeMapper.PushingMapper<RS,java.util.List<R>> readAllWithJoins()
public RuntimePersistentEntity<R> getPersistentEntity()