Re: KVC and static methods (was Hairy Java related question)
Re: KVC and static methods (was Hairy Java related question)
- Subject: Re: KVC and static methods (was Hairy Java related question)
- From: petite_abeille <email@hidden>
- Date: Sun, 26 Oct 2003 23:29:09 +0100
On Oct 26, 2003, at 22:51, Ben Trumbull wrote:
You can do an operation equivalent to instanceof without an object
instance. java.lang.Class.isAssignableFrom()
Yep, you are absolutely right. But I would venture that Ray is not
quiet there yet.
The reflection API is really quite easy to use. The only difficulty
is the difference between java.lang.Class.getX() and getDeclaredX().
getX only returns public members. getDeclaredX returns any kind.
Unfortunately, it's not that simple. getX returns inherited members,
but getDeclaredX does not. So if you want to find all the protected
methods on a Class, you need to loop through getDeclaredMethods all
the way up the inheritance hierarchy.
One of those little gotchas which spice up those lonely winter nights...
By the way Ben, how do I "officially" extend KVC? This is something you
might know ;)
Cheers,
PA.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.