Hello Gautham
Le 22/02/15 03:33, Gautham Gowrishankar a écrit :
> However the API doc describes the asMap() method returning a
> HashMap<String,Object>.I need help in identifying the Object returned
> by each key which would aid me in using theier setter() and getter()
> methods.
For any AbstractMetadata object, you can get the types with the
following code:
AbstractMetadata metadata = ...,
MetadataStandard standard = metadata.getStandard();
Map<String,Class<?>> standard.asTypeMap(metadata.getClass(),
KeyNamePolicy.UML_IDENTIFIER, TypeValuePolicy.ELEMENT_TYPE);
The TypeValuePolicy argument controls which kind of information you want
when the property is a collection. For example if a property type is
Collection<Citation>, then:
* With TypeValuePolicy.PROPERTY_TYPE, you get Collection.class.
* With TypeValuePolicy.ELEMENT_TYPE, you get Citation.class.
By the way, the MetadataStandard class also give you other methods like
asValueMap(...), which is the same as the asMap() method that you
already used but giving more control for example on what to return when
the property is null or empty. There is also asNameMap(...) if you need
to perform some mapping between the ISO 19115 names and the JavaBeans
names, or asInformationMap(...) for information like a sentence
summarizing the metadata, and whether a value is mandatory or not.
Martin