public class ClassScanner
extends java.lang.Object
AnnotationProcessor on each scanned class file.| Modifier and Type | Class and Description |
|---|---|
private static class |
ClassScanner.ArtifactFileInputStream |
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
ABSTRACT_DESCRIPTOR_ARCHIV_PATH
The name of the file containing the scanned information from older
SCR generator versions.
|
private java.util.Map<java.lang.String,ClassDescription> |
allDescriptions
All used component descriptions.
|
private AnnotationProcessor |
aProcessor
The annotation processor.
|
private static java.util.regex.Pattern |
ARRAY_PARAM_TYPE_NAME
With this syntax array parameters names are returned by reflection API
|
private static java.lang.String |
GENERATED
Source for all generated descriptions.
|
private IssueLog |
iLog
The issue log.
|
private java.util.Map<java.lang.String,ClassDescription> |
loadedDependencies
Component descriptions loaded from dependencies
|
private Log |
log
The log.
|
private Project |
project
The project.
|
private static java.lang.String |
SERVICE_COMPONENT
The name of the Bundle manifest header providing the list of service
component descriptor files.
|
| Constructor and Description |
|---|
ClassScanner(Log log,
IssueLog iLog,
Project project,
AnnotationProcessor aProcessor)
Create a new scanner.
|
| Modifier and Type | Method and Description |
|---|---|
private <T> T[] |
convertToArray(java.util.List<?> values,
java.lang.Class<T> type) |
private java.util.List<ScannedAnnotation> |
extractAnnotation(org.objectweb.asm.tree.ClassNode classNode,
java.lang.Class<?> annotatedClass)
Extract annotations
|
private java.util.List<org.objectweb.asm.tree.AnnotationNode> |
getAllAnnotations(java.util.List<org.objectweb.asm.tree.AnnotationNode>... annotationLists)
Method is used to get both invisible (e.g.
|
private java.util.Map<java.lang.String,ClassDescription> |
getComponentDescriptors()
Returns a map of component descriptors which may be extended by the java
sources.
|
ClassDescription |
getDescription(java.lang.Class<?> clazz)
Get a description for the class
|
private java.io.InputStream |
getFile(java.io.File artifactFile,
java.lang.String path) |
private java.util.jar.Manifest |
getManifest(java.io.File artifact)
Get the manifest from the artifact.
|
private void |
parseAnnotation(java.util.List<ScannedAnnotation> descriptions,
org.objectweb.asm.tree.AnnotationNode annotation,
java.lang.Object annotatedObject)
Parse annotation and create a description.
|
private void |
process(java.lang.Class<?> annotatedClass,
Source src,
java.util.List<ClassDescription> result)
Process a class
|
private ClassDescription |
processClass(java.lang.Class<?> annotatedClass,
java.lang.String location)
Scan a single class.
|
private void |
readServiceComponentDescriptor(java.io.File artifactFile,
java.lang.String entry)
Read the service component description.
|
private void |
readServiceComponentDescriptor(java.io.InputStream file,
java.lang.String location)
Parses the descriptors read from the given input stream.
|
java.util.List<ClassDescription> |
scanSources()
Scan all source class files for annotations and process them.
|
private static final java.lang.String SERVICE_COMPONENT
private static final java.lang.String ABSTRACT_DESCRIPTOR_ARCHIV_PATH
private static final java.lang.String GENERATED
private static final java.util.regex.Pattern ARRAY_PARAM_TYPE_NAME
private java.util.Map<java.lang.String,ClassDescription> loadedDependencies
private final java.util.Map<java.lang.String,ClassDescription> allDescriptions
private final Log log
private final IssueLog iLog
private final Project project
private final AnnotationProcessor aProcessor
public ClassScanner(Log log, IssueLog iLog, Project project, AnnotationProcessor aProcessor)
public java.util.List<ClassDescription> scanSources() throws SCRDescriptorFailureException, SCRDescriptorException
private void process(java.lang.Class<?> annotatedClass,
Source src,
java.util.List<ClassDescription> result)
throws SCRDescriptorFailureException,
SCRDescriptorException
private ClassDescription processClass(java.lang.Class<?> annotatedClass, java.lang.String location) throws SCRDescriptorFailureException, SCRDescriptorException
private final java.util.List<ScannedAnnotation> extractAnnotation(org.objectweb.asm.tree.ClassNode classNode, java.lang.Class<?> annotatedClass) throws SCRDescriptorException
SCRDescriptorExceptionprivate java.util.List<org.objectweb.asm.tree.AnnotationNode> getAllAnnotations(java.util.List<org.objectweb.asm.tree.AnnotationNode>... annotationLists)
annotationLists - List of invisible and visible annotations.private <T> T[] convertToArray(java.util.List<?> values,
java.lang.Class<T> type)
private void parseAnnotation(java.util.List<ScannedAnnotation> descriptions, org.objectweb.asm.tree.AnnotationNode annotation, java.lang.Object annotatedObject)
public ClassDescription getDescription(java.lang.Class<?> clazz) throws SCRDescriptorException, SCRDescriptorFailureException
private java.util.Map<java.lang.String,ClassDescription> getComponentDescriptors() throws SCRDescriptorException
This method calls the #getDependencies() method and checks for
any Service-Component descriptors in the returned files.
This method may be overwritten by extensions of this class.
SCRDescriptorException - May be thrown if an error occurs
gathering the component descriptors.private void readServiceComponentDescriptor(java.io.InputStream file,
java.lang.String location)
throws SCRDescriptorException
getComponentDescriptors() method to parse the
descriptors gathered in an implementation dependent way.SCRDescriptorException - If an error occurs reading the
descriptors from the stream.private void readServiceComponentDescriptor(java.io.File artifactFile,
java.lang.String entry)
artifact - entry - java.io.IOExceptionSCRDescriptorExceptionprivate java.util.jar.Manifest getManifest(java.io.File artifact)
throws java.io.IOException
java.io.IOExceptionprivate java.io.InputStream getFile(java.io.File artifactFile,
java.lang.String path)
throws java.io.IOException
java.io.IOException