When setting a java.util.Date as the value in the ModifiableValueMap, the Date object is serialized and saved as the value. This seems like odd functionality, as java.util.Calendar is supported and the internal datatype is called 'date'.
I understand that the reason is that internally the JCR uses java.util.Calendars to store and access dates, but it's just not a very intuitive thing to happen. I think one (or more) of the three things should happen to make the functionality more intuitive: - The JavaDocs for the ModifiableValueMap should list the supported types and what happens when an unsupported type is encountered. This will mean that all implementations of the ModifiableValueMap will need to support the same types. - The ModifiableValueMap implementations should throw a java.lang.IllegalArgumentException if an invalid value type is specified. Of course this is going to require more error checking and definitely requires some additional documentation. - The ModifiableValueMap should have a method for retrieving the supported types based on the ResourceProvider being used. - The JcrModifiableValueMap (and other implementations) should attempt to coerce reasonable values. For example: java.util.Date -> java.util.Calendar, byte[] -> InputStream Personally, I like a combination of all four options. What do you think? Regards, Dan
