use of javax.xml.bind.annotation.XmlSchemaType in project midpoint by Evolveum.
the class PrismBeanInspector method findTypeNameUncached.
private QName findTypeNameUncached(Field field, Class contentClass, String schemaNamespace) {
if (field != null) {
XmlSchemaType xmlSchemaType = field.getAnnotation(XmlSchemaType.class);
if (xmlSchemaType != null) {
return new QName(xmlSchemaType.namespace(), xmlSchemaType.name());
}
}
QName typeName = XsdTypeMapper.getJavaToXsdMapping(contentClass);
if (typeName != null) {
return typeName;
}
// TODO the following code is similar to determineTypeForClass
XmlType xmlType = (XmlType) contentClass.getAnnotation(XmlType.class);
if (xmlType != null) {
String propTypeLocalPart = xmlType.name();
String propTypeNamespace = xmlType.namespace();
if (propTypeNamespace.equals(BeanMarshaller.DEFAULT_PLACEHOLDER)) {
PrismSchema schema = prismContext.getSchemaRegistry().findSchemaByCompileTimeClass(contentClass);
if (schema != null && schema.getNamespace() != null) {
// should be non-null for properly initialized schemas
propTypeNamespace = schema.getNamespace();
} else {
// schemaNamespace is only a poor indicator of required namespace (consider e.g. having c:UserType in apit:ObjectListType)
// so we use it only if we couldn't find anything else
propTypeNamespace = schemaNamespace;
}
}
return new QName(propTypeNamespace, propTypeLocalPart);
}
return null;
}
Aggregations