io.github.graphglue.definition.generateNodeDefinition.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of graphglue-core Show documentation
Show all versions of graphglue-core Show documentation
A library to develop annotation-based code-first GraphQL servers using GraphQL Kotlin, Spring Boot and Neo4j - excluding Spring GraphQL server dependencies
The newest version!
package io.github.graphglue.definition
import io.github.graphglue.model.Node
import org.springframework.data.neo4j.core.mapping.Neo4jMappingContext
import org.springframework.data.neo4j.core.mapping.Neo4jPersistentEntity
import kotlin.reflect.KClass
/**
* Generates a [NodeDefinition] for a specific class
*
* @param nodeClass the class to generate the definition for
* @param mappingContext used to obtain the [Neo4jPersistentEntity]
* @param extensionFieldDefinitions all known [ExtensionFieldDefinition] beans
* @return the generated NodeDefinition
*/
fun generateNodeDefinition(
nodeClass: KClass,
mappingContext: Neo4jMappingContext,
extensionFieldDefinitions: Map
): NodeDefinition {
return NodeDefinition(
nodeClass, mappingContext.getPersistentEntity(nodeClass.java)!!, extensionFieldDefinitions
)
}