Debian Codegraph @

src/aQute/bnd/annotation/headers/package-info.java

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 /**
2 * This package contains a number of annotations that create or append headers
3 * in the manifest. These annotations simplify maintaining these headers:
4 * <ul>
5 * <li>The annotations can be applied on the types that are generating their
6 * need instead of maintaining them in the manifest
7 * <li>Less errors because of the use of annotations
8 * <li>Use of IDE features to track them or navigate
9 * </ul>
10 * The annotations provide the following features:
11 * <ul>
12 * <li>Macros - use the bnd macro preprocessor for DNRY
13 * <li>Coloring - define custom annotations that encapsulate some headers
14 * <li>No runtime dependencies since all annotations are build time.
15 * <li>No duplicates
16 * </ul>
17 * <h2>Macros</h2> Any strings in the annotations are run through the bnd
18 * preprocessor and can therefore use any of the myriad of bnd macros (except
19 * system commands, for obvious reason they are excluded). As a convenience, a
20 * number of local macros are set from the context:
21 * <ul>
22 * <li><code>${&#64;package}</code> – The package name
23 * <li><code>${&#64;class}</code> – The class name to which this macro is
24 * applied to
25 * <li><code>${&#64;class-short}</code> – The short class name to which this
26 * macro is applied to
27 * <li><code>${&#64;version}</code> – The package version if set
28 * <li><code>${&#64;frange;version[;isProvider]}</code> – A macro to create a
29 * filter expression on a version based on the semantic versioning rules.
30 * Default is consumer, specify true for the isProvider to get provider
31 * semantics.
32 * </ul>
33 * <h2>Coloring</h2> Annotations can only be applied once, making it impossible
34 * to add for example two Provide-Capability headers on the same type. It also
35 * would become unreadable quickly. The advised way to use most of these
36 * annotation headers is therefore through 'annotation coloring'. These header
37 * annotations should be applied to custom annotations that represents the
38 * 'thing'. This is clearly represented in the BundleLicense custom annotations
39 * like for example the {@link aQute.bnd.annotation.licenses.ASL_2_0 ASL_2_0}
40 * annotation. This annotation can be applied to any type and will automatically
41 * then create the appropriate clauses.
42 * <p>
43 * For example:
44 *
45 * <pre>
46 * public class Webserver {
47 * &#64;RequireCapability(ns="osgi.extender", name="webserver", version="${&#64;version}")
48 * &#64;interface Require {}
49 * &#64;ProvideCapability(ns="osgi.extender", filter="(&amp;(osgi.extender=webserver)${&#64;frange;${&#64;version}}))")
50 * &#64;interface Provide {}
51 * ...
52 * }
53 * </pre>
54 *
55 * This resource can now be stored in a library to be used by others. If a
56 * component now wants to depend this resource, it can declare its component as
57 * follows:
58 *
59 * <pre>
60 * &#64;Webserver.Require
61 * public class MyResource {
62 * ...
63 * }
64 * </pre>
65 */
66 @org.osgi.annotation.bundle.Export
67 @org.osgi.annotation.versioning.Version("2.0.0")
68 package aQute.bnd.annotation.headers;