org.apache.tinkerpop.gremlin.ogm.mappers.ObjectSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-gremlin-ogm Show documentation
Show all versions of kotlin-gremlin-ogm Show documentation
The Object Graph Mapping Library for Kotlin and Gremlin
package org.apache.tinkerpop.gremlin.ogm.mappers
import org.apache.tinkerpop.gremlin.ogm.reflection.GraphDescription
import org.apache.tinkerpop.gremlin.ogm.reflection.ObjectDescription
internal class ObjectSerializer(
private val graphDescription: GraphDescription,
private val objectDescription: ObjectDescription
) : Mapper> {
override fun invoke(from: T): Map =
objectDescription.properties.mapValues {
val propertyDescription = it.value
val unserializedPropertyValue = propertyDescription.property.get(from)
val serializer = PropertySerializer(graphDescription, propertyDescription)
serializer(unserializedPropertyValue)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy