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.Constructor and Description |
---|
SqlResultEntityTypeMapper(RuntimePersistentEntity<R> entity,
ResultReader<RS,java.lang.String> resultReader,
io.micronaut.http.codec.MediaTypeCodec jsonCodec)
Default constructor.
|
SqlResultEntityTypeMapper(RuntimePersistentEntity<R> entity,
ResultReader<RS,java.lang.String> resultReader,
java.util.Set<JoinPath> joinPaths,
io.micronaut.http.codec.MediaTypeCodec jsonCodec)
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)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
RuntimePersistentEntity<R> |
getEntity() |
ResultReader<RS,java.lang.String> |
getResultReader() |
boolean |
hasNext(RS resultSet)
Is another result available.
|
R |
map(RS object,
java.lang.Class<R> type)
Map the given result set to the given object.
|
java.lang.Object |
read(RS resultSet,
java.lang.String name)
Read a value for the given name from the given object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConversionService
public SqlResultEntityTypeMapper(@NonNull RuntimePersistentEntity<R> entity, @NonNull ResultReader<RS,java.lang.String> resultReader, @Nullable io.micronaut.http.codec.MediaTypeCodec jsonCodec)
entity
- The entityresultReader
- The result readerjsonCodec
- The json codecpublic SqlResultEntityTypeMapper(java.lang.String prefix, @NonNull RuntimePersistentEntity<R> entity, @NonNull ResultReader<RS,java.lang.String> resultReader, @Nullable io.micronaut.http.codec.MediaTypeCodec jsonCodec)
prefix
- The prefix to startup from.entity
- The entityresultReader
- The result readerjsonCodec
- The JSON codecpublic 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)
entity
- The entityresultReader
- The result readerjoinPaths
- The join pathsjsonCodec
- The JSON codec@NonNull public RuntimePersistentEntity<R> getEntity()
@NonNull public ResultReader<RS,java.lang.String> getResultReader()
@NonNull public R map(@NonNull RS object, @NonNull java.lang.Class<R> type) throws DataAccessException
TypeMapper
map
in interface TypeMapper<RS,R>
object
- 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 namepublic boolean hasNext(RS resultSet)
SqlTypeMapper
hasNext
in interface SqlTypeMapper<RS,R>
resultSet
- The result set