Validatable

class Validatable<out T>

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
operator fun component1(): T
Link copied to clipboard
inline fun <T> Validatable<T>.constrain(block: (value: T) -> Boolean): Constraint
Link copied to clipboard
inline fun <T> Validatable<T?>.constrainIfNotNull(block: (value: T) -> Boolean): Constraint
Link copied to clipboard
inline fun <T> Validatable<Iterable<T>?>.each(block: Validatable<T>.() -> Unit)

Iterates over each element of this object and wraps them with a Validatable before passing them to the block.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this validatable.

Link copied to clipboard

Returns the first element, wrapped in Validatable.

Link copied to clipboard
operator fun <T> Validatable<Array<T>?>.get(index: Int): Validatable<T?>
operator fun <K, V> Validatable<Map<K, V>?>.get(index: K): Validatable<V?>

operator fun <T> Validatable<List<T>?>.get(index: Int): Validatable<T?>

Returns the element at the specified index in the list, wrapped in a Validatable.

Link copied to clipboard
@JvmName(name = "doubleHasFractionalCountEqualTo")
fun Validatable<Double?>.hasFractionalCountEqualTo(count: Int): Constraint
@JvmName(name = "floatHasFractionalCountEqualTo")
fun Validatable<Float?>.hasFractionalCountEqualTo(count: Int): Constraint
Link copied to clipboard
open override fun hashCode(): Int

Returns a hash code value for the object.

Link copied to clipboard
@JvmName(name = "doubleHasIntegralCountEqualTo")
fun Validatable<Double?>.hasIntegralCountEqualTo(count: Int): Constraint
@JvmName(name = "floatHasIntegralCountEqualTo")
fun Validatable<Float?>.hasIntegralCountEqualTo(count: Int): Constraint
@JvmName(name = "intHasIntegralCountEqualTo")
fun Validatable<Int?>.hasIntegralCountEqualTo(count: Int): Constraint
@JvmName(name = "longHasIntegralCountEqualTo")
fun Validatable<Long?>.hasIntegralCountEqualTo(count: Int): Constraint
@JvmName(name = "shortHasIntegralCountEqualTo")
fun Validatable<Short?>.hasIntegralCountEqualTo(count: Int): Constraint
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The validatable Array must contain unique elements when this constraint is applied.

The validatable Iterable must contain unique elements when this constraint is applied.

Link copied to clipboard
@JvmName(name = "arrayHasSizeBetween")
fun <T> Validatable<Array<out T>?>.hasSizeBetween(range: IntRange): Constraint

The validatable Array must have a size within the provided range when this constraint is applied.

@JvmName(name = "collectionHasSizeBetween")
fun <T> Validatable<Collection<T>?>.hasSizeBetween(range: IntRange): Constraint

The validatable Collection must have a size within the provided range when this constraint is applied.

@JvmName(name = "mapHasSizeBetween")
fun <T> Validatable<Map<*, T>?>.hasSizeBetween(range: IntRange): Constraint

The validatable Map must have a size within the provided range when this constraint is applied.

Link copied to clipboard
@JvmName(name = "arrayHasSizeEqualTo")
fun <T> Validatable<Array<out T>?>.hasSizeEqualTo(size: Int): Constraint

The validatable Array must have a size equal to size when this constraint is applied.

@JvmName(name = "collectionHasSizeEqualTo")
fun <T> Validatable<Collection<T>?>.hasSizeEqualTo(size: Int): Constraint

The validatable Collection must have a size equal to size when this constraint is applied.

@JvmName(name = "mapHasSizeEqualTo")
fun <T> Validatable<Map<*, T>?>.hasSizeEqualTo(size: Int): Constraint

The validatable Map must have a size equal to size when this constraint is applied.

Link copied to clipboard
@JvmName(name = "arrayHasSizeGreaterThan")
fun <T> Validatable<Array<out T>?>.hasSizeGreaterThan(size: Int): Constraint

The validatable Array must have a size greater than size when this constraint is applied.

@JvmName(name = "collectionHasSizeGreaterThan")
fun <T> Validatable<Collection<T>?>.hasSizeGreaterThan(size: Int): Constraint

The validatable Collection must have a size greater than size when this constraint is applied.

@JvmName(name = "mapHasSizeGreaterThan")
fun <T> Validatable<Map<*, T>?>.hasSizeGreaterThan(size: Int): Constraint

The validatable Map must have a size greater than size when this constraint is applied.

Link copied to clipboard
@JvmName(name = "arrayHasSizeGreaterThanOrEqualTo")
fun <T> Validatable<Array<out T>?>.hasSizeGreaterThanOrEqualTo(size: Int): Constraint

The validatable Array must have a size greater than or equal to size when this constraint is applied.

@JvmName(name = "collectionHasSizeGreaterThanOrEqualTo")
fun <T> Validatable<Collection<T>?>.hasSizeGreaterThanOrEqualTo(size: Int): Constraint

The validatable Collection must have a size greater than or equal to size when this constraint is applied.

@JvmName(name = "mapHasSizeGreaterThanOrEqualTo")
fun <T> Validatable<Map<*, T>?>.hasSizeGreaterThanOrEqualTo(size: Int): Constraint

The validatable Map must have a size greater than or equal to size when this constraint is applied.

Link copied to clipboard
@JvmName(name = "arrayHasSizeLowerThan")
fun <T> Validatable<Array<out T>?>.hasSizeLowerThan(size: Int): Constraint

The validatable Array must have a size lower than size when this constraint is applied.

@JvmName(name = "collectionHasSizeLowerThan")
fun <T> Validatable<Collection<T>?>.hasSizeLowerThan(size: Int): Constraint

The validatable Collection must have a size lower than size when this constraint is applied.

@JvmName(name = "mapHasSizeLowerThan")
fun <T> Validatable<Map<*, T>?>.hasSizeLowerThan(size: Int): Constraint

The validatable Map must have a size lower than size when this constraint is applied.

Link copied to clipboard
@JvmName(name = "arrayHasSizeLowerThanOrEqualTo")
fun <T> Validatable<Array<out T>?>.hasSizeLowerThanOrEqualTo(size: Int): Constraint

The validatable Array must have a size lower than or equal to size when this constraint is applied.

@JvmName(name = "collectionHasSizeLowerThanOrEqualTo")
fun <T> Validatable<Collection<T>?>.hasSizeLowerThanOrEqualTo(size: Int): Constraint

The validatable Collection must have a size lower than or equal to size when this constraint is applied.

@JvmName(name = "mapHasSizeLowerThanOrEqualTo")
fun <T> Validatable<Map<*, T>?>.hasSizeLowerThanOrEqualTo(size: Int): Constraint

The validatable Map must have a size lower than or equal to size when this constraint is applied.

Link copied to clipboard
@JvmName(name = "arrayHasSizeNotEqualTo")
fun <T> Validatable<Array<out T>?>.hasSizeNotEqualTo(size: Int): Constraint

The validatable Array must have a size different from size when this constraint is applied.

@JvmName(name = "collectionHasSizeNotEqualTo")
fun <T> Validatable<Collection<T>?>.hasSizeNotEqualTo(size: Int): Constraint

The validatable Collection must have a size different from size when this constraint is applied.

@JvmName(name = "mapHasSizeNotEqualTo")
fun <T> Validatable<Map<*, T>?>.hasSizeNotEqualTo(size: Int): Constraint

The validatable Map must have a size different from size when this constraint is applied.

Link copied to clipboard
inline operator fun invoke(block: Validatable<T>.() -> Unit)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@JvmName(name = "arrayIsContaining")
fun <T> Validatable<Array<out T>?>.isContaining(element: T): Constraint

The validatable Array must contain element when this constraint is applied.


@JvmName(name = "iterableIsContaining")
fun <T> Validatable<Iterable<T>?>.isContaining(element: T): Constraint

The validatable Iterable must contain element when this constraint is applied.

Link copied to clipboard
fun <K> Validatable<Map<out K, *>?>.isContainingKey(key: K): Constraint

The validatable Map must contain the provided key when this constraint is applied.

Link copied to clipboard

The validatable Map must contain the provided value when this constraint is applied.

Link copied to clipboard
@JvmName(name = "arrayIsEmpty")
fun <T> Validatable<Array<out T>?>.isEmpty(): Constraint

The validatable Array must be empty when this constraint is applied.


@JvmName(name = "collectionIsEmpty")
fun <T> Validatable<Collection<T>?>.isEmpty(): Constraint

The validatable Collection must be empty when this constraint is applied.

@JvmName(name = "mapIsEmpty")
fun <T> Validatable<Map<*, T>?>.isEmpty(): Constraint

The validatable Map must be empty when this constraint is applied.

Link copied to clipboard
Link copied to clipboard
fun <T> Validatable<T?>.isEqualTo(other: T?): Constraint

The validatable value must be equal to other when this constraint is applied.

Link copied to clipboard
Link copied to clipboard
@JvmName(name = "doubleIsFinite")
fun Validatable<Double?>.isFinite(): Constraint
@JvmName(name = "floatIsFinite")
fun Validatable<Float?>.isFinite(): Constraint
Link copied to clipboard

The validatable value must be identical to other when this constraint is applied.

