OGNL does its fair share of reflection voodoo, though, so it would seem unnecessary for you to use your bag of tricks in conjunction with OGNL expressions.
I'm interested in seeing a concrete Tapestry-specific example of where you are encountering the issue.
Erik
On Apr 27, 2005, at 12:42 AM, Patrick Casey wrote:
I ran into a situation recently that I managed to resolve via
some programming voodoo. As a rule, I'm uncomfortable when voodoo solutions
because I'm not sure I'll be able to resolve the situation if it crops up
again. So I was hoping someone here with a bit more experience with OGNL
could help me out.
I have a class, Mamal which has a final method getId().
I have a subclass, Cat which has a (not final) method getName()
For reasons too obscure to explain, I'm using my own reflection
virtualizer to access these fields (what follows oversimplifies, but you get
the idea. There's actually a lot of cache code and whatnot in place to speed
up method location).
Method[] me = Cat.class.getMethods();
For (int x =0; x< me.length; x++) {
Method thisMethod = me[x];
if (therightone)
thisMethod.invoke(targetObject, null);
}
Works like a champ and it uses some reflection code I've had in
my bag of tricks for years.
The problem arises when ognl decides it wants to "enhance" a
class which it appears to do by generating a synthetic wrapper class and
proxying all the method calls (this based on two minutes of looking at the
debugger not reading the doc so I might be wrong).
Before ognl "enhances" a cat,
Wrapper.get("name", cat) yields "fluffy"
Wrapper.get("id", cat) yields 50
Once ognl "enhances" a cat,
Wrapper.get("name", cat) yields "fluffy"
Wrapper.get("id", cat) yields null
Here's the voodoo: if I take mammal.getId() and change it from
public final to just plain public,
Once ognl "enhances" a cat (with a non final getId()),
Wrapper.get("name", cat) yields "fluffy"
Wrapper.get("id", cat) yields 50 <--- works now??!?
Does anyone have any insight into what's going on here? Why should finality of the method matter?
--- Pat
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
