[jdom-interest] Subclassing!

Jason Hunter jhunter at collab.net
Tue Mar 6 11:58:35 PST 2001

Ken Rune Helland wrote:
> ...
> 1. Cloning.
> The clonable classes shoud use super.clone()
> instead of using new when implementing clone(). 
> ...
> I'm willing to do this change and post it if there is accsept
> for it in the JDOM prosject.

Please do.  Your logic looks good to me.  Unless someone else sees a
problem, I'd be happy to integrate a patch.

> 2. builders
> ... 
> So i woud advocate that the builders has an option to set a
> factory for the classes. Of cource there woud be a default
> factory using the standard JDOM classes.
> The only drawback I can see from doing this is that the users
> using the standard JDOM classes woud get an exstra overhead of
> one function call for each object created.
> or one can have no default factory and use:
>         if( factory == null)
>                 element = new Element(localName, elementNamespace);
>         else
>                 element = factory.element(localName, elementNamespace);
> witch woud give the exstra overhead of a if statment.
> This way as builders are improved or builders from new sources are added
> the "subclassers" will be able to take advantage of this easily.

Yes, I think this is something desirable to have.  Let's tackle cloning
first, then this.


More information about the jdom-interest mailing list