[jdom-interest] Fast Factory
Bradley S. Huffman
hip at csa.cs.okstate.edu
Mon May 26 16:15:20 PDT 2003
Jason Hunter writes:
> Perhaps, but for the org.jdom classes I felt pretty comfortable with the
> protected methods we expose. It's the IO packages that have the odd
> exposures.
That's because the only protected methods are setParent/setDocument :) But you
don't find "protected ContentList" content and "protected AttributeList" odd?
> > The creation methods can skip verification, but the normal constructors
> > and set* methods would still call Verifier (guess they could even be made
> > final). Sort of a compromise, quick creation for those special cases like
> > building from SAX, otherwise verify on normal creation or any changes
> > to a object.
> >
> > Attribute.create(String localName, String value, int type,
> > Namespace namespace)
>
> I think this seems like quite a complication if the benefit is only a
> bit of performance.
In what way? It's a protected version of the familiar "newInstance" method
in other APIs. It has same signature as one of Attribute's constructors and
a method in JDOMFactory except it can only be used by subclassers.
My problem with moving JDOMFactory to org.jdom is none of the other classes
in the package use it. Plus having a public FastFactory in org.jdom works
good for a little speed up of SAX building but IMHO it's to tempting to misuse.
Brad
More information about the jdom-interest
mailing list