Hi. In my lift application using Mapper, I'm doing this all the time:
object name extends MappedPoliteString(this, 16) {
override def validations = Validate.notEmpty(this) _ ::
super.validations
}
where Validate is defined:
object Validate {
val valid = List[FieldError]()
def notEmpty(fi: FieldIdentifier)(field: String) = {
if (field.length == 0)
List(FieldError(fi, Text("Field cannot be empty")))
else
valid
}
This code works, but is a bit verbose, especially when there are 10 or
more strings in a class. I guess I could define a new class
MappedPoliteNonEmptyString, but are there other (better) alternatives?
-Magnus
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---