* java.lang.Class, java.util.Map)
*/
public void addClassAnnotation(String targetClass, Class<? extends java.lang.annotation.Annotation> annotation, Map<String, Object> properties) {
try {
CompilationUnit cu = compilationUnitCache.getCompilationUnit(targetClass);
BodyDeclaration typeDeclaration = compilationUnitCache.getTypeDeclaration(targetClass);
if (isAnnotationAlreadyUsedOnDeclaration(annotation, typeDeclaration)) {
warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.1"), annotation.getCanonicalName(), targetClass)); //$NON-NLS-1$
return;
}
addImportToCompilationUnit(annotation.getCanonicalName(), cu);
Annotation modifier = createModifier(cu.getAST(), annotation, properties, cu);
typeDeclaration.modifiers().add(0, modifier);
} catch (Exception e) {
warnings.add(String.format(Messages.getString("org.apache.openejb.helper.annotation.warnings.2"), annotation.getCanonicalName(), targetClass)); //$NON-NLS-1$
}
}