Packages

package svalidate

Provides classes for doing simple validations in Java and Scala.

Overview

The validation wrapper is provided as a simple wrapper around a list

Results of a validation are stored in a com.github.vickumar1981.svalidate.ValidationResult A com.github.vickumar1981.svalidate.ValidationResult can be chained to make rules using the syntax provided from com.github.vickumar1981.svalidate.ValidationSyntax.

A validator for a class can be defined by implementing a com.github.vickumar1981.svalidate.ValidatableResult

Analogous classes for Java can be found in the com.github.vickumar1981.svalidate.util package

Class

Description

com.github.vickumar1981.svalidate.ValidationResult

Holds the return value from a validation

com.github.vickumar1981.svalidate.ValidationSyntax

Provides DSL syntax for validations

com.github.vickumar1981.svalidate.ValidatableResult

Interface to implement for defining a validation

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. svalidate
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait Validatable[-A] extends ValidatableResult[A, String]
  2. trait ValidatableResult[-A, B] extends ValidationDsl[B]

    A generic type class that defines which class to validate and what type of validation to return

    A generic type class that defines which class to validate and what type of validation to return

    A

    the class to validate

    B

    the type of ValidationResult to use with ValidationDsl

  3. trait ValidatableWith[-A, B] extends ValidatableWithResult[A, B, String]
  4. trait ValidatableWithResult[-A, B, C] extends ValidationDsl[C]

    A generic type class that defines which class to use validateWith and what type of validation to return

    A generic type class that defines which class to use validateWith and what type of validation to return

    A

    the class to validate

    B

    the class to pass into validateWith

    C

    the type of ValidationResult to use with ValidationDsl

  5. type Validation = ValidationResult[String]

    Validation is the same as ValidationResult[String].

    Validation is the same as ValidationResult[String]. Allows the default return type to be a list of strings

  6. trait ValidationDsl[T] extends AnyRef
  7. case class ValidationFailure[+T](errorList: Seq[T]) extends ValidationResult[T] with Product with Serializable

    A case class that represents a validation failure of type T Extends a ValidationResult[T] and implements errors with the list of errors passed in

    A case class that represents a validation failure of type T Extends a ValidationResult[T] and implements errors with the list of errors passed in

    T

    the type of ValidationResult

  8. sealed trait ValidationResult[+T] extends AnyRef

    A generic interface that holds a validation result of type T, interoperable with Seq[T]

    A generic interface that holds a validation result of type T, interoperable with Seq[T]

    T

    the type of ValidationResult

  9. case class ValidationSuccess[+T]() extends ValidationResult[T] with Product with Serializable

    A case class that represents a validation success of type T.

    A case class that represents a validation success of type T. Extends a ValidationResult[T] and implements the errors function with an empty list

    T

    the type of ValidationResult

Value Members

  1. implicit def seqToValidation[T](seq: Seq[T]): ValidationResult[T]

    Implicit conversion from Seq[T] to ValidationResult[T].

    Implicit conversion from Seq[T] to ValidationResult[T]. Allows Seq[T] to be substituted for ValidationResult[T]

    T

    the type of ValidationResult

    seq

    the input Seq

    returns

    a ValidationFailure containing errors from the input Seq

  2. implicit def validationToSeq[T](v: ValidationResult[T]): Seq[T]

    Implicit conversion from ValidationResult[T] to Seq[T].

    Implicit conversion from ValidationResult[T] to Seq[T]. Allows ValidationResult[T] to be substituted for Seq[T]

    T

    the type of ValidatableResult

    v

    the input ValidationResult[T]

    returns

    a Seq[T] returned the errors of the input validation

  3. object Validation

    Companion object containing factory methods to create a ValidationSuccess[T] or a ValidationFailure[T]

    Companion object containing factory methods to create a ValidationSuccess[T] or a ValidationFailure[T]

    val validationSuccess = Validation.success
    val validationFailure = Validation.fail("The validation failed.")
  4. object ValidationSyntax

Inherited from AnyRef

Inherited from Any

Ungrouped