valuesArray[i] = anno.getJavaAnnotation();
} else {
Field valueField = PrivilegedAccessHelper.getDeclaredField(values.get(i).getClass(), "value", true);
Object value = PrivilegedAccessHelper.getValueFromField(valueField, values.get(i));
if (value instanceof JStringLiteral) {
JStringLiteral strvalue = (JStringLiteral) value;
valuesArray[i] = strvalue.str;
} else {
// XmlSeeAlso.value = Array of JDefinedClasses
Field valClField = PrivilegedAccessHelper.getDeclaredField(value.getClass(), "val$cl", true);
JDefinedClass wrappedValue = (JDefinedClass) PrivilegedAccessHelper.getValueFromField(valClField, value);
Class<?> tempDynClass = dynamicClassLoader.createDynamicClass(wrappedValue.fullName());
valuesArray[i] = tempDynClass;
}
}
}
components.put(key.toString(), valuesArray);
} else if (xjcValue.getClass().getName().contains("JAnnotationStringValue")) {
// JAnnotationStringValue is a package-protected class so need to compare class name.
// Cannot cache this field because JAnnotationStringValue is a protected class.
Field valueField = PrivilegedAccessHelper.getDeclaredField(xjcValue.getClass(), "value", true);
Object objValue = PrivilegedAccessHelper.getValueFromField(valueField, xjcValue);
if (objValue instanceof JStringLiteral) {
JStringLiteral value = (JStringLiteral) objValue;
String stringValue = value == null ? null : value.str;
components.put(key.toString(), stringValue);
} else if (objValue.getClass().getName().contains("JAtom")) {
// e.g. XmlElement.required = JAtom
// Cannot cache this field because JAtom is a protected class.