Re: Class information in a static method

1999-10-09 Thread Godmar Back
> > Godmar Back wrote, > > Miles Sabin wrote, > > > [snip: className.class vs Class.forName("className")] > > > > In other words, you're saving a try/catch clause at the > > expense of one hidden static variable. > > Hmm ... well, a litte more than that. The lookup is done > only once (to initia

RE: Class information in a static method

1999-10-08 Thread Miles Sabin
Godmar Back wrote, > Miles Sabin wrote, > > [snip: className.class vs Class.forName("className")] > > In other words, you're saving a try/catch clause at the > expense of one hidden static variable. Hmm ... well, a litte more than that. The lookup is done only once (to initialize the static). St

Re: Class information in a static method

1999-10-07 Thread Godmar Back
> > > If you know the class' name, and I suspect that you do > > since you are in a static method of the class, you can > > do a Class.forName(className). > > Better still, className.class, and have it resolved at > compile time rather than by a runtime lookup. > Miles, "className.class" is

Re: Class information in a static method

1999-10-07 Thread Juergen Kreileder
> Weiqi Gao writes: Weiqi> Jesper Nordenberg wrote: >> >> Is there any way to obtain the Class-instance associated with the >> current class in a static method? Obviously, this.getClass() doesn't >> work ;) Weiqi> If you know the class' name, and I suspect that you d

RE: Class information in a static method

1999-10-07 Thread Miles Sabin
> If you know the class' name, and I suspect that you do > since you are in a static method of the class, you can > do a Class.forName(className). Better still, className.class, and have it resolved at compile time rather than by a runtime lookup. Cheers, Miles -- Miles Sabin

Re: Class information in a static method

1999-10-07 Thread Paul Mclachlan
At 8:32 10 Oct 1999 -0500, Weiqi Gao wrote: > Jesper Nordenberg wrote: > > > > Is there any way to obtain the Class-instance associated with the > > current class in a static method? Obviously, this.getClass() doesn't > > work ;) > Use the special variable 'MyClass.class'. (not in 1.0.2) Pa

OT Re: Class information in a static method

1999-10-07 Thread jools enticknap
>This might be slightly off topic, but I really need help with this. > >Is there any way to obtain the Class-instance associated with the current >class in a static method? Obviously, this.getClass() doesn't work ;) > If the class is call com.blah.Stuff, use com.blah.Stuff.class; to get the jav

Re: Class information in a static method

1999-10-07 Thread Weiqi Gao
Jesper Nordenberg wrote: > > Is there any way to obtain the Class-instance associated with the > current class in a static method? Obviously, this.getClass() doesn't > work ;) If you know the class' name, and I suspect that you do since you are in a static method of the class, you can do a Class

Re: Class information in a static method

1999-10-07 Thread David Marshall
  Jesper Nordenberg wrote: This might be slightly off topic, but I really need help with this. Is there any way to obtain the Class-instance associated with the current class in a static method? Obviously, this.getClass() doesn't work ;)   You can use the static method Class.forName() on the Clas

Re: Class information in a static method

1999-10-07 Thread Nathan Ehresman
> This might be slightly off topic, but I really need help with this. > > Is there any way to obtain the Class-instance associated with the current class in a >static method? Obviously, this.getClass() doesn't work ;) Pass in a reference to the class. Nathan Ehresman

Class information in a static method

1999-10-07 Thread Jesper Nordenberg
This might be slightly off topic, but I really need help with this. Is there any way to obtain the Class-instance associated with the current class in a static method? Obviously, this.getClass() doesn't work ;) -- | Jesper Nordenberg, M.Sc. in C.S.E.NNL Technology AB | E-mail: [EMAIL PROTEC