Link copied to clipboard
@JvmName(name = "doubleIsInfinite")
fun Validatable<Double?>.isInfinite(): Constraint
@JvmName(name = "floatIsInfinite")
fun Validatable<Float?>.isInfinite(): Constraint
Link copied to clipboard
@JvmName(name = "instantFuture")
fun Validatable<Instant?>.isInFuture(): Constraint
@JvmName(name = "localDateFuture")
fun Validatable<LocalDate?>.isInFuture(): Constraint
@JvmName(name = "localDateTimeFuture")
fun Validatable<LocalDateTime?>.isInFuture(): Constraint
@JvmName(name = "zonedDateTimeFuture")
fun Validatable<ZonedDateTime?>.isInFuture(): Constraint
Link copied to clipboard
@JvmName(name = "instantIsInFutureOrIsPresent")
fun Validatable<Instant?>.isInFutureOrIsPresent(): Constraint
@JvmName(name = "localDateIsInFutureOrIsPresent")
fun Validatable<LocalDate?>.isInFutureOrIsPresent(): Constraint
@JvmName(name = "localDateTimeIsInFutureOrIsPresent")
fun Validatable<LocalDateTime?>.isInFutureOrIsPresent(): Constraint
@JvmName(name = "zonedDateTimeIsInFutureOrIsPresent")
fun Validatable<ZonedDateTime?>.isInFutureOrIsPresent(): Constraint
Link copied to clipboard
@JvmName(name = "instantIsInPast")
fun Validatable<Instant?>.isInPast(): Constraint
@JvmName(name = "localDateIsInPast")
fun Validatable<LocalDate?>.isInPast(): Constraint
@JvmName(name = "localDateTimeIsInPast")
fun Validatable<LocalDateTime?>.isInPast(): Constraint
@JvmName(name = "zonedDateTimeIsInPast")
fun Validatable<ZonedDateTime?>.isInPast(): Constraint
Link copied to clipboard
@JvmName(name = "instantIsInPastOrIsPresent")
fun Validatable<Instant?>.isInPastOrIsPresent(): Constraint
@JvmName(name = "localDateIsInPastOrIsPresent")
fun Validatable<LocalDate?>.isInPastOrIsPresent(): Constraint
@JvmName(name = "localDateTimeIsInPastOrIsPresent")
fun Validatable<LocalDateTime?>.isInPastOrIsPresent(): Constraint
@JvmName(name = "zonedDateTimeIsInPastOrIsPresent")
fun Validatable<ZonedDateTime?>.isInPastOrIsPresent(): Constraint
Link copied to clipboard

The validatable value must be an instance of type parameter R when this constraint is applied.

Link copied to clipboard
Link copied to clipboard
@JvmName(name = "durationIsNegative")
fun Validatable<Duration?>.isNegative(): Constraint
@JvmName(name = "periodIsNegative")
fun Validatable<Period?>.isNegative(): Constraint
@JvmName(name = "doubleIsNegative")
fun Validatable<Double?>.isNegative(): Constraint
@JvmName(name = "floatIsNegative")
fun Validatable<Float?>.isNegative(): Constraint
@JvmName(name = "intIsNegative")
fun Validatable<Int?>.isNegative(): Constraint
@JvmName(name = "longIsNegative")
fun Validatable<Long?>.isNegative(): Constraint
@JvmName(name = "shortIsNegative")
fun Validatable<Short?>.isNegative(): Constraint
Link copied to clipboard
@JvmName(name = "durationIsNegativeOrZero")
fun Validatable<Duration?>.isNegativeOrZero(): Constraint
@JvmName(name = "periodIsNegativeOrZero")
fun Validatable<Period?>.isNegativeOrZero(): Constraint
@JvmName(name = "doubleIsNegativeOrZero")
fun Validatable<Double?>.isNegativeOrZero(): Constraint
@JvmName(name = "floatIsNegativeOrZero")
fun Validatable<Float?>.isNegativeOrZero(): Constraint
@JvmName(name = "intIsNegativeOrZero")
fun Validatable<Int?>.isNegativeOrZero(): Constraint
@JvmName(name = "longIsNegativeOrZero")
fun Validatable<Long?>.isNegativeOrZero(): Constraint
@JvmName(name = "shortIsNegativeOrZero")
fun Validatable<Short?>.isNegativeOrZero(): Constraint
Link copied to clipboard
Link copied to clipboard
@JvmName(name = "arrayIsNotContaining")
fun <T> Validatable<Array<out T>?>.isNotContaining(element: T): Constraint

The validatable Array must not contain element when this constraint is applied.


