io.github.graphglue.definition.RelationshipFieldDefinition.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 com.expediagroup.graphql.generator.annotations.GraphQLDescription
import com.expediagroup.graphql.generator.annotations.GraphQLIgnore
import io.github.graphglue.graphql.extensions.getPropertyName
import kotlin.reflect.KVisibility
import kotlin.reflect.full.findAnnotation
import kotlin.reflect.full.hasAnnotation
/**
* Base class for [OneRelationshipFieldDefinition] and [ManyRelationshipFieldDefinition]
*
* @param T the type of the contained [RelationshipDefinition]
* @param relationshipDefinition contained [T] which defines what subquery to build
*/
abstract class RelationshipFieldDefinition(
val relationshipDefinition: T
) : FieldDefinition(relationshipDefinition.property) {
override val graphQLName get() = property!!.getPropertyName(relationshipDefinition.parentKClass)
/**
* Description of the property
*/
val graphQLDescription get() = property!!.findAnnotation()?.value
/**
* If true, this exposes a field in the GraphQL API
*/
val isGraphQLVisible get() = property!!.visibility == KVisibility.PUBLIC && !property.hasAnnotation()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy