View on types which have a size
View on types which have a size
A ad-hoc validation function
A ad-hoc validation function
def isEqual[T](valueCheck: T, valueExcept: T): DValidation[T] = ensure(valueCheck)("error.dvalidation.isequal", valueExcept)(a => a == valueExcept)
a value to be validated
a string representation of this error
parameters for the key
predicate which indicates if the value is valid
CustomValidationError
Check if a collection has at least one element
Check if a collection has at least one element
IsEmptySeqError
Check the length of a String
Check the length of a String
hasSize()
Check if the size of a value is in a specified range
Check if the size of a value is in a specified range
hasSize(List(1, 2, 3), min = 3) === Success(List(1, 2, 3))
a value
a minimal size (inclusive), default Int.MinValue
a maximum size (inclusive), default Int.MaxValue
a Sized view on the validation value
if size is outside of range then IsToBigError or IsToSmallError
Create a validation error for a given value
Create a validation error for a given value
see DomainError.args
Create a validation error for a given value
Create a validation error for a given value
Uses the == operator on AnyRef for checking equality
Uses the == operator on AnyRef for checking equality
IsNotEqualError
Uses an instance of scalaz.Equal for checking equality
Uses an instance of scalaz.Equal for checking equality
IsNotEqualError
Checks a > b or a >= b
Validate if a value is in a range of min < value < max
Validate if a value is in a range of min < value < max
IsNotLowerThenError
IsNotGreaterThenError
Checks a < b or a <= b
Checks a < b or a <= b
change to <= (default <)
IsNotGreaterThenError
Check if an Option is a Some
Check if an Option is a Some
IsNoneError
Check if a Try is a scala.util.Success
Check if a Try is a scala.util.Success
IsTryFailureError
Check if a string is not blank
Check if a string is not blank
remove the leading and trailing whitespace before checking
IsEmptyStringError
Check if a value is a Monoid.zero
Check if a value is a Monoid.zero
import scalaz.std.anyVal._ notZero(1) === scalaz.Success(1)
IsZeroError
Define a reusable DValidator function
Define a reusable DValidator function
val res: DValidation[Musician] = mikael.validateWith( notEmpty(mikael.name) forAttribute 'name, ensure(mikael.age)("error.dvalidation.legalage", 18)(_ > 18) forAttribute 'age, hasElements(mikael.instruments) forAttribute 'instruments )
Lift a value to a valid validation
Validator for an optional value
Validator for an optional value
if parameter is Some(a) then a will be validated otherwise scalaz.Success(a)
Validator for an non optional scala.Option value
Validator for an non optional scala.Option value
if parameter is Some(a) then a will be validated otherwise scalaz.Failure
Validate all elements of a given sequence
Validate all elements of a given sequence
the element type
sequence to be validated
validator for the element type
a sequence containing a DValidation for each input element
Validator for scala.util.Try values
Validator for scala.util.Try values
Validate a value with the possibility to specify an error type
Validate a value with the possibility to specify an error type
Validator.validate("a")(_ == "a")(error = new CustomValidationError("a", "error.notA"))
value to be validated
validation predicate
function to create a error