The Artima Developer Community
Sponsored Link

Legacy Design Forum
Designing with Runtime Class Information

Advertisement

Advertisement

This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

invoking a method at runtime

Posted by kayar on June 02, 1999 at 2:11 PM

I have an object and a string that represents a method name in the object. I'm trying to invoke the method in my code.

So, i have to say
myObject.invoke("methodName", attrClasses [])

Here attrClasses is a class array that contains class literals for the parameter types.

So, if i know that the param is a string i say
attrClasses [] = {String.class}

But what i have is a string representation of the parameter.

Any ideas?



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us