All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.tinkerpop.gremlin.ogm.reflection.PropertyDescription.kt Maven / Gradle / Ivy

There is a newer version: 0.21.0
Show newest version
package org.apache.tinkerpop.gremlin.ogm.reflection

import org.apache.tinkerpop.gremlin.ogm.exceptions.PropertyUnsupported
import org.apache.tinkerpop.gremlin.ogm.mappers.PropertyBiMapper
import org.apache.tinkerpop.gremlin.ogm.mappers.SerializedProperty
import kotlin.reflect.KClass
import kotlin.reflect.KParameter
import kotlin.reflect.KProperty1

/**
 * Describes a property on an object representing a vertex to a graph.
 */
data class PropertyDescription(

        /**
         * The primary constructor parameter on RECEIVER that sets this property.
         */
        val parameter: KParameter,

        /**
         * The property which can be found on RECEIVER.
         */
        val property: KProperty1,

        /**
         * The a custom serializer to map this property to/from its SerializedProperty form
         */
        val mapper: PropertyBiMapper?
) {
    /**
     * The concrete KClass type for this property if this property represents such a type. If this property description
     * does not have a KClass, it must have a non-null vertexMapper.
     */
    val kClass = property.returnType.classifier as? KClass<*> ?: throw PropertyUnsupported(parameter)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy