[Lift] Re: Mapper subclasses

2009-09-08 Thread rstradling
I am trying to do what is mentioned below but am struggling with the object side of things for my particular case. This all relates back to trying to auto-generate some classes that I posted back a while ago on. I would love to generate 1 file that has the trait and the object in it that I then

[Lift] Re: Mapper subclasses

2009-09-03 Thread Giuseppe Fogliazza
Unfortunately you cannot escape from asInstanceOf . Forcing self:MapperType the type of this will be TimeStamp with MapperType violating the constraint for the type of the first parameter of MappedDateTime :T : Mapper[T]. Regards Giuseppe On 3 Set, 07:08, Naftoli Gugenheim naftoli...@gmail.com

[Lift] Re: Mapper subclasses

2009-09-03 Thread Giuseppe Fogliazza
As an alternative to asInstanceOf you could use explicit type parameter in MappedField creation: self:MapperType = object xdatetime extends MappedDateTime[MapperType](this) On 3 Set, 09:19, Giuseppe Fogliazza g.foglia...@mcmspa.it wrote: Unfortunately you cannot escape from asInstanceOf .

[Lift] Re: Mapper subclasses

2009-09-03 Thread jon
You could also do this: trait HasCreated [T : HasCreated[T]] extends KeyedMapper[Long, T] { self: T = object created_at extends MappedDateTime(this) } //mix into your meta object: trait HasCreatedMetaMapper[T : HasCreated[T]] { self: T with LongKeyedMetaMapper[T] = import

[Lift] Re: Mapper subclasses

2009-09-03 Thread Giuseppe Fogliazza
jon suggested to me the way to avoid both explicit type parameter and asinstance of: trait Timestamp[MapperType : TimeStamp[MapperType]] extends Mapper [MapperType] { self:MapperType = object xdatetime extends MappedDateTime(this) // all sorts of utility functions for dealing with timestamps

[Lift] Re: Mapper subclasses

2009-09-03 Thread glenn
I'm not sure of what the exact problem is. I created an Address trait that I couple with a number of mapper classes. trait Address[OwnerType : KeyedMapper[Long, OwnerType]]{ def owner = this.asInstanceOf[OwnerType] Where exactly does this construct break down? Glenn... On Sep 3, 7:55 

[Lift] Re: Mapper subclasses

2009-09-03 Thread glenn
Isn't this really a matter of type casting, and asInstanceOf is just Scala's way of doing this. It's always best if you don't have to downcast your objects, but sometimes its unavoidable. Glenn... On Sep 3, 10:29 am, glenn gl...@exmbly.com wrote: I'm not sure of what the exact problem is. I

[Lift] Re: Mapper subclasses

2009-09-02 Thread harryh
I've been handling this with traits, for example I have something like so: trait Timestamp[MapperType : Mapper[MapperType]] { object xdatetime extends MappedDateTime[MapperType](this.asInstanceOf [MapperType]) // all sorts of utility functions for dealing with timestamps } Then I can do

[Lift] Re: Mapper subclasses

2009-09-02 Thread Naftoli Gugenheim
So I guess you can't escape the asInstanceOf. Can you successfully give the trait a self-type of this: MapperType =, or declare it to extend Mapper[MapperType], without running into problems elsewhere? - harryhhar...@gmail.com wrote: I've been handling