This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Fwd: Reflection

1 reply
Tim P
Joined: 2011-07-28,
User offline. Last seen 1 year 4 weeks ago.

Hi Donald

well to start with I don't know what the case classes are called other
than by inspecting them
But also it doesn't seem to work terribly well for case classes inside
objects even if I do know what they're called.

I was hoping for something more scala-esque

scala>  BasicModel.BasicSiteres3:
com.timpigden.vrmodel.model.BasicModel.BasicSite.type = BasicSite
scala>  Class.forName("com.timpigden.vrmodel.model.BasicModel.BasicSite")java.lang.ClassNotFoundException:
com.timpigden.vrmodel.model.BasicModel.BasicSite

On 1 January 2012 14:20, Donald McLean wrote:
> What's wrong with Class.forName? It has the virtue of simplicity, even
> if it isn't necessarily the prettiest call in the standard library.
>
> Donald
>
> On Sun, Jan 1, 2012 at 9:10 AM, Tim P wrote:
>> Hi
>> I want to use reflection to generate case classes from XML.
>> Any recommendations for a reflection tool for the job?
>> Can't use 2.10 nightly builds and new API because of coordination with
>> other libraries.

--
Tim Pigden
Optrak Distribution Software Limited
+44 (0)1992 517100
http://www.linkedin.com/in/timpigden
http://optrak.com
Optrak Distribution Software Ltd is a limited company registered in
England and Wales.
Company Registration No. 2327613 Registered Offices: Orland House,
Mead Lane, Hertford, SG13 7AT England
This email and any attachments to it may be confidential and are
intended solely for the use of the individual to whom it is addressed.
Any views or opinions expressed are solely those of the author and do
not necessarily represent those of Optrak Distribution Software Ltd.
If you are not the intended recipient of this email, you must neither
take any action based upon its contents, nor copy or show it to
anyone. Please contact the sender if you believe you have received
this email in error.

Tim P
Joined: 2011-07-28,
User offline. Last seen 1 year 4 weeks ago.
Re: Reflection

ok forget the last post, I was being stupid,

I've experimented with repl, I think it should work

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland