/** * Given the set of annotations that comprise Hk2, as well as the provided classpath / files to * introspect, return the set of URIs that actually reference something of "significant value" * pertaining to habitat creation. */ private Set<URI> getSignificantURIReferences() { LinkedHashSet<URI> result = new LinkedHashSet<URI>(); Types types = context.getTypes(); for (String annotation : context.getConfig().getTypesOfInterest()) { AnnotationType atype = (AnnotationType) types.getBy(annotation); if (null != atype) { Collection<AnnotatedElement> coll = atype.allAnnotatedTypes(); for (AnnotatedElement ae : coll) { Type type = types.getBy(ae.getName()); if (null != type) { for (URI uri : type.getDefiningURIs()) { try { result.add(new File(uri).getCanonicalFile().toURI()); } catch (IOException e) { throw new RuntimeException(e); } } } } } } return Collections.unmodifiableSet(result); }
/** * Given the set of annotations that comprise Hk2, as well as the provided classpath / files to * introspect, return the set of URIs that actually reference something of "significant value" * pertaining to habitat creation. */ private Set<URI> getSignificantURIReferences() { LinkedHashSet<URI> result = new LinkedHashSet<URI>(); Types types = context.getTypes(); for (String annotation : context.getConfig().getTypesOfInterest()) { AnnotationType atype = (AnnotationType) types.getBy(annotation); if (null != atype) { Collection<AnnotatedElement> coll = atype.allAnnotatedTypes(); for (AnnotatedElement ae : coll) { Type type = types.getBy(ae.getName()); if (null != type) { for (URI uri : type.getDefiningURIs()) { try { result.add(new File(uri).getCanonicalFile().toURI()); } catch (IOException e) { throw new RuntimeException(e); } } } } } } return Collections.unmodifiableSet(result); }
@Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { desc = unwrap(desc); final AnnotationTypeImpl at = (AnnotationTypeImpl) typeBuilder.getType(Opcodes.ACC_ANNOTATION, desc, null); final AnnotationModelImpl am = new AnnotationModelImpl(type, at); // reverse index at.getAnnotatedElements().add(type); // forward index type.addAnnotation(am); if (ctx.getConfig().getAnnotationsOfInterest().contains(desc)) { logger.log(Level.FINER, "Inspecting fields of {0}", type.getName()); deepVisit =true; } annotationVisitor.getContext().annotation=am; return annotationVisitor; }
@Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { desc = unwrap(desc); final AnnotationTypeImpl at = (AnnotationTypeImpl) typeBuilder.getType(Opcodes.ACC_ANNOTATION, desc, null); final AnnotationModelImpl am = new AnnotationModelImpl(type, at); // reverse index at.getAnnotatedElements().add(type); // forward index type.addAnnotation(am); if (ctx.getConfig().getAnnotationsOfInterest().contains(desc)) { logger.log(Level.FINER, "Inspecting fields of {0}", type.getName()); deepVisit =true; } annotationVisitor.getContext().annotation=am; return annotationVisitor; }
type.getProxy().visited(); type.addDefiningURI(classDefURI); deepVisit = ctx.getConfig().getAnnotationsOfInterest().isEmpty();
type.getProxy().visited(); type.addDefiningURI(classDefURI); deepVisit = ctx.getConfig().getAnnotationsOfInterest().isEmpty();
public ModelClassVisitor(ParsingContext ctx, URI definingURI, String entryName, boolean isApplicationClass) { super(Opcodes.ASM6); this.ctx = ctx; this.definingURI = definingURI; this.entryName = entryName; typeBuilder = ctx.getTypeBuilder(definingURI); classContext = new ClassVisitingContext(); visitingContext = new MemberVisitingContext(ctx.getConfig().modelUnAnnotatedMembers()); fieldVisitor = new ModelFieldVisitor(visitingContext); methodVisitor = new ModelMethodVisitor(visitingContext); annotationVisitor = new ModelAnnotationVisitor(); defaultAnnotationVisitor = new ModelDefaultAnnotationVisitor(methodVisitor.getContext()); this.isApplicationClass = isApplicationClass; }
public ModelClassVisitor(ParsingContext ctx, URI definingURI, String entryName, boolean isApplicationClass) { super(Opcodes.ASM6); this.ctx = ctx; this.definingURI = definingURI; this.entryName = entryName; typeBuilder = ctx.getTypeBuilder(definingURI); classContext = new ClassVisitingContext(); visitingContext = new MemberVisitingContext(ctx.getConfig().modelUnAnnotatedMembers()); fieldVisitor = new ModelFieldVisitor(visitingContext); methodVisitor = new ModelMethodVisitor(visitingContext); annotationVisitor = new ModelAnnotationVisitor(); defaultAnnotationVisitor = new ModelDefaultAnnotationVisitor(methodVisitor.getContext()); this.isApplicationClass = isApplicationClass; }