protected WebBeansModelImplementation( ModelUnit unit ){ super( unit ); myManagers = new HashMap<String, PersistentObjectManager<BindingQualifier>>(); myStereotypedManagers = new HashMap<String, PersistentObjectManager<StereotypedObject>>(); myHelper = AnnotationModelHelper.create( getModelUnit().getClassPathInfo() ); }
private void initialize() { restApplicationManager = helper.createPersistentObjectManager(new RestApplicationsProvider()); }
@Override public List<WebserviceDescriptionImpl> createInitialObjects() throws InterruptedException { final List<WebserviceDescriptionImpl> result = new ArrayList<WebserviceDescriptionImpl>(); helper.getAnnotationScanner().findAnnotations("javax.jws.WebService", EnumSet.of(ElementKind.CLASS), new AnnotationHandler() { // NOI18N @Override public void handleAnnotation(TypeElement type, Element element, AnnotationMirror annotation) { result.add(new WebserviceDescriptionImpl(helper, type)); } }); helper.getAnnotationScanner().findAnnotations("javax.xml.ws.WebServiceProvider", EnumSet.of(ElementKind.CLASS), new AnnotationHandler() { // NOI18N @Override public void handleAnnotation(TypeElement type, Element element, AnnotationMirror annotation) { result.add(new WebserviceDescriptionImpl(helper, type)); } }); return result; }
static boolean checkSpecializedDefault( Element element , AnnotationModelHelper helper){ return helper.hasAnnotation( helper.getCompilationController(). getElements().getAllAnnotationMirrors(element), WebBeansModelProviderImpl.DEFAULT_QUALIFIER_ANNOTATION); }
@Override public boolean refresh( TypeElement type ) { List<? extends AnnotationMirror> allAnnotationMirrors = getHelper().getCompilationController().getElements(). getAllAnnotationMirrors(type); Map<String, ? extends AnnotationMirror> annotationsByType = getHelper().getAnnotationsByType( allAnnotationMirrors ); return annotationsByType.get( myStereotype) != null ; }
@Override public List<BindingQualifier> createObjects( TypeElement type ) { final List<BindingQualifier> result = new ArrayList<BindingQualifier>(); Map<String, ? extends AnnotationMirror> annotationsByType = getHelper().getAnnotationsByType(getHelper().getCompilationController(). getElements().getAllAnnotationMirrors( type )); AnnotationMirror annotationMirror = annotationsByType.get( getAnnotationName()); if (annotationMirror != null ) { result.add( new BindingQualifier(getHelper(), type, getAnnotationName())); } if ( annotationMirror == null || !getHelper().hasAnnotation( annotationMirror. getAnnotationType().asElement(). getAnnotationMirrors(), Inherited.class.getCanonicalName())) { if ( checkSuper( type , getAnnotationName() , getHelper())!= null ){ result.add( new BindingQualifier( getHelper(), type, getAnnotationName()) ); } } return result; }
static boolean isProvider(TypeElement type, AnnotationModelHelper helper) { if (type.getKind() != ElementKind.INTERFACE) { // don't consider interfaces if (helper.hasAnnotation(type.getAnnotationMirrors(), RestConstants.PROVIDER_ANNOTATION)) { // NOI18N return true; } } return false; }
private CompilationController getController(){ return getHelper().getCompilationController(); }
public <R> Future<R> runReadActionWhenReady(final MetadataModelAction<RestApplications, R> action) throws MetadataModelException, IOException { return helper.runJavaSourceTaskWhenScanFinished(new Callable<R>() { public R call() throws Exception { return action.run(metadata); } }); }
public <R> R runReadAction(final MetadataModelAction<RestApplications, R> action) throws MetadataModelException, IOException { return helper.runJavaSourceTask(new Callable<R>() { public R call() throws Exception { return action.run(metadata); } }); }
public boolean isReady() { return !helper.isJavaScanInProgress(); }
private Set<TypeElement> doCollectSpecializedImplementors( TypeElement type, List<BindingQualifier> bindings ) { Set<TypeElement> result = new HashSet<TypeElement>(); ElementHandle<TypeElement> handle = ElementHandle.create(type); final Set<ElementHandle<TypeElement>> handles = getHelper() .getClasspathInfo().getClassIndex().getElements( handle, EnumSet.of(SearchKind.IMPLEMENTORS), EnumSet .of(SearchScope.SOURCE, SearchScope.DEPENDENCIES)); if (handles == null) { LOGGER.log(Level.WARNING, "ClassIndex.getElements() was interrupted"); // NOI18N return Collections.emptySet(); } for (ElementHandle<TypeElement> elementHandle : handles) { LOGGER.log(Level.FINE, "found derived element {0}", elementHandle .getQualifiedName()); // NOI18N TypeElement derivedElement = elementHandle.resolve(getHelper(). getCompilationController()); if (derivedElement == null) { continue; } result.add(derivedElement); } return result; }
public ServiceImplBeanImpl(String linkName, AnnotationModelHelper helper, TypeElement typeElement) { this.linkName=linkName; Map<String, ? extends AnnotationMirror> annByType = helper.getAnnotationsByType(typeElement.getAnnotationMirrors()); AnnotationMirror ejbAnnotation = annByType.get("javax.ejb.Stateless"); // NOI18N isEjb = (ejbAnnotation!=null); }
private void refreshLocation(String fqn) { String cpBase = fqn.replace('.', '/'); //NOI18N ClassPath sourceCP = getHelper().getClasspathInfo().getClassPath(ClasspathInfo.PathKind.SOURCE); FileObject classFO = sourceCP.findResource(cpBase + ".java"); //NOI18N if (classFO == null) { ClassPath compileCP = getHelper().getClasspathInfo().getClassPath(ClasspathInfo.PathKind.COMPILE); classFO = searchForFile(compileCP, cpBase); } if (classFO != null) { location = new SpringAnnotatedBeanLocation(classFO); } }
@Override public boolean refresh( TypeElement type ) { List<? extends AnnotationMirror> allAnnotationMirrors = getHelper().getCompilationController().getElements(). getAllAnnotationMirrors(type); Map<String, ? extends AnnotationMirror> annotationsByType = getHelper().getAnnotationsByType( allAnnotationMirrors ); return annotationsByType.get( INTERCEPTOR ) != null ; }
static boolean hasAnnotation( Element element, String annotation, AnnotationModelHelper helper ) { List<? extends AnnotationMirror> allAnnotationMirrors = helper.getCompilationController().getElements(). getAllAnnotationMirrors(element); return helper.hasAnnotation(allAnnotationMirrors, annotation ); }
static boolean isRestApplication(TypeElement type, AnnotationModelHelper helper) { boolean isRest = false; if (type != null && type.getKind() != ElementKind.INTERFACE) { // don't consider interfaces if (helper.hasAnnotation(type.getAnnotationMirrors(), RestConstants.APPLICATION_PATH)) { // NOI18N isRest = true; } } return isRest; }
private CompilationController getController(){ return getHelper().getCompilationController(); }
public <R> Future<R> runReadActionWhenReady(final MetadataModelAction<RestServicesMetadata, R> action) throws IOException { return helper.runJavaSourceTaskWhenScanFinished(new Callable<R>() { public R call() throws Exception { return action.run(metadata); } }); }
public <R> R runReadAction(final MetadataModelAction<WebservicesMetadata, R> action) throws IOException { return helper.runJavaSourceTask(new Callable<R>() { public R call() throws Exception { return action.run(metadata); } }); }