[jdom-interest] getProperty/setProperty on Parent

Bradley S. Huffman hip at cs.okstate.edu
Thu Feb 19 12:19:09 PST 2004

Elliotte Rusty Harold writes:

> At 9:15 PM -0600 2/18/04, Bradley S. Huffman wrote:
> >Should Parent define getProperty/setProperty so extra info can be carried
> >with both Document and Element?
> These methods struck me as exxtraneous fluff when I noticed them. 
> Undefined properties do not reflect anything in the XML document 
> that's being modeled.

In my view neither do properties like line #, column #, or even base URI.
They're not part of the model but reflect the state of some external entity,
in this case the source from which the document was built, if there was one.
Yet somethings it is nice to have this info avialable. This is just a hack
to prevent having a excessive number of instance vars.

> If somebody wants to 
> add extra info a document it's easy enough to write a subclass that 
> contains more detailed methods. That would be the correct object 
> oriented way to satisfy the use-case.

And if Java provide a way to combine the behavior of two or more classes,
without cutting and pasting code (Ruby's mixins come to mind) life would be
great and hacks like this wouldn't be unnecessary.  But it doesn't :(


More information about the jdom-interest mailing list