* annotations
*/
private PropMapping initializePropMapping(String ns,
Class<? extends XMPSchema> classSchem) throws XmpSchemaException {
PropertyType propType;
PropertyAttributesAnnotation propAtt;
Field[] fields;
PropMapping propMap = new PropMapping(ns);
fields = classSchem.getFields();
String propName = null;
for (Field field : fields) {
if (field.isAnnotationPresent(PropertyType.class)) {
try {
propName = (String) field.get(propName);
} catch (Exception e) {
throw new XmpSchemaException(
"couldn't read one type declaration, please check accessibility and declaration of fields annoted in "
+ classSchem.getName(), e);
}
// System.out.println("nameField:"+propName);
propType = field.getAnnotation(PropertyType.class);
// System.out.println("Type '"+propInfo.propertyType()+"' defined for "+propName);
if (!field
.isAnnotationPresent(PropertyAttributesAnnotation.class)) {
propMap.addNewProperty(propName, propType.propertyType(),
null);
} else {
// TODO Case where a special annotation is used to specify
// attributes
// NOT IMPLEMENTED YET, JUST TO GIVE A CLUE TO MAKE THIS
propAtt = field
.getAnnotation(PropertyAttributesAnnotation.class);
List<String> attributes = new ArrayList<String>();
for (String att : propAtt.expectedAttributes()) {
attributes.add(att);
}
propMap.addNewProperty(propName, propType.propertyType(),
attributes);
}