graphql.nadel.enginekt.transform.query.NadelQueryPath.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nadel-engine-nextgen Show documentation
Show all versions of nadel-engine-nextgen Show documentation
Nadel is a Java library that combines multiple GrahpQL services together into one API.
The newest version!
package graphql.nadel.enginekt.transform.query
data class NadelQueryPath(val segments: List) {
constructor(segment: String) : this(listOf(segment))
val size: Int get() = segments.size
operator fun plus(segment: String): NadelQueryPath {
return NadelQueryPath(segments + segment)
}
fun dropLast(n: Int): NadelQueryPath {
return NadelQueryPath(segments.dropLast(n))
}
inline fun mapIndexed(mapper: (index: Int, segment: String) -> String): NadelQueryPath {
return NadelQueryPath(segments.mapIndexed(mapper))
}
fun last(): String {
return segments.last()
}
companion object {
val root = NadelQueryPath(emptyList())
}
}