public class SCRDescriptorGenerator
extends java.lang.Object
SCRDescriptorGenerator class does the hard work of
generating the SCR descriptors. This class is being instantiated and
configured by clients and the execute() method called to generate
the descriptor files.
When using this class carefully consider calling all setter methods to properly configure the generator. All setter method document, which default value is assumed for the respective property if the setter is not called.
Instances of this class are not thread save and should not be reused.
| Modifier and Type | Field and Description |
|---|---|
private IssueLog |
iLog
The issue log.
|
private Log |
logger |
private Options |
options
The options.
|
private Project |
project
The project.
|
private ClassScanner |
scanner
The annotation scanner.
|
| Constructor and Description |
|---|
SCRDescriptorGenerator(Log logger)
Create an instance of this generator using the given
Log instance
of logging. |
| Modifier and Type | Method and Description |
|---|---|
private ComponentContainer |
createComponent(ClassDescription desc,
IssueLog iLog)
Create the SCR objects based on the descriptions
|
Result |
execute()
Actually generates the Declarative Services and Metatype descriptors
scanning the java sources provided by the
setProject(Project) |
private void |
generateMethods(ComponentContainer container) |
private boolean |
isPrivateProperty(java.lang.String name) |
private void |
processGlobalProperties(ClassDescription desc,
java.util.Map<java.lang.String,PropertyDescription> allProperties)
Add global properties (if not already defined in the component)
|
private void |
processProperties(ClassDescription current,
ComponentContainer component,
MetatypeContainer ocd)
Process property directives
|
private void |
processReferences(ClassDescription current,
ComponentContainer component)
Process reference directives
|
private void |
processServices(ClassDescription current,
ComponentContainer component)
Process service directives
|
void |
setOptions(Options p)
Set the options.
|
void |
setProject(Project p)
Set the project.
|
private boolean |
testProperty(ClassDescription current,
java.util.Map<java.lang.String,PropertyDescription> allProperties,
PropertyDescription newProperty,
boolean isInspectedClass)
Test a newly found property
|
private void |
testReference(ClassDescription current,
java.util.Map<java.lang.String,ReferenceDescription> allReferences,
ReferenceDescription newReference,
boolean isInspectedClass)
Test a newly found reference
|
private final Log logger
private Project project
private Options options
private ClassScanner scanner
private IssueLog iLog
public void setProject(Project p)
public void setOptions(Options p)
public Result execute() throws SCRDescriptorException, SCRDescriptorFailureException
setProject(Project)SCRDescriptorExceptionSCRDescriptorFailureExceptionprivate void generateMethods(ComponentContainer container) throws SCRDescriptorException
SCRDescriptorExceptionprivate ComponentContainer createComponent(ClassDescription desc, IssueLog iLog) throws SCRDescriptorException
SCRDescriptorExceptionprivate void processServices(ClassDescription current, ComponentContainer component)
private boolean isPrivateProperty(java.lang.String name)
private void processProperties(ClassDescription current, ComponentContainer component, MetatypeContainer ocd)
private void processGlobalProperties(ClassDescription desc, java.util.Map<java.lang.String,PropertyDescription> allProperties)
private boolean testProperty(ClassDescription current, java.util.Map<java.lang.String,PropertyDescription> allProperties, PropertyDescription newProperty, boolean isInspectedClass)
private void processReferences(ClassDescription current, ComponentContainer component)
SCRDescriptorExceptionprivate void testReference(ClassDescription current, java.util.Map<java.lang.String,ReferenceDescription> allReferences, ReferenceDescription newReference, boolean isInspectedClass)