/** * Create a new scanner. */ public ClassScanner(final Log log, final IssueLog iLog, final Project project, final AnnotationProcessor aProcessor) { // create map for all descriptions and dummy entry for Object this.allDescriptions = new HashMap<String, ClassDescription>(); allDescriptions.put(Object.class.getName(), new ClassDescription(Object.class, GENERATED)); this.log = log; this.iLog = iLog; this.project = project; this.aProcessor = aProcessor; }
public ClassDescription clone() { final ClassDescription cd = new ClassDescription(this.describedClass, this.source); for(final AbstractDescription ad : this.descriptions) { cd.add(ad.clone()); } return cd; } }
/** * Get a description for the class */ public ClassDescription getDescription(final Class<?> clazz) throws SCRDescriptorException, SCRDescriptorFailureException { final String name = clazz.getName(); // we don't need to scan classes in the java. or javax. package namespace if ( name.startsWith("java.") || name.startsWith("javax.") ) { return null; } ClassDescription result = this.allDescriptions.get(name); if ( result == null ) { // use scanner first result = this.processClass(clazz, GENERATED); if ( result == null ) { // now check loaded dependencies result = this.getComponentDescriptors().get(name); } // not found, create dummy if ( result == null ) { result = new ClassDescription(clazz, GENERATED); } // and cache allDescriptions.put(name, result); } return result.clone(); }
this.allDescriptions.put(annotatedClass.getName(), new ClassDescription(annotatedClass, GENERATED));
if (annotations.size() > 0) { final ClassDescription desc = new ClassDescription(annotatedClass, location); aProcessor.process(new ScannedClass(annotations, annotatedClass), desc);
this.currentClass = new ClassDescription(cl, "classpath:" + className); this.currentClass.add(this.currentComponent); this.components.add(this.currentClass);