PathRef

class PathRef

A path a predicate is being written about.

The receiver half of the DSL, and nothing more: it holds a CatalogPath and builds leaves. The overloads exist so that a literal is typed at the call site rather than boxed and sorted out later — path("$.score") ge 10 cannot be written against a string bound by accident.

"Some value at this path" is meant literally, and two leaves over the same [*] do not agree on which. Every method below reads some value at this path satisfies this, so and(path("$.items[*].sku") eq "A", path("$.items[*].qty") eq 5) is satisfied by a document whose sku matches in one element and whose qty matches in another. Predicate states the semantics in full, with the two-document example and with what to do when the correlation is what you wanted.

And a leaf narrows to documents. Which element inside one of them matched is a walk of that document — CatalogPath.forEachNodeIn — not something a predicate can report.

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun between(min: Long, max: Long): Predicate

Some value at this path lies in [min, max], both bounds inclusive.

fun between(min: String, max: String): Predicate

Some value at this path lies in [min, max] in UTF-8 byte order, both bounds inclusive.

Link copied to clipboard
infix fun eq(value: BigDecimal): Predicate
infix fun eq(value: Boolean): Predicate
infix fun eq(value: Double): Predicate
infix fun eq(value: String): Predicate

Some value at this path equals value.

infix fun eq(value: Long): Predicate

Some value at this path equals value, whatever width the document stored it at.

Link copied to clipboard

This path carries at least one value, the JSON null included.

Link copied to clipboard
infix fun ge(value: BigDecimal): Predicate
infix fun ge(value: Long): Predicate

Some value at this path is at least value.

infix fun ge(value: String): Predicate

Some value at this path sorts at or after value in UTF-8 byte order.

Link copied to clipboard
infix fun gt(value: BigDecimal): Predicate
infix fun gt(value: Long): Predicate

Some value at this path is greater than value.

infix fun gt(value: String): Predicate

Some value at this path sorts after value in UTF-8 byte order.

Link copied to clipboard

Some value at this path is the JSON null.

Link copied to clipboard
infix fun le(value: BigDecimal): Predicate
infix fun le(value: Long): Predicate

Some value at this path is at most value.

infix fun le(value: String): Predicate

Some value at this path sorts at or before value in UTF-8 byte order.

Link copied to clipboard
infix fun lt(value: BigDecimal): Predicate
infix fun lt(value: Long): Predicate

Some value at this path is less than value.

infix fun lt(value: String): Predicate

Some value at this path sorts before value in UTF-8 byte order.

Link copied to clipboard
infix fun oneOf(values: Collection<Any?>): Predicate

Some value at this path equals one of values. The IN case.

fun oneOf(vararg values: Any?): Predicate

Some value at this path equals one of values.

Link copied to clipboard
open override fun toString(): String