Java Code Examples for org.eclipse.jdt.core.dom.Annotation#resolveAnnotationBinding()

The following examples show how to use org.eclipse.jdt.core.dom.Annotation#resolveAnnotationBinding() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeAnnotationRewrite.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private static boolean isPureTypeAnnotation(Annotation annotation) {
	IAnnotationBinding binding= annotation.resolveAnnotationBinding();
	if (binding == null) {
		return false;
	}
	IAnnotationBinding targetAnnotationBinding= findTargetAnnotation(binding.getAnnotationType().getAnnotations());

	if (targetAnnotationBinding == null) {
		return false;
	}
	return isTypeUseOnly(targetAnnotationBinding);
}
 
Example 2
Source File: JavaASTUtils.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns the fully-qualified name of an annotation, or <code>null</code> if
 * the annotation's type could not be resolved.
 */
public static String getAnnotationTypeName(Annotation annotation) {
  IAnnotationBinding binding = annotation.resolveAnnotationBinding();
  if (binding != null) {
    ITypeBinding annotationTypeBinding = binding.getAnnotationType();
    if (annotationTypeBinding != null) {
      return annotationTypeBinding.getQualifiedName();
    }
  }
  return null;
}
 
Example 3
Source File: SharedUtils.java    From txtUML with Eclipse Public License 1.0 5 votes vote down vote up
public static IAnnotationBinding obtainAnnotationBinding(BodyDeclaration declaration, Class<?> annotationClass) {
	for (Object mod : declaration.modifiers()) {
		IExtendedModifier modifier = (IExtendedModifier) mod;
		if (modifier.isAnnotation()) {
			Annotation annotation = (Annotation) modifier;
			if (identicalAnnotations(annotation, annotationClass)) {
				return annotation.resolveAnnotationBinding();
			}
		}
	}
	return null;
}