1 19 20 package org.netbeans.modules.websvc.core; 21 22 import java.util.List ; 23 import javax.lang.model.element.AnnotationMirror; 24 import javax.lang.model.element.ElementKind; 25 import javax.lang.model.element.Name; 26 import org.netbeans.api.project.FileOwnerQuery; 27 import org.netbeans.api.project.Project; 28 import org.netbeans.modules.j2ee.common.Util; 29 import javax.lang.model.element.TypeElement; 30 import org.netbeans.api.java.source.CompilationController; 31 import org.netbeans.modules.j2ee.common.queries.spi.InjectionTargetQueryImplementation; 32 import org.openide.filesystems.FileObject; 33 34 38 public class WSInjectiontargetQueryImplementation implements InjectionTargetQueryImplementation { 39 40 41 public WSInjectiontargetQueryImplementation() { 42 } 43 44 public boolean isInjectionTarget(CompilationController controller, TypeElement typeElement) { 45 if (controller == null || typeElement==null) { 46 throw new NullPointerException ("Passed null to WSInjectionTargetQueryImplementation.isInjectionTarget(CompilationController, TypeElement)"); } 48 FileObject fo = controller.getFileObject(); 49 Project project = FileOwnerQuery.getOwner(fo); 50 if (Util.isJavaEE5orHigher(project) && !(ElementKind.INTERFACE==typeElement.getKind())) { 51 52 List <? extends AnnotationMirror> annotations = typeElement.getAnnotationMirrors(); 53 boolean found = false; 54 55 for (AnnotationMirror m : annotations) { 56 Name qualifiedName = ((TypeElement)m.getAnnotationType().asElement()).getQualifiedName(); 57 if (qualifiedName.contentEquals("javax.jws.WebService")) { found = true; 59 break; 60 } 61 if (qualifiedName.contentEquals("javax.jws.WebServiceProvider")) { found = true; 63 break; 64 } 65 } 66 if (found) return true; 67 } 68 return false; 69 } 70 71 public boolean isStaticReferenceRequired(CompilationController controller, TypeElement typeElement) { 72 return false; 73 } 74 75 } 76 | Popular Tags |