Dear all,

I have searched the website and the list archives for an answer but couldn't
find anything definitive on the matter.

I was wondering why interface extensions were implemented with static
handlers. This makes implementing state on top of the auto-generated classes
much harder than it could be if the interface extensions were implemented as
delegates of an instance variable.

I have in mind something like this :

public class AutoGenerated extends XmlObject implements ExtensionInterface {
 private ExtensionInterfaceHandler handler;

 public AutoGenerated() {
   handler = new ExtensionInterfaceHandler(this);
 }

 public void extensionMethod1() {
   handler.extensionMethod1();
 }

 // Rest of the auto-generated code
}

The use-case I have in mind here is the JavaBean-binding of some properties
of the class : it requires keeping state about the AutoGenerated instance
(the list of event listeners). This is not possible with the static
handlers.

On the other hand I have found two threads about XmlBookmark which seem to
do the trick, but it doesn't look as intuitive as the example above.

Can anyone tell me why static handlers were chosen instead of the solution
above? Furthermore, what is the best solution to implement state on top of
the auto-generated classes?

Thank you in advance and keep up the brilliant work,

Fabian Guisset

Reply via email to