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

graphql.nadel.enginekt.transform.query.NadelQueryPath.kt Maven / Gradle / Ivy

Go to download

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())
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy