refactoring: EntitiesCollections & add EntityI.className

This commit is contained in:
2019-06-24 15:47:18 +02:00
parent b3d9e7624b
commit 96b335875d
5 changed files with 26 additions and 13 deletions

View File

@@ -2,7 +2,7 @@ package fr.postgresjson.repository
import fr.postgresjson.Serializer
import fr.postgresjson.connexion.Requester
import fr.postgresjson.entity.EntityCollection
import fr.postgresjson.entity.EntitiesCollections
import fr.postgresjson.entity.EntityI
import kotlin.reflect.KClass
@@ -17,7 +17,7 @@ abstract class Repository<T, E : EntityI<T?>>(override val entityName: KClass<E>
fun <T> findById(id: T): EntityI<T?>? {
val sql = requester.getQuery(entityName.toString())
return when (val e = EntityCollection().get(id)) {
return when (val e = EntitiesCollections().get(id)) {
null -> {
// TODO create Request
Serializer().deserialize<T, EntityI<T?>>("""{"plop", "plip"}""")