// handle package level adapters (add them to the type info for this class)
if (helper.isAnnotationPresent(pack, XmlJavaTypeAdapters.class)) {
XmlJavaTypeAdapters adapters = (XmlJavaTypeAdapters) helper.getAnnotation(pack, XmlJavaTypeAdapters.class);
XmlJavaTypeAdapter[] adapterArray = adapters.value();
for (XmlJavaTypeAdapter next : adapterArray) {
JavaClass adapterClass = helper.getJavaClass(next.value());
JavaClass boundType = helper.getJavaClass(next.type());
if (boundType != null) {
info.addAdapterClass(adapterClass, boundType);
} else {
// TODO: Throw an error?
}
}
}
// handle class level adapters (add them to the type info for this class)
if (helper.isAnnotationPresent(javaClass, XmlJavaTypeAdapters.class)) {
XmlJavaTypeAdapters adapters = (XmlJavaTypeAdapters) helper.getAnnotation(javaClass, XmlJavaTypeAdapters.class);
XmlJavaTypeAdapter[] adapterArray = adapters.value();
for (XmlJavaTypeAdapter next : adapterArray) {
JavaClass adapterClass = helper.getJavaClass(next.value());
JavaClass boundType = helper.getJavaClass(next.type());
if(boundType != null) {
info.addAdapterClass(adapterClass, boundType);
}
}
}
// figure out namespace info
NamespaceInfo packageNamespace = getNamespaceInfoForPackage(pack);
if (helper.isAnnotationPresent(pack, XmlSchemaTypes.class)) {
XmlSchemaTypes types = (XmlSchemaTypes) helper.getAnnotation(pack, XmlSchemaTypes.class);
XmlSchemaType[] typeArray = types.value();
for (XmlSchemaType next : typeArray) {
processSchemaType(next);
}
} else if (helper.isAnnotationPresent(pack, XmlSchemaType.class)) {
processSchemaType((XmlSchemaType) helper.getAnnotation(pack, XmlSchemaType.class));
}
String[] propOrder = new String[]{""};
String typeName = "";
if (helper.isAnnotationPresent(javaClass, XmlType.class)) {
// figure out type name
XmlType typeAnnotation = (XmlType) helper.getAnnotation(javaClass, XmlType.class);
typeName = typeAnnotation.name();
if (typeName.equals("##default")) {
typeName = getSchemaTypeNameForClassName(javaClass.getName());
}
propOrder = typeAnnotation.propOrder();
if (!typeAnnotation.namespace().equals("##default")) {
info.setClassNamespace(typeAnnotation.namespace());
} else {
info.setClassNamespace(packageNamespace.getNamespace());
}
} else {
typeName = getSchemaTypeNameForClassName(javaClass.getName());
info.setClassNamespace(packageNamespace.getNamespace());
}
info.setPropOrder(propOrder);
info.setSchemaTypeName(typeName);
if (info.isEnumerationType()) {
addEnumTypeInfo(javaClass, ((EnumTypeInfo)info));
return info;
}
typeInfoClasses.add(javaClass);
typeInfo.put(javaClass.getQualifiedName(), info);
if (helper.isAnnotationPresent(javaClass, XmlAccessorType.class)) {
XmlAccessorType accessorType = (XmlAccessorType) helper.getAnnotation(javaClass, XmlAccessorType.class);
info.setAccessType(accessorType.value());
} else {
info.setAccessType(packageNamespace.getAccessType());
}
info.setProperties(getPropertiesForClass(javaClass, info));
if (helper.isAnnotationPresent(javaClass, XmlAccessorOrder.class)) {
XmlAccessorOrder order = (XmlAccessorOrder) helper.getAnnotation(javaClass, XmlAccessorOrder.class);
info.orderProperties(order.value());
}
JavaClass superClass = (JavaClass) javaClass.getSuperclass();
if (shouldGenerateTypeInfo(superClass)) {
createTypeInfoFor(superClass);
}
ArrayList<Property> properties = info.getPropertyList();
for (Property property : properties) {
JavaClass propertyType = property.getType();
if (this.isCollectionType(property)) {
// check for a generic type
JavaClass gType = property.getGenericType();
if (gType != null) {
// handle nested generics
if (gType.hasActualTypeArguments()) {
propertyType = helper.getJavaClass(gType.getRawName());
} else if (gType instanceof JavaClass) {
propertyType = (JavaClass) gType;
}
}
} else if (propertyType.isArray()) {