logo       

Re: self-referential static members: msg#00035

lang.scala

Subject: Re: self-referential static members

On 2/9/06, Nikolay Mihaylov <nikolay.mihaylov@xxxxxxx> wrote:
Hi

It's not clear to me what you are unable to achieve. I would have
written sth like:

object Employee {
val meta =
   new SRecordMeta(Class.forName("mypackage.Employee"), XX_EMPLOYEE)
val EMPEE_ID =
   new SFieldString(meta, "EMPEE_ID", 20, SCon.SFD_PRIMARY_KEY)
}

[serializable]
class Employee extends SRecordInstance {
import Employee._;
...
}

Wouldn't that be equivalent to the Java code above?
 
Yes, that's exactly it. I clearly didn't fully grasp the mixin + singleton-object idiom for encoding static members, and should have realized I didn't need compile-time identification of the class (.forName works perfectly).
 
Many thanks for straightening me out.

Jason
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise