On Nov 26, 5:34 pm, "Derek Chen-Becker" <[EMAIL PROTECTED]> wrote:
> I'm in the process of playing with the Record code so I have some examples
> for the book. I've run into two small issues:
>
>    1. I'm writing a custom Field type (DecimalField) and it seems like the
>    valueCouldNotBeSet var should be set if I can't parse the decimal string
>    that a user hands me in setFromString. That var, however, is marked
>    private[record], so I can't actually access it. Could you provide an
>    accessor or make that var protected so that I can set it?

valueCouldNoBeSet is used in the validation. I mean in order to
validate a field that field needs to have first a value of that type.
Since we can not always convert from a String to a Number we have this
cases where we can not set the value. Validation will generate an
error messag rturned by Field.errorMessage (probably needs renaming).

I'm aware that you may already know that, just wanted to express this
again.

The bottom line, you are right :) ... I'll provide access to this.



>    2. I'm getting a really weird type error if I try to override the
>    fieldOrder def on MetaRecord:
>
> [WARNING]
> /home/software/liftbook-demos/demo-record/src/main/scala/com/theliftbook/model/Entry.scala:50:
> error: type mismatch;
> [WARNING]  found   :
> List[net.liftweb.record.Field[_10,com.theliftbook.model.Entry] forSome {
> type _10 >: String with java.util.Calendar <: java.lang.Comparable[_1]
> forSome { type _1 >: java.lang.String with java.util.Calendar <:
> java.io.Serializable } with java.io.Serializable }{def defaultValue:
> java.lang.Comparable[_12] forSome { type _12 >: java.lang.String with
> java.util.Calendar <: java.io.Serializable } with java.io.Serializable}]
> [WARNING]  required:
> List[net.liftweb.record.Field[_$3,com.theliftbook.model.Entry] forSome {
> type _$3 }]
> [WARNING]   override def fieldOrder = date :: description :: Nil
>
> Here's my code:
>
> class Entry extends Record[Entry] {
>   def meta = EntryMeta
>
>   object date extends DateTimeField(this)
>
>   object description extends StringField(this, 100)
>
> }
>
> object EntryMeta extends Entry with MetaRecord[Entry] {
>   override def fieldOrder = date :: description :: Nil
>
> }
>
> Am I making a dumb mistake here, or is there some other weirdness going on?
>
> Thanks,
>
> Derek
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to