package accord
- Alphabetic
- By Inheritance
- accord
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
class
BaseValidator
[T] extends Validator[T]
Simplifies base validator implementation.
Simplifies base validator implementation. Validators typically consist of an assertion/test and a resulting violation; this implementation takes two functions that describe this behavior and wires the appropriate logic. For example:
class IsNull extends BaseValidator[ AnyRef ]( _ == null, _ -> "is not a null" )
- T
The object type this validator operates on.
-
class
NullSafeValidator
[T <: AnyRef] extends BaseValidator[T]
An extension to com.wix.accord.BaseValidator that transparently fails on nulls.
An extension to com.wix.accord.BaseValidator that transparently fails on nulls.
- T
The object type this validator operates on.
-
trait
ViolationBuilder
extends AnyRef
Provides a convenience DSL for generating violations:
Provides a convenience DSL for generating violations:
- Rule violations can be created by specifying a value and constraint message as a tuple, for example:
v -> "must not be empty"
- Group violations can be created by extending the above to include children, as in:v -> "does not match any of the rules" -> Seq( v.firstName -> "first name must be empty", ... )
Value Members
- def validate[T](x: T)(implicit validator: Validator[T]): Result
- object ViolationBuilder extends ViolationBuilder