Am 10.10.14 18:49, schrieb Carsten Ziegeler:
Am 10.10.14 um 18:34 schrieb Sandro Boehme:
Metadata is an extension of Map/HashMap, so creating a new Map
object and doing a putAll() should do the trick
Ok, to be short and more clear: If the resource to be wrapped has
a JcrNodeResourceMetadata object instead of a plain
ResourceMetadata object, how would you instantiate it to create a
copy using the Map interface? And would you handle every other
ResourceMetadata type that might be added in the future
individually? My use case is, to wrap all resources no matter what
ResourceMetadata type they have.
As I said, treat the metadata as a map and don't care about the
implementation. Create a new metadata object and simply copy all
values from the wrapped metadata. It's a two liner: create a map,
copy all values. Done
Carsten
I understood what you said. I just didn't know that I don't need to care
about the implementation / type of the metadata. But after having a
second look I see that JcrNodeResourceMetadata doesn't add any public
API and stores everything in the Map anyways.
It's good to know that I can expect that to be the same for other future
implementations / types of the ResourceMetadata class.
Thanks for your help Carsten!
Best,
Sandro