s_mach

validate

package validate

Visibility
  1. Public
  2. All

Type Members

  1. sealed trait Explain extends AnyRef

    A base trait for an entity that provides human-readable information about a field (or no field) within a case class.

    A base trait for an entity that provides human-readable information about a field (or no field) within a case class. A field path is used to point at which field within the "context" the information is associated with. Ex: case class A(i: Int) case class B(a: A)

    Field path for the i field of A from within B: "a" :: "i" :: Nil

    Field path of i from within context of A: "i" :: Nil

    Field path used to "this" (for A or B): Nil

  2. trait IsValueClass[A] extends Any

    A base trait for a user-defined value-class that standardizes the name of the value-class val to "underlying" and toString to underlying toString.

    A base trait for a user-defined value-class that standardizes the name of the value-class val to "underlying" and toString to underlying toString. This allows creating a conversion from an instance of any value-class to its underlying representation.

    For details on value-class see: http://docs.scala-lang.org/overviews/core/value-classes.html

    Example value-class: implicit class Name(underlying: String) extends AnyVal with IsValueType[String]

    Note1: When using creating a value-class for String, it is necessary to create an implicit view to StringOps to use the Scala extended String methods on instances of the value-class. Example for Name above: object Name { import scala.collection.immutable.StringOps implicit def stringOps_Name(n: Name) = new StringOps(n.underlying) }

    Note2: while almost every method on underlying can be used on the value-class without special code, the equals method is a special case that still requires wrapping the right-hand type in the value-class to match the other side. Ex:

    Name("Hal") == "Hal" // always returns false + compiler warning Name("Hal") == Name("Hal") // works correctly

    A

    type of underlying value class (Note: this parameter does not require inheritance from AnyVal since this would prevent using the trait with java.lang.String which does not inherit AnyVal)

  3. case class Rule(path: List[String], desc: String) extends Explain with Product with Serializable

    A description of a constraint on the value of a field

    A description of a constraint on the value of a field

    path

    field path

    desc

    human readable description e.g. "must be between (0,150)"

  4. case class Schema(path: List[String], typeName: String, cardinality: (Int, Int)) extends Explain with Product with Serializable

    A schema that describes the type and cardinality of a field

    A schema that describes the type and cardinality of a field

    path

    field path

    typeName

    class tag name e.g. "java.lang.String" or "Int"

    cardinality

    a tuple of the minimum and maximum number of elements allowed for the field. Common cardinalities: (1,1) => single value (0,1) => optional value (0,Int.MaxValue) => collection

  5. trait Validator[A] extends AnyRef

    A type-class for validating instances of a type

    A type-class for validating instances of a type

    A

    type validated

Value Members

  1. object Validator

  2. package impl

Ungrouped