org.apache.tinkerpop.gremlin.ogm.paths.steps.LinkedPath.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.paths.steps
import org.apache.tinkerpop.gremlin.ogm.paths.Path
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal
internal interface LinkedPath : Path {
val first: Path
val second: Path
override fun path() = first.path() + second.path()
override fun invoke(from: StepTraverser): GraphTraversal<*, TO> =
second(StepTraverser(first(from), from.graphMapper))
class ToSingle(
override val first: Path.ToSingle,
override val second: Path.ToSingle
) : LinkedPath, Path.ToSingle
class ToOptional(
override val first: Path.ToOne,
override val second: Path.ToOne
) : LinkedPath, Path.ToOptional
class ToMany(
override val first: Path,
override val second: Path
) : LinkedPath, Path.ToMany
}
fun Path.ToMany.to(next: Path): Path.ToMany = LinkedPath.ToMany(first = this, second = next)
fun Path.ToOptional.to(next: Path.ToOne): Path.ToOptional = LinkedPath.ToOptional(first = this, second = next)
fun Path.ToOptional.to(next: Path.ToMany): Path.ToMany = LinkedPath.ToMany(first = this, second = next)
fun Path.ToSingle.to(next: Path.ToSingle): Path.ToSingle = LinkedPath.ToSingle(first = this, second = next)
fun Path.ToSingle.to(next: Path.ToOptional): Path.ToOptional = LinkedPath.ToOptional(first = this, second = next)
fun Path.ToSingle.to(next: Path.ToMany): Path.ToMany = LinkedPath.ToMany(first = this, second = next)
© 2015 - 2024 Weber Informatics LLC | Privacy Policy