Package org.osgi.annotation.bundle

# Annotation Type Export

@Documented @Retention(CLASS) @Target(PACKAGE) public @interface Export
Mark a package to be exported from its bundle.

The package must also be annotation with the `Version` annotation to specify the export version of the package.

This annotation is not retained at runtime. It is for use by tools to generate bundle manifests or otherwise process the package.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static final class`
`Export.Substitution`
Substitution policy for this package.

## Optional Element Summary

Optional Elements
Modifier and Type
Optional Element
Description
`String[]`
`attribute`
A list of attribute or directive names and values.
`String`
`substitution`
Specify the policy for substitutably importing this package.
`String[]`
`uses`
A list of package names that are used by this package.

## Element Details

### uses

String[] uses
A list of package names that are used by this package.

If the `uses` directive must be omitted from the export package clause for this package, the empty value `{}` must be specified.

If not specified, the `uses` directive for the export package clause is calculated by inspection of the classes in this package.

Default:
  `{}`

### attribute

String[] attribute
A list of attribute or directive names and values.

Each string should be specified in the form:

- `"name=value"` for attributes.
- `"name:type=value"` for typed attributes.
- `"name:=value"` for directives.

These are added, separated by semicolons, to the export package clause.

Default:
  `{}`

### substitution

String substitution
Specify the policy for substitutably importing this package.

Bundles that collaborate require the same class loader for types used in the collaboration. If multiple bundles export packages with collaboration types then they will have to be placed in disjoint class spaces, making collaboration impossible. Collaboration is significantly improved when bundles are willing to import exported packages; these imports will allow a framework to substitute exports for imports.

If not specified, the `Export.Substitution.CALCULATED` substitution policy is used for this package.

Default:
  `"CALCULATED"`