[jdom-interest] attributes

Hallvard Tratteberg hal at idi.ntnu.no
Wed Jan 30 14:42:10 PST 2002


> Reason one:
> Why should setAttribute(Attribute) be different than
> setAttribute(String, String)?  I personally would think
> Element.setAttribute(String, String) would be a wrapper around
> Element.setAttribute(Attribute).

My intuition is different. There's two less personal reasons to use "my"
logic. You avoid creating more objects than needed, and you avoid creating
objects outside a factory. The last is perhaps most important, since the
main usage of a factory is to control object creation.

> Reason two:
> Maybe someone else has a reference to the original Attribute and
> changing that object's state indirectly (by a call to its parent) is not
> desirable if it can be avoided.

We'll, he who brought up the question had the opposite problem: That of
keeping the Attribute reference. I would guess that is just as relevant a

BTW, do we have a poll mechanism for helping to decide such things?


More information about the jdom-interest mailing list