AnnotationTypeElementDeclaration elementDecl = ( AnnotationTypeElementDeclaration ) entry.getKey();
AnnotationValue annotationValue = ( AnnotationValue ) entry.getValue();
String name = elementDecl.getSimpleName();
Object value = annotationValue.getValue();
AnnotationAttribute xmlAttr = xmlAnnotation.addNewAnnotationAttribute();
xmlAttr.setAttributeName( name );
if ( value instanceof List )
{
for ( Iterator j = ( ( List ) value ).iterator(); j.hasNext(); )
{
Object o = j.next();
assert o instanceof AnnotationValue : o.getClass().getName();
Object listVal = ( ( AnnotationValue ) o ).getValue();
// we only handle lists of annotations at the moment
assert listVal instanceof AnnotationInstance : listVal.getClass().getName();
include( xmlAttr.addNewAnnotationValue(), ( AnnotationInstance ) listVal );
}
}
else
{
// we only support a few types at the moment
assert value instanceof TypeInstance || value instanceof String : value.getClass().getName();
xmlAttr.setStringValue1( value.toString() );
}
}
}