Issue
it's been quite a few months that i quite Java in favor of Python. Now i'm go back to java to project constraints. now, i'm wondering if there's a way to get all the aprameters (with values) of a functions programmatically inside the function itself.
public void foo(String arg1,String arg2, Integer arg3){
... pars = ...getpars();
}
foo("abc","dfg",123);
where getpars()
should return an HashMap
with name,value
pairs.
so from the example should be
arg1,"abc"
arg2,"dfg"
arg3,123
is there anything like this?
Solution
Unfortunately this is impossible. The only thing you can do is to retrieve the list of parameters types of a particular method using reflection
.
But there is no way to get a map with name
-> value
of each argument passed into the method itself.
Answered By - Andremoniy
Answer Checked By - Cary Denson (JavaFixing Admin)