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.
- Alphabetic
- By Inheritance
- DefaultRules
- DateRules
- GenericRules
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
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
-
implicit
def
arrayR[I, O](implicit arg0: ClassTag[O], r: RuleLike[I, O]): Rule[Seq[I], Array[O]]
lift a
Rule[I, O]to a Rule ofRule[Seq[I], Array[O]]lift a
Rule[I, O]to a Rule ofRule[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
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
checked[I](implicit b: RuleLike[I, Boolean]): Rule[I, Boolean]
A Rule for HTML checkboxes
A Rule for HTML checkboxes
- Definition Classes
- GenericRules
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
implicit
def
dateR: Rule[String, Date]
Default Rule for the
java.util.Datetype.Default Rule for the
java.util.Datetype. It uses the default date format:yyyy-MM-dd- Definition Classes
- DateRules
-
def
dateR(format: String, corrector: (String) ⇒ String = identity): Rule[String, Date]
Rule for the
java.util.Datetype.Rule for the
java.util.Datetype.- 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
-
def
email: Rule[String, String]
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
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equalTo[T](t: T): Rule[T, T]
Create a Rule of equality
Create a Rule of equality
(Path \ "foo").read(equalTo("bar"))
- Definition Classes
- GenericRules
-
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] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
ignored[I, O](o: O): (Path) ⇒ Rule[I, O]
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
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isoDateR: Rule[String, Date]
ISO 8601 Reads
ISO 8601 Reads
- Definition Classes
- DateRules
-
implicit
def
jodaDateR: Rule[String, DateTime]
the default implicit JodaDate reads It uses the default date format:
yyyy-MM-ddthe default implicit JodaDate reads It uses the default date format:
yyyy-MM-dd- Definition Classes
- DateRules
-
def
jodaDateR(pattern: String, corrector: (String) ⇒ String = identity): Rule[String, DateTime]
Rule for the
org.joda.time.DateTimetype.Rule for the
org.joda.time.DateTimetype.- 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
-
implicit
def
jodaLocalDateR: Rule[String, LocalDate]
The default implicit Rule for
org.joda.time.LocalDateThe default implicit Rule for
org.joda.time.LocalDate- Definition Classes
- DateRules
-
implicit
def
jodaLocalDateR(pattern: String, corrector: (String) ⇒ String = identity): Rule[String, LocalDate]
- Definition Classes
- DateRules
-
implicit
def
jodaTimeR: Rule[Long, DateTime]
Default Rule for the
java.util.DateTimetype.Default Rule for the
java.util.DateTimetype.- Definition Classes
- DateRules
-
implicit
def
listR[I, O](implicit r: RuleLike[I, O]): Rule[Seq[I], List[O]]
lift a
Rule[I, O]to a Rule ofRule[Seq[I], List[O]]lift a
Rule[I, O]to a Rule ofRule[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
-
implicit
def
localDateR: Rule[String, LocalDate]
Default Rule for the
java.time.LocalDatetype.Default Rule for the
java.time.LocalDatetype. It uses the default date format:yyyy-MM-dd- Definition Classes
- DateRules
-
def
localDateR(pattern: String, corrector: (String) ⇒ String = identity): Rule[String, LocalDate]
Rule for the
java.time.LocalDatetype.Rule for the
java.time.LocalDatetype.- pattern
a date pattern, as specified in
java.time.format.DateTimeFormatter.- 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
- def mapR[K, O](r: RuleLike[K, O], p: RuleLike[I, Seq[(String, K)]]): Rule[I, Map[String, O]]
-
def
max[T](m: T)(implicit o: Ordering[T]): Rule[T, T]
(Path \ "foo").read(max(0)) // validate that there's a negative int at (Path \ "foo")
- Definition Classes
- GenericRules
-
def
maxLength(l: Int): Rule[String, String]
(Path \ "foo").read(maxLength(5)) // The length of this String must be <= 5
- Definition Classes
- GenericRules
-
def
min[T](m: T)(implicit o: Ordering[T]): Rule[T, T]
(Path \ "foo").read(min(0)) // validate that there's a positive int at (Path \ "foo")
- Definition Classes
- GenericRules
-
def
minLength(l: Int): Rule[String, String]
(Path \ "foo").read(minLength(5)) // The length of this String must be >= 5
- Definition Classes
- GenericRules
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
noConstraint[F]: Constraint[F]
A Rule that always succeed
A Rule that always succeed
- Definition Classes
- GenericRules
-
def
not[I, O](r: RuleLike[I, O]): Rule[I, I]
- Definition Classes
- GenericRules
-
def
notEmpty: Rule[String, String]
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)
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
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]]
- Attributes
- protected
-
def
pattern(regex: Regex): Rule[String, String]
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
-
implicit
def
seqR[I, O](implicit r: RuleLike[I, O]): Rule[Seq[I], Seq[O]]
lift a
Rule[I, O]to a Rule ofRule[Seq[I], Seq[O]]lift a
Rule[I, O]to a Rule ofRule[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
-
implicit
def
setR[I, O](implicit r: RuleLike[I, O]): Rule[Seq[I], Set[O]]
lift a
Rule[I, O]to a Rule ofRule[Seq[I], Set[O]]lift a
Rule[I, O]to a Rule ofRule[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
-
implicit
def
sqlDateR: Rule[String, Date]
The default implicit Rule for
java.sql.DateThe default implicit Rule for
java.sql.Date- Definition Classes
- DateRules
-
def
sqlDateR(pattern: String, corrector: (String) ⇒ String = identity): Rule[String, Date]
Rule for the
java.sql.Datetype.Rule for the
java.sql.Datetype.- 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
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
implicit
def
timeR: Rule[Long, LocalDateTime]
Default Rule for the
java.util.LocalDateTimetype from long.Default Rule for the
java.util.LocalDateTimetype from long.- Definition Classes
- DateRules
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
implicit
def
traversableR[I, O](implicit r: RuleLike[I, O]): Rule[Seq[I], Traversable[O]]
lift a
Rule[I, O]to a Rule ofRule[Seq[I], Traversable[O]]lift a
Rule[I, O]to a Rule ofRule[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
-
def
validateWith[I](msg: String, args: Any*)(pred: (I) ⇒ Boolean): Rule[I, I]
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
predis not satisfied- args
Arguments for the
ValidationError- pred
A predicate to satify
- returns
A new Rule validating data of type
Iagainst a predicatep
- Definition Classes
- GenericRules
-
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
- @native() @throws( ... )
-
implicit
def
zonedDateTimeR: Rule[String, ZonedDateTime]
Default Rule for the
java.time.ZonedDateTimetype.Default Rule for the
java.time.ZonedDateTimetype. It uses the default date format:yyyy-MM-dd- Definition Classes
- DateRules
-
def
zonedDateTimeR(pattern: String, corrector: (String) ⇒ String = identity): Rule[String, ZonedDateTime]
Rule for the
java.time.ZonedDateTimetype.Rule for the
java.time.ZonedDateTimetype.- pattern
a date pattern, as specified in
java.time.format.DateTimeFormatter.- 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
-
object
unsafeImplicits
- Definition Classes
- GenericRules