Search in sources :

Example 1 with AnnotationNode

use of org.apache.xbean.asm5.tree.AnnotationNode in project apex-core by apache.

the class CompactUtil method setAnnotationNode.

private static void setAnnotationNode(FieldNode fn, CompactFieldNode cfn) {
    List<CompactAnnotationNode> annotations = new LinkedList<>();
    for (Object visibleAnnotation : fn.visibleAnnotations) {
        CompactAnnotationNode node = new CompactAnnotationNode();
        Map<String, Object> annotationMap = new HashMap<>();
        if (visibleAnnotation instanceof AnnotationNode) {
            AnnotationNode annotation = (AnnotationNode) visibleAnnotation;
            if (annotation.desc.contains("InputPortFieldAnnotation") || annotation.desc.contains("OutputPortFieldAnnotation")) {
                List<Object> annotationValues = annotation.values;
                if (annotationValues != null) {
                    int index = 0;
                    while (index <= annotationValues.size() - 2) {
                        String key = (String) annotationValues.get(index++);
                        Object value = annotationValues.get(index++);
                        annotationMap.put(key, value);
                    }
                    node.setAnnotations(annotationMap);
                    annotations.add(node);
                }
            }
        }
        cfn.setVisibleAnnotations(annotations);
    }
}
Also used : HashMap(java.util.HashMap) AnnotationNode(org.apache.xbean.asm5.tree.AnnotationNode) LinkedList(java.util.LinkedList)

Aggregations

HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 AnnotationNode (org.apache.xbean.asm5.tree.AnnotationNode)1