use of com.helger.jcodemodel.AbstractJAnnotationValue in project androidannotations by androidannotations.
the class APTCodeModelHelper method addSuppressWarnings.
public void addSuppressWarnings(IJAnnotatable generatedElement, String annotationValue) {
Collection<JAnnotationUse> annotations = generatedElement.annotations();
for (JAnnotationUse annotationUse : annotations) {
if (SuppressWarnings.class.getCanonicalName().equals(annotationUse.getAnnotationClass().fullName())) {
AbstractJAnnotationValue value = annotationUse.getParam("value");
StringWriter code = new StringWriter();
JFormatter formatter = new JFormatter(code);
formatter.generable(value);
if (!code.toString().contains(annotationValue)) {
if (value instanceof JAnnotationArrayMember) {
((JAnnotationArrayMember) value).param(annotationValue);
} else {
String foundValue = code.toString().substring(1, code.toString().length() - 1);
JAnnotationArrayMember newParamArray = annotationUse.paramArray("value");
newParamArray.param(foundValue).param(annotationValue);
}
}
return;
}
}
generatedElement.annotate(SuppressWarnings.class).param("value", annotationValue);
}
Aggregations