tuweni / org.apache.tuweni.config / PropertyValidator

PropertyValidator

interface PropertyValidator<T : Any!> (source)

A validator associated with a specific configuration property.

Functions

allInList

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

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

anyOf

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

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 comparable value within a given set.

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

anyOfIgnoreCase

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

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

combine

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

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>!

inRange

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

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

isPresent

A validator that ensures a property is present.

open static fun isPresent(): PropertyValidator<Any!>!

isURL

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

open static fun isURL(): PropertyValidator<String!>!

isValidPort

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

open static fun isValidPort(): PropertyValidator<Int!>!

isValidPortOrZero

A validator that ensures a property, if present, is a well-formed port number, or zero - meaning it will be allocated at runtime.

open static fun isValidPortOrZero(): PropertyValidator<Int!>!

validate

Validate a configuration property.

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