trait Rule[I, O] extends RuleLike[I, O]
- Alphabetic
- By Inheritance
- Rule
- RuleLike
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def andThen[P](m: Mapping[ValidationError, O, P]): Rule[I, P]
- def andThen[P](sub: ⇒ RuleLike[O, P]): Rule[I, P]
-
def
andThen[P](path: Path)(sub: ⇒ RuleLike[O, P]): Rule[I, P]
Compose two Rules
Compose two Rules
val r1: Rule[JsValue, String] = // implementation val r2: Rule[String, Date] = // implementation val r = r1 .andThen(r2)
- path
a prefix for the errors path if the result is a
Invalid
- sub
the second Rule to apply
- returns
The combination of the two Rules
- def ap[A](mf: Rule[I, (O) ⇒ A]): Rule[I, A]
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- def flatMap[B](f: (O) ⇒ Rule[I, B]): Rule[I, B]
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[B](f: (O) ⇒ B): Rule[I, B]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
orElse[OO >: O](t: ⇒ RuleLike[I, OO]): Rule[I, OO]
Create a new Rule that try
this
Rule, and applyt
if it failsCreate a new Rule that try
this
Rule, and applyt
if it failsval rb: Rule[JsValue, A] = From[JsValue]{ __ => ((__ \ "name").read[String] ~ (__ \ "foo").read[Int])(B.apply) } val rc: Rule[JsValue, A] = From[JsValue]{ __ => ((__ \ "name").read[String] ~ (__ \ "bar").read[Int])(C.apply) } val rule = rb orElse rc orElse Rule(_ => typeInvalid)
- t
an alternative Rule
- returns
a Rule
-
def
repath(f: (Path) ⇒ Path): Rule[I, O]
This methods allows you to modify the Path of errors (if the result is a Invalid) when aplying the Rule
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
|+|[OO <: O](r2: RuleLike[I, OO]): Rule[I, O]
Create a new Rule the validate
this
Rule andr2
simultaneously Ifthis
andr2
both fail, all the error are returnedCreate a new Rule the validate
this
Rule andr2
simultaneously Ifthis
andr2
both fail, all the error are returnedval valid = Json.obj( "firstname" -> "Julien", "lastname" -> "Tournay") val composed = notEmpty |+| minLength(3) (Path \ "firstname").read(composed).validate(valid) // Valid("Julien")
Deprecated Value Members
-
def
compose[P](m: Mapping[ValidationError, O, P]): Rule[I, P]
- Annotations
- @deprecated
- Deprecated
(Since version 2.0) use andThen instead.
-
def
compose[P](sub: ⇒ RuleLike[O, P]): Rule[I, P]
- Annotations
- @deprecated
- Deprecated
(Since version 2.0) use andThen instead.
-
def
compose[P](path: Path)(sub: ⇒ RuleLike[O, P]): Rule[I, P]
- Annotations
- @deprecated
- Deprecated
(Since version 2.0) use andThen instead.
-
def
fmap[B](f: (O) ⇒ B): Rule[I, B]
- Annotations
- @deprecated
- Deprecated
(Since version 2.0) fmap is deprecated, use map instead