T
- The entity typeS
- The source type.R
- The result typepublic class DTOMapper<T,S,R> extends java.lang.Object implements BeanIntrospectionMapper<S,R>
BeanIntrospectionMapper
that reads the result using the specified
PersistentEntity
and ResultReader
and using the BeanIntrospectionMapper.map(Object, Class)
allows mapping a result to a introspected Data Transfer Object (DTO).Constructor and Description |
---|
DTOMapper(RuntimePersistentEntity<T> persistentEntity,
ResultReader<S,java.lang.String> resultReader)
Default constructor.
|
DTOMapper(RuntimePersistentEntity<T> persistentEntity,
ResultReader<S,java.lang.String> resultReader,
io.micronaut.http.codec.MediaTypeCodec jsonCodec)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
PersistentEntity |
getPersistentEntity() |
ResultReader<S,java.lang.String> |
getResultReader() |
java.lang.Object |
read(S object,
io.micronaut.core.type.Argument<?> argument)
Read a value for the given name from the given object.
|
java.lang.Object |
read(S resultSet,
RuntimePersistentProperty<T> property)
Read the given property.
|
java.lang.Object |
read(S object,
java.lang.String name)
Read a value for the given name from the given object.
|
java.lang.Object |
read(S resultSet,
java.lang.String persistedName,
DataType dataType)
Read the value from the given result set for the given persisted name and data type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
map
getConversionService
public DTOMapper(RuntimePersistentEntity<T> persistentEntity, ResultReader<S,java.lang.String> resultReader)
persistentEntity
- The entityresultReader
- The result readerpublic DTOMapper(RuntimePersistentEntity<T> persistentEntity, ResultReader<S,java.lang.String> resultReader, @Nullable io.micronaut.http.codec.MediaTypeCodec jsonCodec)
persistentEntity
- The entityresultReader
- The result readerjsonCodec
- The JSON codec@Nullable public java.lang.Object read(@NonNull S object, @NonNull java.lang.String name) throws io.micronaut.core.convert.exceptions.ConversionErrorException
TypeMapper
read
in interface TypeMapper<S,R>
object
- The object to read fromname
- The nameio.micronaut.core.convert.exceptions.ConversionErrorException
@Nullable public java.lang.Object read(@NonNull S object, @NonNull io.micronaut.core.type.Argument<?> argument)
TypeMapper
read
in interface TypeMapper<S,R>
object
- The object to read fromargument
- The argument@Nullable public java.lang.Object read(@NonNull S resultSet, @NonNull RuntimePersistentProperty<T> property)
resultSet
- The result setproperty
- THe property@Nullable public java.lang.Object read(@NonNull S resultSet, @NonNull java.lang.String persistedName, @NonNull DataType dataType)
resultSet
- The result setpersistedName
- The persisted namedataType
- The data typepublic PersistentEntity getPersistentEntity()
public ResultReader<S,java.lang.String> getResultReader()