Compare commits

..

1 Commits

Author SHA1 Message Date
32337ec308 Use mapstruct 2020-10-21 22:02:34 +02:00
2 changed files with 19 additions and 10 deletions

View File

@ -3,7 +3,9 @@ package be.simplenotes.persistance
import be.simplenotes.domain.usecases.repositories.NoteRepository
import be.simplenotes.domain.usecases.repositories.UserRepository
import be.simplenotes.persistance.converters.NoteConverter
import be.simplenotes.persistance.converters.NoteConverterImpl
import be.simplenotes.persistance.converters.UserConverter
import be.simplenotes.persistance.converters.UserConverterImpl
import be.simplenotes.persistance.notes.NoteRepositoryImpl
import be.simplenotes.persistance.users.UserRepositoryImpl
import be.simplenotes.shared.config.DataSourceConfig
@ -33,8 +35,8 @@ val migrationModule = module {
}
val persistanceModule = module {
single<NoteConverter> { Mappers.getMapper(NoteConverter::class.java) }
single<UserConverter> { Mappers.getMapper(UserConverter::class.java) }
single<NoteConverter> { NoteConverterImpl() }
single<UserConverter> { UserConverterImpl() }
single<UserRepository> { UserRepositoryImpl(get(), get()) }
single<NoteRepository> { NoteRepositoryImpl(get(), get()) }
single { hikariDataSource(get()) } bind DataSource::class onClose { it?.close() }

23
pom.xml
View File

@ -101,6 +101,21 @@
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>kapt</id>
<goals>
<goal>kapt</goal>
</goals>
<configuration>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
</execution>
<execution>
<id>compile</id>
<phase>process-sources</phase>
@ -120,18 +135,10 @@
<arg>-Xno-param-assertions</arg>
<arg>-Xno-call-assertions</arg>
<arg>-Xno-receiver-assertions</arg>
<arg>-Xjvm-default=enable</arg>
</args>
<compilerPlugins>
<plugin>kotlinx-serialization</plugin>
</compilerPlugins>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
<dependencies>
<dependency>