OK, I really am tired...

How about this:

(b: BaseEvent) match {
   case b: Seminar => ...
   case b: Event => ...
   case _ => ...
}

Sigh...

Thanks anyway!

Chas.

Charles F. Munat wrote:
> Not really. What I want to do is have the object tell me what it is. 
> Unless I'm really misunderstanding isInstanceOf, I have to iterate 
> through all the possibilities. Plus, my brain is probably just fried, 
> but I'm not seeing how to use it in a match, so I'm having to run 
> through a bunch of if statements. I know there's a better way. Just 
> can't see it at 3:45 AM.
> 
> Chas.
> 
> Viktor Klang wrote:
>>
>> On Fri, Mar 20, 2009 at 9:37 AM, Charles F. Munat <c...@munat.com 
>> <mailto:c...@munat.com>> wrote:
>>
>>
>>     I have a BaseEvent object from which various other events (e.g. Seminar)
>>     inherit. I want to pull them all out in a query, so they come out as
>>     BaseEvents. But then as I'm looping through them, I want to find out
>>     what type of event they really are. There is an "event_type" column in
>>     the database, but I don't know how to get at that.
>>
>>
>> Don't fancy "isInstanceOf"?
>>  
>>
>>
>>
>>     Anyone know offhand how to get the class of the objects? This is in Lift
>>     with JPA/Hibernate.
>>
>>     Thanks,
>>     Chas.
>>
>>
>>
>>
>>
>> -- 
>> Viktor Klang
>> Senior Systems Analyst
>>
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
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 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to