Debian Codegraph @

src/org/osgi/annotation/bundle/Export.java

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 /*******************************************************************************
2 * Copyright (c) Contributors to the Eclipse Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 *******************************************************************************/
18
19 package org.osgi.annotation.bundle;
20
21 import java.lang.annotation.Documented;
22 import java.lang.annotation.ElementType;
23 import java.lang.annotation.Retention;
24 import java.lang.annotation.RetentionPolicy;
25 import java.lang.annotation.Target;
26
27 import org.osgi.annotation.versioning.ConsumerType;
28 import org.osgi.annotation.versioning.ProviderType;
29 import org.osgi.annotation.versioning.Version;
30
31 /**
32 * Mark a package to be exported from its bundle.
33 * <p>
34 * The package must also be annotation with the {@link Version} annotation to
35 * specify the export version of the package.
36 * <p>
37 * This annotation is not retained at runtime. It is for use by tools to
38 * generate bundle manifests or otherwise process the package.
39 *
40 * @author $Id: 07e458dc13fd696af03961131a4fd91ac7c02774 $
41 */
42 @Documented
43 @Retention(RetentionPolicy.CLASS)
44 @Target(ElementType.PACKAGE)
45 public @interface Export {
46 /**
47 * A list of package names that are used by this package.
48 * <p>
49 * If the {@code uses} directive must be omitted from the export package
50 * clause for this package, the empty value <code>&#x7B;&#x7D;</code> must
51 * be specified.
52 * <p>
53 * If not specified, the {@code uses} directive for the export package
54 * clause is calculated by inspection of the classes in this package.
55 */
56 String[] uses() default {};
57
58 /**
59 * A list of attribute or directive names and values.
60 * <p>
61 * Each string should be specified in the form:
62 * <ul>
63 * <li>{@code "name=value"} for attributes.</li>
64 * <li>{@code "name:type=value"} for typed attributes.</li>
65 * <li>{@code "name:=value"} for directives.</li>
66 * </ul>
67 * These are added, separated by semicolons, to the export package clause.
68 */
69 String[] attribute() default {};
70
71 /**
72 * Specify the policy for substitutably importing this package.
73 * <p>
74 * Bundles that collaborate require the same class loader for types used in
75 * the collaboration. If multiple bundles export packages with collaboration
76 * types then they will have to be placed in disjoint class spaces, making
77 * collaboration impossible. Collaboration is significantly improved when
78 * bundles are willing to import exported packages; these imports will allow
79 * a framework to substitute exports for imports.
80 * <p>
81 * If not specified, the {@link Substitution#CALCULATED} substitution
82 * policy is used for this package.
83 */
84 String substitution() default Substitution.CALCULATED;
85
86 /**
87 * Substitution policy for this package.
88 */
89 public final class Substitution {
90 private Substitution() {
91 }
92 /**
93 * Use a consumer type version range for the import package clause when
94 * substitutably importing a package.
95 *
96 * @see ConsumerType
97 */
98 public static final String CONSUMER = "CONSUMER";
99
100 /**
101 * Use a provider type version range for the import package clause when
102 * substitutably importing a package.
103 *
104 * @see ProviderType
105 */
106 public static final String PROVIDER = "PROVIDER";
107
108 /**
109 * The package must not be substitutably imported.
110 */
111 public static final String NOIMPORT = "NOIMPORT";
112
113 /**
114 * The policy value is calculated by inspection of the classes in the
115 * package.
116 */
117 public static final String CALCULATED = "CALCULATED";
118 }
119 }