object Validator extends ValidatorMacros
- Alphabetic
- By Inheritance
- Validator
- ValidatorMacros
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- case class All[T](validators: Seq[Validator[T]]) extends Validator[T] with Product with Serializable
- case class Any[T](validators: Seq[Validator[T]]) extends Validator[T] with Product with Serializable
- case class Custom[T](validationLogic: (T) ⇒ ValidationResult, showMessage: Option[String] = None) extends Primitive[T] with Product with Serializable
- type EncodeToRaw[T] = (T) ⇒ Option[scala.Any]
- case class Enumeration[T](possibleValues: List[T], encode: Option[EncodeToRaw[T]], name: Option[SName]) extends Primitive[T] with Product with Serializable
- case class Mapped[TT, T](wrapped: Validator[T], g: (TT) ⇒ T) extends Validator[TT] with Product with Serializable
- case class Max[T](value: T, exclusive: Boolean)(implicit valueIsNumeric: Numeric[T]) extends Primitive[T] with Product with Serializable
- case class MaxLength[T <: String](value: Int, countCodePoints: Boolean) extends Primitive[T] with Product with Serializable
- case class MaxSize[T, C[_] <: Iterable[_]](value: Int) extends Primitive[C[T]] with Product with Serializable
- case class Min[T](value: T, exclusive: Boolean)(implicit valueIsNumeric: Numeric[T]) extends Primitive[T] with Product with Serializable
- case class MinLength[T <: String](value: Int, countCodePoints: Boolean) extends Primitive[T] with Product with Serializable
- case class MinSize[T, C[_] <: Iterable[_]](value: Int) extends Primitive[C[T]] with Product with Serializable
- case class Pattern[T <: String](value: String) extends Primitive[T] with Product with Serializable
- sealed trait Primitive[T] extends Validator[T]
Value Members
-
final
def
!=(arg0: scala.Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: scala.Any): Boolean
- Definition Classes
- AnyRef → Any
- def all[T](v: Validator[T]*): Validator[T]
- def any[T](v: Validator[T]*): Validator[T]
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
def
custom[T](validationLogic: (T) ⇒ ValidationResult, showMessage: Option[String] = None): Validator[T]
Create a custom validator.
Create a custom validator.
- validationLogic
The logic of the validator
- showMessage
Description of the validator used when invoking Validator.show.
-
macro
def
derivedEnumeration[T]: Enumeration[T]
Creates an enum validator where all subtypes of the sealed hierarchy
T
areobject
s.Creates an enum validator where all subtypes of the sealed hierarchy
T
areobject
s. This enumeration will only be used for documentation, as a value outside of the allowed values will not be decoded in the first place (the decoder has no other option than to fail).- Definition Classes
- ValidatorMacros
-
def
enumeration[T](possibleValues: List[T], encode: EncodeToRaw[T], name: Option[SName] = None): Enumeration[T]
Create an enumeration validator, with the given possible values, an optional encoding function (so that the enumerated values can be represented in documentation), and an optional name (to create a reusable documentation component).
Create an enumeration validator, with the given possible values, an optional encoding function (so that the enumerated values can be represented in documentation), and an optional name (to create a reusable documentation component).
- encode
Specify how values of this type can be encoded to a raw value, which will be used for documentation.
-
def
enumeration[T](possibleValues: List[T]): Enumeration[T]
Create an enumeration validator, with the given possible values.
Create an enumeration validator, with the given possible values.
To represent the enumerated values in documentation, an encoding function needs to be provided. This can be done:
- by using the overloaded enumeration method with an
encode
parameter - by adding an encode function on an Validator.Enumeration instance using one of the
.encode
functions - by adding the validator directly to a codec (see Mapping.addEncodeToEnumValidator)
- when the values possible values are of a basic type (numbers, strings), the encode function is inferred if not present, when being added to the schema, see Schema.validate
- by using the overloaded enumeration method with an
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: scala.Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
fixedLength[T <: String](value: Int, countCodePoints: Boolean): Validator[T]
Create a validator for fixed length constraints on strings.
Create a validator for fixed length constraints on strings.
- value
The fixed allowed length.
- countCodePoints
A boolean parameter that determines whether the validation will consider code points or character count. When set to true, the validator will consider characters that are represented using two code units (a surrogate pair) in UTF-16 encoding allowing for a more accurate length validation for strings containing such characters (like emojis). Defaults to false, where length is validated based on the number of
Char
values in the string.
-
def
fixedLength[T <: String](value: Int): Validator[T]
Create a validator for fixed length constraints on strings.
Create a validator for fixed length constraints on strings.
- value
The fixed allowed length.
- def fixedSize[T, C[_] <: Iterable[_]](value: Int): Validator[C[T]]
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def inRange[T](min: T, max: T, minExclusive: Boolean = false, maxExclusive: Boolean = false)(implicit arg0: Numeric[T]): Validator[T]
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def max[T](value: T, exclusive: Boolean = false)(implicit arg0: Numeric[T]): Primitive[T]
-
def
maxLength[T <: String](value: Int, countCodePoints: Boolean): Primitive[T]
Create a validator for maximum length constraints on strings.
Create a validator for maximum length constraints on strings.
- value
The maximum allowed length.
- countCodePoints
A boolean parameter that determines whether the validation will consider code points or character count. When set to true, the validator will consider characters that are represented using two code units (a surrogate pair) in UTF-16 encoding allowing for a more accurate length validation for strings containing such characters (like emojis). Defaults to false, where length is validated based on the number of
Char
values in the string.
-
def
maxLength[T <: String](value: Int): Primitive[T]
Create a validator for maximum length constraints on strings.
Create a validator for maximum length constraints on strings.
- value
The maximum allowed length.
- def maxSize[T, C[_] <: Iterable[_]](value: Int): Primitive[C[T]]
- def min[T](value: T, exclusive: Boolean = false)(implicit arg0: Numeric[T]): Primitive[T]
-
def
minLength[T <: String](value: Int, countCodePoints: Boolean): Primitive[T]
Create a validator for minimum length constraints on strings.
Create a validator for minimum length constraints on strings.
- value
The minimum allowed length.
- countCodePoints
A boolean parameter that determines whether the validation will consider code points or character count. When set to true, the validator will consider characters that are represented using two code units (a surrogate pair) in UTF-16 encoding allowing for a more accurate length validation for strings containing such characters (like emojis). Defaults to false, where length is validated based on the number of
Char
values in the string.
-
def
minLength[T <: String](value: Int): Primitive[T]
Create a validator for minimum length constraints on strings.
Create a validator for minimum length constraints on strings.
- value
The minimum allowed length.
- def minSize[T, C[_] <: Iterable[_]](value: Int): Primitive[C[T]]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def negative[T](implicit arg0: Numeric[T]): Primitive[T]
- def nonEmpty[T, C[_] <: Iterable[_]]: Primitive[C[T]]
- def nonEmptyString[T <: String]: Primitive[T]
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
pass[T]: Validator[T]
A validator instance that always pass.
- def pattern[T <: String](value: String): Primitive[T]
- def positive[T](implicit arg0: Numeric[T]): Primitive[T]
- def positiveOrZero[T](implicit arg0: Numeric[T]): Primitive[T]
-
def
reject[T]: Validator[T]
A validator instance that always reject.
- def show[T](v: Validator[T]): Option[String]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
- object Any extends Serializable
- object MaxLength extends Serializable
- object MinLength extends Serializable
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated