What sort of problems did you have with isAssignableFrom?

Creating an extra instance of the object shouldn't be a problem since
this is load-time not run-time.  But I'm curious to know what the issue
is before I commit the patch.

Out of curiosity, what are the things from other frameworks that you
like?

Thanks,
Jeff Schnitzer
[EMAIL PROTECTED]

> -----Original Message-----
> From: Zed A. Shaw [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 17, 2002 4:34 PM
> To: [EMAIL PROTECTED]
> Subject: [Mav-user] Small Patch for ControllerSingletons
> 
> Hi All,
> 
> I'm currently playing with Maverick and it rocks.  I'm actually
> bastardizing the controller concept a bit to add all the stuff I like
> from other frameworks.  While doing this, I ran into a little bug
where
> ControllerSingleton objects were not getting built propoerly.
> 
> The code is in ControllerFactory that determines if an instance is a
> ControllerSingleton or, which I've changed to this:
> 
>       Object tempController = cls.newInstance();
> 
>       if (ControllerSingleton.class.isInstance(tempController)) {
>               System.err.println("########## Creating a singleton
> Controller");
>               theController = (ControllerSingleton) tempController;
> 
> Apparently, Class.isAssignableFrom has problems when you deal with
> interfaces, but isInstance works fine.  The only downside is that you
> have to create an instance of the object, which is slightly
inneficient
> if it turns out to not be a ControllerSingleton.
> 
> Anyway, this is just a suggestion, but it would fix a problem.
Another
> way to do this is to do an instanceof test on the two object
references.
> 
> Talk to you later.
> 
> -----
> Zed A. Shaw
> http://www.zedshaw.com/
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:
> With Great Power, Comes Great Responsibility
> Learn to use your power at OSDN's High Performance Computing Channel
> http://hpc.devchannel.org/
> [INVALID FOOTER]



-------------------------------------------------------
This SF.NET email is sponsored by:  The Best Geek Holiday Gifts!
Time is running out!  Thinkgeek.com has the coolest gifts for
your favorite geek.   Let your fingers do the typing.   Visit Now.
T H I N K G E E K . C O M        http://www.thinkgeek.com/sf/
[INVALID FOOTER]

Reply via email to