Dear all,
I've been playing again for Record/Field code and tried a slightly
different paradigm. For instance:
object PersonMeta extends Person with MetaRecord[Person] {
override def mutable_? = false
}
class Person extends Record[Person] {
def meta = PersonMeta
val firstName = new StringField(this, "Marius") {
override def validators = notEmpty _ :: Nil
}
val lastName = new StringField(this, "Danciu")
def notEmpty(s: String) : Can[Node] = if (s.length == 0)
Full(Text("Field can not be empty"))
else
Empty
}
see it uses val-s (or var-s for that matter) instead of object. JPA
dudes do you think this would help?
David P. (or anyone) do you think this paradigm would be "nicer" then
the object based one? Are there any caveats that I might miss here?
P.S.
- Very few code changed In MetarRecord lead to switch from object base
to val/var one. (No git commits of course)
- We could get rid of 'new' if we use companion modules or fields as
case classes
Br's,
Marius
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---