Re: KVC and static methods
Re: KVC and static methods
- Subject: Re: KVC and static methods
- From: Ray Ackland <email@hidden>
- Date: Mon, 27 Oct 2003 11:05:29 +1300
From: petite_abeille <email@hidden>
Subject: Re: KVC and static methods (was Hairy Java related question)
Date: Sat, 25 Oct 2003 11:57:12 +0200
To: email@hidden
Yes. You will not need to cast anything. For example:
aClass = Class.forName( aClassName );
aMethod = aClass.getDeclaredMethod( "aMethodName", new Class[] {} );
aValue = aMethod.invoke( aClass, new Object[] {} );
This stuff is new to me and so had been trying it the wrong way. Have
been reading up on it though, and will try giving this way a go.
Yeah, from what I had been reading it looked like I would have needed
to instantiate a dummy object just to get the info.
To get the info about what? The interface? You can use reflection for
that too:
aClass.getInterfaces();
Was meaning turning them into instance methods and creating a dummy
instance to call them on. Bit of a clumsy workaround, but academic now
using the invoke stuff.
thanks for the help,
Ray.
_______________________________________________
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.