@JvmName(name = "iterableIsNotContaining")
fun <T> Validatable<Iterable<T>?>.isNotContaining(element: T): Constraint

The validatable Iterable must not contain element when this constraint is applied.

Link copied to clipboard

The validatable Map must not contain the provided key when this constraint is applied.

Link copied to clipboard

The validatable Map must not contain the provided value when this constraint is applied.

Link copied to clipboard
@JvmName(name = "arrayIsNotEmpty")
fun <T> Validatable<Array<out T>?>.isNotEmpty(): Constraint

The validatable Array must not be empty when this constraint is applied.


@JvmName(name = "collectionIsNotEmpty")
fun <T> Validatable<Collection<T>?>.isNotEmpty(): Constraint

The validatable Collection must not be empty when this constraint is applied.

@JvmName(name = "mapIsNotEmpty")
fun <T> Validatable<Map<*, T>?>.isNotEmpty(): Constraint

The validatable Map must not be empty when this constraint is applied.

Link copied to clipboard

The validatable value must be different from other when this constraint is applied.

Link copied to clipboard
Link copied to clipboard

The validatable value must not be identical to other when this constraint is applied.

Link copied to clipboard

The validatable value must not be an instance of type parameter R when this constraint is applied.

Link copied to clipboard
Link copied to clipboard
@JvmName(name = "doubleIsNotNaN")
fun Validatable<Double?>.isNotNaN(): Constraint
@JvmName(name = "floatIsNotNaN")
fun Validatable<Float?>.isNotNaN(): Constraint
Link copied to clipboard

The validatable value must not be null when this constraint is applied.

Link copied to clipboard
Link copied to clipboard

The validatable value must be null when this constraint is applied.

Link copied to clipboard
@JvmName(name = "durationIsPositive")
fun Validatable<Duration?>.isPositive(): Constraint
@JvmName(name = "periodIsPositive")
fun Validatable<Period?>.isPositive(): Constraint
@JvmName(name = "doubleIsPositive")
fun Validatable<Double?>.isPositive(): Constraint
@JvmName(name = "floatIsPositive")
fun Validatable<Float?>.isPositive(): Constraint
@JvmName(name = "intIsPositive")
fun Validatable<Int?>.isPositive(): Constraint
@JvmName(name = "longIsPositive")
fun Validatable<Long?>.isPositive(): Constraint
@JvmName(name = "shortIsPositive")
fun Validatable<Short?>.isPositive(): Constraint
Link copied to clipboard
@JvmName(name = "durationIsPositiveOrZero")
fun Validatable<Duration?>.isPositiveOrZero(): Constraint
@JvmName(name = "periodIsPositiveOrZero")
fun Validatable<Period?>.isPositiveOrZero(): Constraint
@JvmName(name = "doubleIsPositiveOrZero")
fun Validatable<Double?>.isPositiveOrZero(): Constraint
@JvmName(name = "floatIsPositiveOrZero")
fun Validatable<Float?>.isPositiveOrZero(): Constraint
@JvmName(name = "intIsPositiveOrZero")
fun Validatable<Int?>.isPositiveOrZero(): Constraint
@JvmName(name = "longIsPositiveOrZero")
fun Validatable<Long?>.isPositiveOrZero(): Constraint
@JvmName(name = "shortIsPositiveOrZero")
fun Validatable<Short?>.isPositiveOrZero(): Constraint
Link copied to clipboard
Link copied to clipboard

Returns an iterator over the elements of this object. Each element is wrapped with a Validatable.

Link copied to clipboard

Returns the last element, wrapped in Validatable.

Link copied to clipboard
inline fun <T, R> Validatable<T>.map(transform: (T) -> R): Validatable<R>

Returns a Validatable wrapping the result of the given transform function. The latter is applied to the wrapped value of the Validatable receiver.

Link copied to clipboard
fun path(): Path
Link copied to clipboard
fun Validatable<*>.path(block: PathBuilder.() -> Path): Path
Link copied to clipboard

Registers the provided constraint if it's unsatisfied.

Registers the provided constraint violation.

Link copied to clipboard

Runs all the necessary checks before registering a constraint.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun unwrap(): T
Link copied to clipboard
@JvmName(name = "nullableValidatableOfFunction")
fun <T, V> Validatable<T>.validatableOf(getter: (T & Any) -> V): Validatable<V?>
@JvmName(name = "nullableValidatableOfProperty")
fun <T, V> Validatable<T>.validatableOf(getter: KProperty1<T & Any, V>): Validatable<V?>
fun <T : Any, V> Validatable<T>.validatableOf(getter: (T) -> V): Validatable<V>
Link copied to clipboard

Duplicates the Validatable with the new provided value. The path remains the same.