Class SqlResultEntityTypeMapper<RS,R>
java.lang.Object
io.micronaut.data.runtime.mapper.sql.SqlResultEntityTypeMapper<RS,R>
- Type Parameters:
RS- The result set typeR- The result type
- All Implemented Interfaces:
SqlTypeMapper<RS,R>, TypeMapper<RS, R>
@Internal
public final class SqlResultEntityTypeMapper<RS,R>
extends Object
implements SqlTypeMapper<RS,R>
A
TypeMapper that can take a RuntimePersistentEntity and a ResultReader
and materialize an instance using column naming conventions mapped by the entity.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe pushing mapper helper interface. -
Constructor Summary
ConstructorsConstructorDescriptionSqlResultEntityTypeMapper(RuntimePersistentEntity<R> entity, ResultReader<RS, String> resultReader, @Nullable Set<JoinPath> joinPaths, @Nullable SqlJsonColumnReader<RS> jsonColumnReader, DataConversionService conversionService) Constructor used to customize the join paths.SqlResultEntityTypeMapper(RuntimePersistentEntity<R> entity, ResultReader<RS, String> resultReader, @Nullable Set<JoinPath> joinPaths, @Nullable SqlJsonColumnReader<RS> jsonColumnReader, @Nullable BiFunction<RuntimePersistentEntity<Object>, Object, Object> loadListener, DataConversionService conversionService) Constructor used to customize the join paths.SqlResultEntityTypeMapper(@Nullable String prefix, RuntimePersistentEntity<R> entity, ResultReader<RS, String> resultReader, @Nullable SqlJsonColumnReader<RS> jsonColumnReader, DataConversionService conversionService) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIs another result available.Map the given result set to the given object.@Nullable ObjectRead a value for the given name from the given object.@Nullable ObjectRead a value for the given name from the given object.readEntity(RS rs) Read the entity from the result set.Read multiple entities with a pushing mapper.Read one entity with a pushing mapper.
-
Constructor Details
-
SqlResultEntityTypeMapper
public SqlResultEntityTypeMapper(@Nullable String prefix, RuntimePersistentEntity<R> entity, ResultReader<RS, String> resultReader, @Nullable SqlJsonColumnReader<RS> jsonColumnReader, DataConversionService conversionService) Default constructor.- Parameters:
prefix- The prefix to startup from.entity- The entityresultReader- The result readerjsonColumnReader- The json column readerconversionService- The conversion service
-
SqlResultEntityTypeMapper
public SqlResultEntityTypeMapper(RuntimePersistentEntity<R> entity, ResultReader<RS, String> resultReader, @Nullable Set<JoinPath> joinPaths, @Nullable SqlJsonColumnReader<RS> jsonColumnReader, DataConversionService conversionService) Constructor used to customize the join paths.- Parameters:
entity- The entityresultReader- The result readerjoinPaths- The join pathsjsonColumnReader- The json column readerconversionService- The conversion service
-
SqlResultEntityTypeMapper
public SqlResultEntityTypeMapper(RuntimePersistentEntity<R> entity, ResultReader<RS, String> resultReader, @Nullable Set<JoinPath> joinPaths, @Nullable SqlJsonColumnReader<RS> jsonColumnReader, @Nullable BiFunction<RuntimePersistentEntity<Object>, Object, Object> loadListener, DataConversionService conversionService) Constructor used to customize the join paths.- Parameters:
entity- The entityresultReader- The result readerjoinPaths- The join pathsjsonColumnReader- The json column readerloadListener- The event listenerconversionService- The conversion service
-
-
Method Details
-
getConversionService
- Specified by:
getConversionServicein interfaceTypeMapper<RS,R> - Returns:
- The conversion service to use.
-
getEntity
- Returns:
- The entity to be materialized
-
getResultReader
- Returns:
- The result reader instance.
-
map
Description copied from interface:TypeMapperMap the given result set to the given object.- Specified by:
mapin interfaceTypeMapper<RS,R> - Parameters:
rs- The object to maptype- The type- Returns:
- The mapped object
- Throws:
DataAccessException- If the object cannot be mapped.
-
readEntity
-
read
Description copied from interface:TypeMapperRead a value for the given name from the given object.- Specified by:
readin interfaceTypeMapper<RS,R> - Parameters:
resultSet- The object to read fromname- The name- Returns:
- The value
-
read
Description copied from interface:TypeMapperRead a value for the given name from the given object.- Specified by:
readin interfaceTypeMapper<RS,R> - Parameters:
resultSet- The object to read fromargument- The argument- Returns:
- The value
-
hasNext
Description copied from interface:SqlTypeMapperIs another result available.- Specified by:
hasNextin interfaceSqlTypeMapper<RS,R> - Parameters:
resultSet- The result set- Returns:
- True if it is
-
readOneMapper
Read one entity with a pushing mapper.- Returns:
- The pushing mapper
-
readManyMapper
Read multiple entities with a pushing mapper.- Returns:
- The pushing mapper
-
getPersistentEntity
-