Hello all
We often need to build a metadata object, then declare it unmodifiable
in order to allow the same metadata to be safely shared by many objects.
For example one may create the following ResponsibleParty for their
organization:
DefaultResponsibleParty myOrganization = new DefaultResponsibleParty();
myOrganization.setOrganisationName("My organization");
myOrganization.setContactInfo(...etc...);
then share the same ResponsiblyParty by many object, e.g. all citations
toward data or documents produced by that organization. This is
currently done by invoking the "freeze()" method on the metadata object.
The question is about what should be the behaviour toward child elements
of the metadata one is freezing. In current implementation, when
freezing a metadata, we clone all children and freeze those clones. The
original child objects are left unchanged, which I though would avoid
unexpected freezing if someone has keep reference to the children
elsewhere. However when looking back to our experience, I don't think we
have meet a case where this was useful. So the question is: should we
change the behaviour and freeze all children directly, without cloning
them? This would simplify a little bit the code but actually not that much.
Martin