Compare commits

..

1 Commits

Author SHA1 Message Date
7c7aca6d7a Use mapstruct 2020-10-21 21:34:57 +02:00
2 changed files with 10 additions and 19 deletions

View File

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

23
pom.xml
View File

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