class AnnotationHeaders extends ClassDataCollector implements java.io.Closeable
BundleCopyright. This module applies the semantics of the defined
fields in those annotations. It is called at the post parse phase in
Analyzer. This ClassDataCollector is called for all classes in our
scope. We first look if any header annotations are applied. We also keep
track of what other annotations are applied to these classes. After all the
classes have been parsed, we look at any of the annotations that was applied
to one of the contained classes. These annotations are also parsed then to
check if they have header annotations applied to them.
This may sound a bit bizarre, so let me explain. The idea is that you can create a custom annotation for a specific resource.
@RequireCapability("osgi.webresource;filter:='(&(osgi.
webresource=/google/angular)(version>=${@version}))") @interface
Angular {}
Now all a user has to do is apply the @Angular annotation. It will then
automatically create a Require-Capability, with the version of the package.
@Angular public class MySpace {...}
About provides some more information.| Modifier and Type | Field and Description |
|---|---|
(package private) Analyzer |
analyzer |
(package private) Descriptors.TypeRef |
bundleCategoryRef |
(package private) Descriptors.TypeRef |
bundleContributorRef |
(package private) Descriptors.TypeRef |
bundleCopyrightRef |
(package private) Descriptors.TypeRef |
bundleDeveloperRef |
(package private) Descriptors.TypeRef |
bundleDocURLRef |
(package private) Descriptors.TypeRef |
bundleLicenseRef |
(package private) Clazz |
current |
(package private) boolean |
finalizing |
(package private) MultiMap<java.lang.String,java.lang.String> |
headers |
(package private) java.util.Set<Descriptors.TypeRef> |
interesting |
(package private) Descriptors.TypeRef |
provideCapabilityRef |
(package private) Descriptors.TypeRef |
requireCapabilityRef |
(package private) static java.util.regex.Pattern |
SIMPLE_PARAM_PATTERN |
| Constructor and Description |
|---|
AnnotationHeaders(Analyzer analyzer) |
| Modifier and Type | Method and Description |
|---|---|
private void |
add(java.lang.String name,
java.lang.String value) |
void |
annotation(Annotation annotation) |
boolean |
classStart(Clazz c) |
void |
close() |
private <T> boolean |
containsAny(java.util.Set<T> a,
java.util.Set<T> b) |
private void |
directivesAndVersion(Attrs attrs,
java.lang.String... directives) |
(package private) void |
doAnnotatedAnnotation(Annotation annotation,
Descriptors.TypeRef name)
Handle the case where an annotation is annotated by one of our header
annotations.
|
private void |
doBundeCopyright(BundleCopyright annotation) |
private void |
doBundleCategory(BundleCategory annotation) |
private void |
doBundleContributors(BundleContributors annotation) |
private void |
doBundleDevelopers(BundleDevelopers annotation) |
private void |
doBundleDocURL(BundleDocURL annotation) |
private void |
doLicense(Annotation a) |
private void |
doProvideCapability(Annotation a) |
private void |
doRequireCapability(Annotation a) |
private void |
escape(java.lang.StringBuilder app,
java.lang.String s) |
private void |
escape(java.lang.StringBuilder app,
java.lang.String[] s) |
private Attrs |
getAttributes(Annotation a,
java.lang.String... ignores) |
java.lang.String |
getHeader(java.lang.String name) |
private void |
replaceParameters(Attrs attrs) |
addReference, annotationDefault, annotationDefault, classBegin, classEnd, classStart, constant, deprecated, enclosingMethod, extendsClass, field, implementsInterfaces, innerClass, memberEnd, method, parameter, referenceMethod, referTo, signature, versionstatic final java.util.regex.Pattern SIMPLE_PARAM_PATTERN
final Analyzer analyzer
final java.util.Set<Descriptors.TypeRef> interesting
final MultiMap<java.lang.String,java.lang.String> headers
final Descriptors.TypeRef bundleLicenseRef
final Descriptors.TypeRef requireCapabilityRef
final Descriptors.TypeRef provideCapabilityRef
final Descriptors.TypeRef bundleCategoryRef
final Descriptors.TypeRef bundleDocURLRef
final Descriptors.TypeRef bundleDeveloperRef
final Descriptors.TypeRef bundleContributorRef
final Descriptors.TypeRef bundleCopyrightRef
Clazz current
boolean finalizing
AnnotationHeaders(Analyzer analyzer)
public boolean classStart(Clazz c)
classStart in class ClassDataCollectorpublic void annotation(Annotation annotation) throws java.lang.Exception
annotation in class ClassDataCollectorjava.lang.Exceptionvoid doAnnotatedAnnotation(Annotation annotation, Descriptors.TypeRef name) throws java.lang.Exception
annotation - name - java.lang.Exceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionprivate void doBundleDevelopers(BundleDevelopers annotation) throws java.io.IOException
java.io.IOExceptionprivate void doBundleContributors(BundleContributors annotation) throws java.io.IOException
java.io.IOExceptionprivate void doBundeCopyright(BundleCopyright annotation) throws java.io.IOException
java.io.IOExceptionprivate void doBundleDocURL(BundleDocURL annotation) throws java.io.IOException
java.io.IOExceptionprivate void doBundleCategory(BundleCategory annotation) throws java.io.IOException
java.io.IOExceptionprivate void doProvideCapability(Annotation a) throws java.lang.Exception
java.lang.Exceptionprivate void doRequireCapability(Annotation a) throws java.lang.Exception
java.lang.Exceptionprivate void replaceParameters(Attrs attrs) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionprivate void doLicense(Annotation a) throws java.lang.Exception
java.lang.Exceptionprivate void directivesAndVersion(Attrs attrs, java.lang.String... directives)
private Attrs getAttributes(Annotation a, java.lang.String... ignores)
private void add(java.lang.String name,
java.lang.String value)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getHeader(java.lang.String name)
private <T> boolean containsAny(java.util.Set<T> a,
java.util.Set<T> b)
private void escape(java.lang.StringBuilder app,
java.lang.String[] s)
throws java.io.IOException
java.io.IOExceptionprivate void escape(java.lang.StringBuilder app,
java.lang.String s)
throws java.io.IOException
java.io.IOException