/**
* Parse the annotations on the field to see if there is an XmlElements
* annotation on it. If so, we'll check this annotation to see if it
* refers to any classes that are external from our code schema compile.
* If we find any, then we'll add them to our visitor.
* @param outline root of the generated code
* @param field parses the xml annotations looking for an external class
* @param directClasses set of direct classes to append to
* @throws IllegalAccessException throw if there's an error introspecting the annotations
*/
private static void parseXmlAnnotations(Outline outline, FieldOutline field, Set<String> directClasses) throws IllegalAccessException {
if (field instanceof UntypedListField) {
JFieldVar jfv = (JFieldVar) FieldHack.listField.get(field);
for(JAnnotationUse jau : jfv.annotations()) {
JClass jc = jau.getAnnotationClass();
if (jc.fullName().equals(XmlElements.class.getName())) {
JAnnotationArrayMember value = (JAnnotationArrayMember) jau.getAnnotationMembers().get("value");
for(JAnnotationUse anno : value.annotations()) {
handleXmlElement(outline, directClasses, anno.getAnnotationMembers().get("type"));
}
}
}
}
}
ClassDiscoverer.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:jaxb-visitor
作者:
评论列表
文章目录