method argument names

C

Chez

I'm looking to get method argument names with reflection or any other way
...for ex:

public String getAddress(String name, int age)

I'd like to get the argument names "name" and "age".

Is this possible ...? and if yes, how ?

regards,
Chez
 
I

Ingo R. Homann

Hi,
I'm looking to get method argument names with reflection or any other way
..for ex:

public String getAddress(String name, int age)

I'd like to get the argument names "name" and "age".

Is this possible ...? and if yes, how ?

No.

Just of curiosity: Why do you want that?

Ciao,
Ingo
 
T

Tomek

Ingo R. Homann napisal(a):

Yes, its possible and some webservice frameworks ( like XFire and Axis
) do it. But it can only be done if your class i compiled with debug
info ( don't works on interfaces as i remember , only only on classes )
 
S

sgoo

Is this possible ...? and if yes, how ?
Yes, its possible and some webservice frameworks ( like XFire and Axis
) do it. But it can only be done if your class i compiled with debug
info ( don't works on interfaces as i remember , only only on classes )

which means, still NO.
 
D

Daniel Pitts

Chez said:
I'm looking to get method argument names with reflection or any other way
..for ex:

public String getAddress(String name, int age)

I'd like to get the argument names "name" and "age".

Is this possible ...? and if yes, how ?

regards,
Chez

Not easily, but I would suggest finding some way other than reflection
if possible. Reflection is often abused by people who have experience
with function pointers in C. There are likely other, better ways to do
what you intend.

If you let is know WHY you want to do it, we might be able to suggest a
better alternative.

Good luck.
 
S

sgoo

Well, if the compiler has completely remove the name info (in the case
of non-debug output), then there's no way to get it back.
 
D

Daniel Pitts

sgoo said:
Well, if the compiler has completely remove the name info (in the case
of non-debug output), then there's no way to get it back.

Hence, the not easily.

It would be possible if debug output was enabled, or if they used some
other technique to save the parameter names. The point of my post was
that the OP might be trying to do something that could be done another
simpler way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top