Trait

jto.validation

DefaultRules

Related Doc: package validation

Permalink

trait DefaultRules[I] extends GenericRules with DateRules

DefaultRules provides basic rules implementations for inputs of type I Extends this trait if your implementing a new set of Rules for I.

Linear Supertypes
DateRules, GenericRules, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DefaultRules
  2. DateRules
  3. GenericRules
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. implicit def arrayR[I, O](implicit arg0: ClassTag[O], r: RuleLike[I, O]): Rule[Seq[I], Array[O]]

    Permalink

    lift a Rule[I, O] to a Rule of Rule[Seq[I], Array[O]]

    lift a Rule[I, O] to a Rule of Rule[Seq[I], Array[O]]

    (Path \ "foo").read(array(notEmpty)) // create a Rules validating that an Array contains non-empty Strings
    r

    A Rule[I, O] to lift

    returns

    A new Rule

    Definition Classes
    GenericRules
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def checked[I](implicit b: RuleLike[I, Boolean]): Rule[I, Boolean]

    Permalink

    A Rule for HTML checkboxes

    A Rule for HTML checkboxes

    Definition Classes
    GenericRules
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. implicit def dateR: Rule[String, Date]

    Permalink

    Default Rule for the java.util.Date type.

    Default Rule for the java.util.Date type. It uses the default date format: yyyy-MM-dd

    Definition Classes
    DateRules
  9. def dateR(format: String, corrector: (String) ⇒ String = identity): Rule[String, Date]

    Permalink

    Rule for the java.util.Date type.

    Rule for the java.util.Date type.

    corrector

    a simple string transformation function that can be used to transform input String before parsing. Useful when standards are not exactly respected and require a few tweaks

    Definition Classes
    DateRules
  10. def email: Rule[String, String]

    Permalink

    Validate that a String is a valid email

    Validate that a String is a valid email

    (Path \ "email").read(email) // This String is an email
    Definition Classes
    GenericRules
  11. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  12. def equalTo[T](t: T): Rule[T, T]

    Permalink

    Create a Rule of equality

    Create a Rule of equality

    (Path \ "foo").read(equalTo("bar"))
    Definition Classes
    GenericRules
  13. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  16. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  17. implicit def headAs[I, O](implicit c: RuleLike[I, O]): Rule[Seq[I], O]

    Permalink

    Create a Rule validation that a Seq[I] is not empty, and attempt to convert it's first element as a O

    Create a Rule validation that a Seq[I] is not empty, and attempt to convert it's first element as a O

    (Path \ "foo").read(headAs(int))
    Definition Classes
    GenericRules
  18. def ignored[I, O](o: O): (Path) ⇒ Rule[I, O]

    Permalink

    Create a "constant" Rule which is always a success returning value o (Path \ "x").read(ignored(42))

    Create a "constant" Rule which is always a success returning value o (Path \ "x").read(ignored(42))

    Definition Classes
    GenericRules
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. def isoDateR: Rule[String, Date]

    Permalink

    ISO 8601 Reads

    ISO 8601 Reads

    Definition Classes
    DateRules
  21. implicit def jodaDateR: Rule[String, DateTime]

    Permalink

    the default implicit JodaDate reads It uses the default date format: yyyy-MM-dd

    the default implicit JodaDate reads It uses the default date format: yyyy-MM-dd

    Definition Classes
    DateRules
  22. def jodaDateR(pattern: String, corrector: (String) ⇒ String = identity): Rule[String, DateTime]

    Permalink

    Rule for the org.joda.time.DateTime type.

    Rule for the org.joda.time.DateTime type.

    pattern

    a date pattern, as specified in java.text.SimpleDateFormat.

    corrector

    a simple string transformation function that can be used to transform input String before parsing. Useful when standards are not exactly respected and require a few tweaks

    Definition Classes
    DateRules
  23. implicit def jodaLocalDateR: Rule[String, LocalDate]

    Permalink

    The default implicit Rule for org.joda.time.LocalDate

    The default implicit Rule for org.joda.time.LocalDate

    Definition Classes
    DateRules
  24. implicit def jodaLocalDateR(pattern: String, corrector: (String) ⇒ String = identity): Rule[String, LocalDate]

    Permalink
    Definition Classes
    DateRules
  25. implicit def jodaTimeR: Rule[Long, DateTime]

    Permalink

    Default Rule for the java.util.DateTime type.

    Default Rule for the java.util.DateTime type.

    Definition Classes
    DateRules
  26. implicit def listR[I, O](implicit r: RuleLike[I, O]): Rule[Seq[I], List[O]]

    Permalink

    lift a Rule[I, O] to a Rule of Rule[Seq[I], List[O]]

    lift a Rule[I, O] to a Rule of Rule[Seq[I], List[O]]

    (Path \ "foo").read(list(notEmpty)) // create a Rules validating that an List contains non-empty Strings
    r

    A Rule[I, O] to lift

    returns

    A new Rule

    Definition Classes
    GenericRules
  27. def mapR[K, O](r: RuleLike[K, O], p: RuleLike[I, Seq[(String, K)]]): Rule[I, Map[String, O]]

    Permalink
  28. def max[T](m: T)(implicit o: Ordering[T]): Rule[T, T]

    Permalink

    (Path \ "foo").read(max(0)) // validate that there's a negative int at (Path \ "foo")
    Definition Classes
    GenericRules
  29. def maxLength(l: Int): Rule[String, String]

    Permalink

    (Path \ "foo").read(maxLength(5)) // The length of this String must be <= 5
    Definition Classes
    GenericRules
  30. def min[T](m: T)(implicit o: Ordering[T]): Rule[T, T]

    Permalink

    (Path \ "foo").read(min(0)) // validate that there's a positive int at (Path \ "foo")
    Definition Classes
    GenericRules
  31. def minLength(l: Int): Rule[String, String]

    Permalink

    (Path \ "foo").read(minLength(5)) // The length of this String must be >= 5
    Definition Classes
    GenericRules
  32. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  33. def noConstraint[F]: Constraint[F]

    Permalink

    A Rule that always succeed

    A Rule that always succeed

    Definition Classes
    GenericRules
  34. def not[I, O](r: RuleLike[I, O]): Rule[I, I]

    Permalink
    Definition Classes
    GenericRules
  35. def notEmpty: Rule[String, String]

    Permalink

    a Rule validating that a String is not empty.

    a Rule validating that a String is not empty.

    Definition Classes
    GenericRules
    Note

    This Rule does NOT trim the String beforehand

    (Path \ "foo").read(notEmpty)
  36. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  37. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  38. def opt[J, O](r: ⇒ RuleLike[J, O], noneValues: RuleLike[I, I]*)(implicit pick: (Path) ⇒ RuleLike[I, I], coerce: RuleLike[I, J]): (Path) ⇒ Rule[I, Option[O]]

    Permalink
    Attributes
    protected
  39. def pattern(regex: Regex): Rule[String, String]

    Permalink

    Validate that a String matches the provided regex

    Validate that a String matches the provided regex

    (Path \ "foo").read(pattern("[a-z]".r)) // This String contains only letters
    Definition Classes
    GenericRules
  40. implicit def seqR[I, O](implicit r: RuleLike[I, O]): Rule[Seq[I], Seq[O]]

    Permalink

    lift a Rule[I, O] to a Rule of Rule[Seq[I], Seq[O]]

    lift a Rule[I, O] to a Rule of Rule[Seq[I], Seq[O]]

    (Path \ "foo").read(seq(notEmpty)) // create a Rules validating that an Seq contains non-empty Strings
    r

    A Rule[I, O] to lift

    returns

    A new Rule

    Definition Classes
    GenericRules
  41. implicit def setR[I, O](implicit r: RuleLike[I, O]): Rule[Seq[I], Set[O]]

    Permalink

    lift a Rule[I, O] to a Rule of Rule[Seq[I], Set[O]]

    lift a Rule[I, O] to a Rule of Rule[Seq[I], Set[O]]

    (Path \ "foo").read(set(notEmpty)) // create a Rules validating that a Set contains non-empty Strings
    r

    A Rule[I, O] to lift

    returns

    A new Rule

    Definition Classes
    GenericRules
  42. implicit def sqlDateR: Rule[String, Date]

    Permalink

    The default implicit Rule for java.sql.Date

    The default implicit Rule for java.sql.Date

    Definition Classes
    DateRules
  43. def sqlDateR(pattern: String, corrector: (String) ⇒ String = identity): Rule[String, Date]

    Permalink

    Rule for the java.sql.Date type.

    Rule for the java.sql.Date type.

    pattern

    a date pattern, as specified in java.text.SimpleDateFormat.

    corrector

    a simple string transformation function that can be used to transform input String before parsing. Useful when standards are not exactly respected and require a few tweaks

    Definition Classes
    DateRules
  44. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  45. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  46. implicit def traversableR[I, O](implicit r: RuleLike[I, O]): Rule[Seq[I], Traversable[O]]

    Permalink

    lift a Rule[I, O] to a Rule of Rule[Seq[I], Traversable[O]]

    lift a Rule[I, O] to a Rule of Rule[Seq[I], Traversable[O]]

    (Path \ "foo").read(traversable(notEmpty)) // create a Rules validating that an Traversable contains non-empty Strings
    r

    A Rule[I, O] to lift

    returns

    A new Rule

    Definition Classes
    GenericRules
  47. def validateWith[I](msg: String, args: Any*)(pred: (I) ⇒ Boolean): Rule[I, I]

    Permalink

    Create a new constraint, verifying that the provided predicate is satisfied.

    Create a new constraint, verifying that the provided predicate is satisfied.

    def notEmpty = validateWith[String]("validation.nonemptytext"){ !_.isEmpty }
    msg

    The error message to return if predicate pred is not satisfied

    args

    Arguments for the ValidationError

    pred

    A predicate to satify

    returns

    A new Rule validating data of type I against a predicate p

    Definition Classes
    GenericRules
  48. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from DateRules

Inherited from GenericRules

Inherited from AnyRef

Inherited from Any

Ungrouped