[jdom-interest] Some thoughts on namespaces

Wes Biggs wes at tralfamadore.com
Mon Apr 2 09:38:54 PDT 2001

--- Elliotte Rusty Harold <elharo at metalab.unc.edu>
> 2. If we want to keep the flyweights, we wrap a
> special 
> NamespaceReference object, used purely internally in
> the Namespace 
> class, and not exposed in the client API, whose
> equality would depend 
> on prefix as well as URI. We'd store namespace
> references in our 
> Hashmap rather then storing the namespaces directly,
> but there'd be a 
> straight-forward 1-1 mapping between
> NamespaceReference objects and 
> Namespace objects. This allows us to retain the
> semantics we want for 
> equals() (URI only) in the Namespace class).

I submit a +1 for this approach.  And to further
bloody the waters, I would suggest that there would
then be a central place to change one prefix to
another without fussing with the (immutable/flyweight)
Namespaces themselves. :-)


More information about the jdom-interest mailing list