[jdom-interest] Announce: JDOMPlus a flexible XML framework f
or Java
James Strachan
james at metastuff.com
Wed Dec 6 04:41:27 PST 2000
----- Original Message -----
From: "Jason Hunter" <jhunter at collab.net>
> I don't agree. I think read-only trees have their place. However, I
> lean toward having them implemented the same way Collections do, with
> facade classes.
Just being a pedant for a moment. Are you sure Collections use facade
classes?
To quote from http://rampages.onramp.net/~huston/dp/facade.html
"Facade ... provide a unified interface to a set of interfaces in a
subsystem. Facade defines a higher-level interface that makes the subsystem
easier to use."
"Facade defines a new interface, whereas Adapter uses an old interface.
Remember that Adapter makes two existing interfaces work together as opposed
to defining an entirely new one. [GOF, p219]"
(I don't have GOF to hand so am trusting this site for its facade
definition).
Java 2 Collections implement read only collections via alternate
implementations of the collections interfaces. There are singleton immutable
collections:-
Collections.EMPTY_LIST;
Collections.EMPTY_MAP;
Collections.EMPTY_SET;
Each of these use private implementations of List, Map and Set which fully
implement their respective interfaces, they just throw
UnsupportedOperationException when someone attempts to change their value.
Also I could define my own read only List via
public FooList extends AbstractList {
...
}
and make it readonly via a similar mechanism.
Neither of these mechansims use different interfaces, they are just
implement the regular collection interfaces - so they aren't facades are
they?
<James/>
James Strachan
=============
email: james at metastuff.com
web: http://www.metastuff.com
If you are not the addressee of this confidential e-mail and any
attachments, please delete it and inform the sender; unauthorised
redistribution or publication is prohibited. Views expressed are those of
the author and do not necessarily represent those of Citria Limited.
More information about the jdom-interest
mailing list