use of org.apache.cxf.aegis.type.basic.XMLBeanTypeInfo in project cxf by apache.
the class XMLTypeCreator method createDefaultType.
@Override
public AegisType createDefaultType(TypeClassInfo info) {
Element mapping = findMapping(info.getType());
List<Element> mappings = findMappings(info.getType());
Class<?> relatedClass = TypeUtil.getTypeRelatedClass(info.getType());
if (mapping != null || !mappings.isEmpty()) {
String typeNameAtt = null;
if (mapping != null) {
typeNameAtt = DOMUtils.getAttributeValueEmptyNull(mapping, "name");
}
String extensibleElements = null;
if (mapping != null) {
extensibleElements = mapping.getAttribute("extensibleElements");
}
String extensibleAttributes = null;
if (mapping != null) {
extensibleAttributes = mapping.getAttribute("extensibleAttributes");
}
String defaultNS = NamespaceHelper.makeNamespaceFromClassName(relatedClass.getName(), "http");
QName name = null;
if (typeNameAtt != null) {
name = NamespaceHelper.createQName(mapping, typeNameAtt, defaultNS);
defaultNS = name.getNamespaceURI();
}
// We do not deal with Generic beans at this point.
XMLBeanTypeInfo btinfo = new XMLBeanTypeInfo(relatedClass, mappings, defaultNS);
btinfo.setTypeMapping(getTypeMapping());
btinfo.setDefaultMinOccurs(getConfiguration().getDefaultMinOccurs());
btinfo.setDefaultNillable(getConfiguration().isDefaultNillable());
if (extensibleElements != null) {
btinfo.setExtensibleElements(Boolean.parseBoolean(extensibleElements));
} else {
btinfo.setExtensibleElements(getConfiguration().isDefaultExtensibleElements());
}
if (extensibleAttributes != null) {
btinfo.setExtensibleAttributes(Boolean.parseBoolean(extensibleAttributes));
} else {
btinfo.setExtensibleAttributes(getConfiguration().isDefaultExtensibleAttributes());
}
btinfo.setQualifyAttributes(this.getConfiguration().isQualifyAttributes());
btinfo.setQualifyElements(this.getConfiguration().isQualifyElements());
BeanType type = new BeanType(btinfo);
if (name == null) {
name = createQName(relatedClass);
}
type.setSchemaType(name);
type.setTypeClass(info.getType());
type.setTypeMapping(getTypeMapping());
return type;
}
return nextCreator.createDefaultType(info);
}
Aggregations