config / org.apache.tuweni.config / PropertyValidator

PropertyValidator

interface PropertyValidator<T : Any> (source)

A validator associated with a specific configuration property.

Functions

allInList

open static fun <T : Any> allInList(validator: PropertyValidator<in T>): PropertyValidator<MutableList<T>>

A validator that applies a validator to all elements of list, if the list is present.

anyOf

open static fun anyOf(vararg values: String): PropertyValidator<String>
open static fun anyOf(values: MutableCollection<String>): PropertyValidator<String>

A validator that ensures a property, if present, has a value within a given set.

open static fun anyOf(values: MutableCollection<String>, comparator: Comparator<String>): PropertyValidator<String>

A validator that ensures a property, if present, has a comparable value within a given set.

anyOfIgnoreCase

open static fun anyOfIgnoreCase(vararg values: String): PropertyValidator<String>
open static fun anyOfIgnoreCase(values: MutableCollection<String>): PropertyValidator<String>

A validator that ensures a property, if present, has a value within a given set.

combine

open static fun <T : Any> combine(first: PropertyValidator<in T>, second: PropertyValidator<in T>): PropertyValidator<T>
open static fun <T : Any> combine(validators: MutableList<PropertyValidator<in T>>): PropertyValidator<T>

Returns a single validator that combines the results of several validators.

inRange

open static fun inRange(from: Long, to: Long): PropertyValidator<Number>

A validator that ensures a property, if present, is within a long integer range.

isPresent

open static fun isPresent(): PropertyValidator<Any>

A validator that ensures a property is present.

isURL

open static fun isURL(): PropertyValidator<String>

A validator that ensures a property, if present, is a well-formed URL.

validate

abstract fun validate(key: String, position: DocumentPosition?, value: T?): MutableList<ConfigurationError>

Validate a configuration property.