Confused about MappedEnum

179 views
Skip to first unread message

Channing Walton

unread,
Jun 3, 2010, 2:51:15 PM6/3/10
to Lift
Hi,
I'm having a problem with MappedEnums.

Here is my enumeration:

object WatchingState extends Enumeration {
val RequestedInfo = Value(1, "Requested Info")
...
}

My mapper has:

object state extends MappedEnum(this, WatchingState)

I want to do this:

val w:WatchingState.type#Value = mapper.state.is

I got the .type#Value thing from
http://stackoverflow.com/questions/2364555/referring-to-a-enumeration-value-type-in-a-method-signature

but the compiler says non:

[error] /Users/channing/Code/work/workspace-3.5/cmiex/web/src/main/
scala/com/cmiex/web/model/User.scala:64: type mismatch;
[error] found : com.cmiex.web.model.WatchingState#Value
[error] required: com.cmiex.web.model.WatchingState.Value
[error] val w:WatchingState.type#Value = mapper.state.is
[error] ^

So I tried this:
val w:WatchingState#Value = mapper.state.is

But no:

[error] /Users/channing/Code/work/workspace-3.5/cmiex/web/src/main/
scala/com/cmiex/web/model/User.scala:64: not found: type WatchingState
[error] val w:WatchingState#Value = mapper.state.is
[error] ^

and this:

val w:WatchingState.Value = mapper.state.is

Nope:

[error] /Users/channing/Code/work/workspace-3.5/cmiex/web/src/main/
scala/com/cmiex/web/model/User.scala:64: type mismatch;
[error] found : com.cmiex.web.model.WatchingState#Value
[error] required: com.cmiex.web.model.WatchingState.Value
[error] val w:WatchingState.Value = mapper.state.is
[error] ^

Completely stumped, what am I doing wrong.

Channing

CISSE Amadou

unread,
Jun 3, 2010, 3:35:15 PM6/3/10
to lif...@googlegroups.com
redefine WatchingState like this:

object state extends MappedEnum[YourMapperTypeHere, WatchingState.type](this, WatchingState)

adding type parameters and it should work.


--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.


CISSE Amadou

unread,
Jun 3, 2010, 3:36:27 PM6/3/10
to lif...@googlegroups.com
redefine state like this:

object state extends MappedEnum[YourMapperTypeHere, WatchingState.type](this, WatchingState)

adding type parameters and it should work.


On Thu, Jun 3, 2010 at 7:51 PM, Channing Walton <channin...@mac.com> wrote:

Channing Walton

unread,
Jun 3, 2010, 3:55:28 PM6/3/10
to Lift
excellent thank you, that worked!

On Jun 3, 8:36 pm, CISSE Amadou <cisse.amado...@gmail.com> wrote:
> redefine state like this:
>
> object state extends MappedEnum[YourMapperTypeHere,
> WatchingState.type](this, WatchingState)
>
> adding type parameters and it should work.
>
> On Thu, Jun 3, 2010 at 7:51 PM, Channing Walton <channingwal...@mac.com>wrote:
>
>
>
> > Hi,
> > I'm having a problem with MappedEnums.
>
> > Here is my enumeration:
>
> > object WatchingState extends Enumeration {
> >    val RequestedInfo = Value(1, "Requested Info")
> >    ...
> > }
>
> > My mapper has:
>
> > object state extends MappedEnum(this, WatchingState)
>
> > I want to do this:
>
> >        val w:WatchingState.type#Value = mapper.state.is
>
> >        I got the .type#Value thing from
>
> >http://stackoverflow.com/questions/2364555/referring-to-a-enumeration...
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com >
> > .
Reply all
Reply to author
Forward
0 new messages