Details
Description
Metadata may need to be mutable. For method that doesn't returns a java.util.Collection, we may need a setter method. For example in Citation:
String getTitle();
void setTitle(String);
For method that returns a java.util.Collection, only the get method is needed if the specification said that all modification in this collection must be reflected in the object owner. For example:
List getAlternateTitles();
Then, the user could uses:
getAlternateTitles().get(index);
getAlternateTitles().add(title);
etc. This is a similar approach to entrySet(), keySet() and values() methods in java.util.Map.
We cannot fix this bug with elegance due to our handling of Generics.
We have, in the metadata packages, collections parameterized by covariant types. For example, the Metadata interface defines the method:
Collection<? extends ApplicationSchemaInformation> getApplicationSchemaInfo()
Unfortunately, with the way Generics are handled in Java, this means that the resulting Collection is a read only data structure. While we could hack a heavy handed way around this or we could add setters for only the non-collection types but neither would be satisfactory. Alternatively we could revisit the way we have parametrized collections in the metadata interfaces.
For now, the simplest solution is to close this bug until someone has the will to tackle it seriously.