Nassim MOUALEK
Nassim MOUALEK

Reputation: 4864

Lookup the method caller inside the called method

Supose that we have this stackTrace

ViewField.getValue()
ExpressionEl.doSomethink()
....
HtmlInput.getValue()

Is it possible to get the instance of the HtmlInput whose calling thoses methods inside the ViewField.getValue() ?

Unfortunatly the stacktrace didn't contain the reference of the caling objects, so how to do it?

Upvotes: 0

Views: 105

Answers (1)

Ryan Stull
Ryan Stull

Reputation: 1096

One method that is kinda ugly but will definitely work is manually passing the reference to each method call.

If you had a method

void foo(String a,int b,...)

now it would be

void foo(String a,int b,Object c,...)

and then everywhere you call it just pass a reference to this.

Upvotes: 1

Related Questions