On Fri, Mar 20, 2009 at 11:43 AM, Charles F. Munat <[email protected]> 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. But you wrote: ". But then as I'm looping through them, I want to find out what type of event they really are." so when you're looping through them, if you're doing pattern-matching you could probably just: case x : MySubEvent => blah(x) case y : MyOtherSubEvent => blugh(y) case _ => ohSnap()! > > > Chas. > > Viktor Klang wrote: > > > > > > On Fri, Mar 20, 2009 at 9:37 AM, Charles F. Munat <[email protected] > > <mailto:[email protected]>> 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 > > > > > > > > > -- 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 [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 -~----------~----~----~----~------~----~------~--~---
