Validator

info.fingo.spata.schema.validator.Validator
See theValidator companion object
trait Validator[A]

Validator for typed CVS field value.

It is used as part of schema validation, after successful conversion of CSV string value to desired type.

A bunch of common validators are provided by the library. Additional ones may be created by implementing this trait. The only method that has to be defined by implementing classes is isValid, since reasonable defaults are provided for other methods.

Type parameters

A

value type

Attributes

See also
Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def isValid(value: A): Boolean
Implicitly added by optional

Check if provided value does comply with this validator.

Check if provided value does comply with this validator.

Value parameters

value

the value to validate

Attributes

Returns

true if value is valid, false otherwise

def isValid(value: A): Boolean

Check if provided value does comply with this validator.

Check if provided value does comply with this validator.

Value parameters

value

the value to validate

Attributes

Returns

true if value is valid, false otherwise

Concrete methods

def errorMessage(value: A): String
Implicitly added by optional

Error message for invalid value.

Error message for invalid value.

Implementing classes may override this method to provide precise error information for invalid values. The default implementation returns generic message containing validated value and validator name.

Value parameters

value

the validated value

Attributes

Returns

error message parametrized with value

def errorMessage(value: A): String

Error message for invalid value.

Error message for invalid value.

Implementing classes may override this method to provide precise error information for invalid values. The default implementation returns generic message containing validated value and validator name.

Value parameters

value

the validated value

Attributes

Returns

error message parametrized with value

Concrete fields

val name: String
Implicitly added by optional

Name of this validator, to be used while providing error information.

Name of this validator, to be used while providing error information.

The default value is based on validator class/object name. Implementing classes may provide their own values. It is recommended to define one if validator is implemented as top-level anonymous class, without meaningful name.

Attributes

val name: String

Name of this validator, to be used while providing error information.

Name of this validator, to be used while providing error information.

The default value is based on validator class/object name. Implementing classes may provide their own values. It is recommended to define one if validator is implemented as top-level anonymous class, without meaningful name.

Attributes