[jdom-interest] Protected methods to make private

Jason Hunter jhunter at acm.org
Fri May 23 14:55:09 PDT 2003


Here's a list of protected methods that need some justification in order 
to remain protected.  Without justification we'll make them private and 
see who complains.  :-)  Please speak up with any reason we should keep 
these protected or any alternate design that can make them private.

SAXOutputter:
   handleError()

There's an ErrorManager class.  Why not just use it?

SAXHandler:
   declaredNamespaces
   inCDATA
   inDTD
   inInternalSubset
   previousCDATA
   suppress
   appendExternalId()

These aren't used within JDOM anywhere.  I'd rather not expose so many 
SAXHandler internals in a 1.0 release.

SAXHandler:
   flushCharacters(String)

Brad, I seem to recall you had a performance trick involving this 
method?  What's the point of keeping it?

SAXHandler:
   currentElement
   getCurrentElement()

I see org.jdom.contrib.input.scanner.ElementScanner.ElementBuilder uses 
currentElement.  But must they both be exposed?  Should 
getCurrentElement() be public perhaps?

SAXHandler:
   atRoot

I see JDOMResult.FragmentHandler uses this.  That's an odd property to 
expose.  Could this be done another way?  Laurent?

XMLOutputter:
   indent(Writer, int)
   makeWriter(OutputStream)
   makeWriter(OutputStream, String)
   newline(Writer)

I can't imagine why these are protected not private!

XMLOutputter:
   printXXX(XXX obj, Writer)

We have protected all these various print calls so that someone can 
subclass to change how a certain item is printed.  Does anyone do that? 
  It seems like some of the interaction between the calls is something 
we'll want to be free to change in the future.  While some seem 
straightforward, others like printContentRange(List, int, int, Writer, 
int, NamespaceStack) just seem hard-coded to our current approach.

XMLOutputter:
   namespaceStack

These is exposed to support these:
   printElement(Element, Writer, int, NamespaceStack)
   printContentRange(List, int, int, Writer, int, NamespaceStack)
   printAttributes(List, Element, Writer, NamespaceStack)
If we remove the protected printXXX() calls we can remove this!

XMLOutputter:
   createNamespaceStack()

It seems crazy to have this method protected not private.

-jh-




More information about the jdom-interest mailing list