On Tuesday, 06/25/2002 at 10:32 ZE3, [EMAIL PROTECTED] wrote:
> <ext:doSomething val="x"/>
> Suppose that doSomething() is a static method. Does Xalan still create a new
> class instance?
As our documentation says, this is handled by the ElemExtensionCall class, which in turn hands the invocation task off to ExtensionHandler.processElement. Looking in that code, it appeas we don't invoke newInstance() unless the method is _not_ static.
> If doSomething() is an instance method, does Xalan always use paramless ctor
> for class creation?
Looking at the code, it appears that we always invoke Class.newInstance(), which I believe does normally call the parameterless constructor. I don't know
> Can I somehow (easily) force Xalan to use my pool instead of paramless ctor:
Not via that code.
If you were using extension functions rather than extension elements, I'd suggest writing one function which retrieved the object(s) into a Xalan variable, and another which accepted them as a parameter and operated upon them; I haven't tried that but I believe it's possible. I can't think of a really clean way to express that in an extention element, though I may be missing something obvious.
> Could Xalan be developed so that the decision on how to create instance is:
> 1. if class has a method: "static X newInstance()", use it to retrieve X.
> 2. else use new X();
We could use reflection to check the extension class for a newInstance() before checking the Class's version. It'd cost us a bit of performance in those cases where there isn't such a method. I'd want to think about it a bit more before concluding that this was a Good Thing.
______________________________________
Joe Kesselman / IBM Research
