# Interface BundleDescription

All Superinterfaces:
  `BaseDescription, BundleReference, BundleRevision, Resource`

public interface BundleDescription extends BaseDescription, BundleRevision
This class represents a specific version of a bundle in the system.

This interface is not intended to be implemented by clients. The `StateObjectFactory` should be used to construct instances.

Since:
  3.1
Restriction:
  This interface is not intended to be implemented by clients.

## Field Summary

### Fields inherited from interface BundleRevision

`BUNDLE_NAMESPACE, HOST_NAMESPACE, PACKAGE_NAMESPACE, TYPE_FRAGMENT`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`attachFragments()`
Returns true if this bundle allows fragments to attach
`boolean`
`dynamicFragments()`
Returns true if this bundle allows fragments to attach dynamically after it has been resolved.
`ImportPackageSpecification[]`
`getAddedDynamicImportPackages()`
Returns an array of dynamic import package specifications that have been added dynamically to this bundle description.
`Map<String,Object>`
`getAttributes()`
Returns the arbitrary attributes for this bundle description.
`long`
`getBundleId()`
Returns the numeric id of this bundle.
`State`
`getContainingState()`
Returns the state object which hosts this bundle. null is returned if this bundle is not currently in a state.
`BundleDescription[]`
`getDependents()`
Returns all bundles which depend on this bundle.
`String[]`
`getExecutionEnvironments()`
Returns the list of execution environments that are required by this bundle.
`ExportPackageDescription[]`
`getExportPackages()`
Returns an array of export package descriptions defined by the Export-Package clauses.
`BundleDescription[]`
`getFragments()`
Returns all fragments known to this bundle (regardless resolution status).
`GenericDescription[]`
`getGenericCapabilities()`
Returns an array of generic descriptions for the capabilities of this bundle.
`GenericSpecification[]`
`getGenericRequires()`
Returns an array of generic specifications constraints required by this bundle.
`HostSpecification`
`getHost()`
Returns the host for this bundle. null is returned if this bundle is not a fragment.
`ImportPackageSpecification[]`
`getImportPackages()`
Returns an array of import package specifications defined by the Import-Package clause.
`String`
`getLocation()`
The location string for this bundle.
`NativeCodeSpecification`
`getNativeCodeSpecification()`
Returns the native code specification for this bundle.
`String`
`getPlatformFilter()`
Returns the platform filter in the form of an LDAP filter
`BundleSpecification[]`
`getRequiredBundles()`
Returns an array of bundle specifications defined by the Require-Bundle clause in this bundle.
`GenericDescription[]`
`getResolvedGenericRequires()`
Returns all the capabilities that satisfy all the capability requirements for this bundle.
`ExportPackageDescription[]`
`getResolvedImports()`
Returns all the export packages that satisfy all the imported packages for this bundle.
`BundleDescription[]`
`getResolvedRequires()`
Returns all the bundle descriptions that satisfy all the require bundles for this bundle.
`ExportPackageDescription[]`
`getSelectedExports()`
Returns all the exported packages from this bundle that have been selected by the resolver.
`GenericDescription[]`
`getSelectedGenericCapabilities()`
Returns all the capabilities provided by ths bundle that have been selected by the resolver.
`ExportPackageDescription[]`
`getSubstitutedExports()`
Returns the export packages that satisfy imported packages for this bundle description and substitute one of the exports for this bundle description.
`String`
`getSymbolicName()`
Gets the Bundle-SymbolicName of this BundleDescription.
`boolean`
`hasDynamicImports()`
Returns true if this bundle has one or more dynamically imported packages.
`boolean`
`isRemovalPending()`
Returns whether this bundle is pending a removal.
`boolean`
`isResolved()`
Returns true if this bundle is resolved in its host state.
`boolean`
`isSingleton()`
Returns whether this bundle is a singleton.
`String`
`toString()`
Returns the string representation of this bundle.

### Methods inherited from interface BaseDescription

`getCapability, getDeclaredAttributes, getDeclaredDirectives, getName, getSupplier, getUserObject, getVersion, setUserObject`

### Methods inherited from interface BundleReference

`getBundle`

### Methods inherited from interface BundleRevision

`getCapabilities, getDeclaredCapabilities, getDeclaredRequirements, getRequirements, getTypes, getVersion, getWiring`

### Methods inherited from interface Resource

`equals, hashCode`

## Method Details

### getSymbolicName

String getSymbolicName()
Gets the Bundle-SymbolicName of this BundleDescription. Same as calling `BaseDescription.getName()`.

Specified by:
  `getSymbolicName` in interface `BundleRevision`
Returns:
  The bundle symbolic name or null if the bundle does not have a symbolic name.

### getAttributes

Map<String,Object> getAttributes()
Returns the arbitrary attributes for this bundle description.

Returns:
  the arbitrary attributes for this bundle description
Since:
  3.7

### getLocation

String getLocation()
The location string for this bundle.

Returns:
  The bundle location or null if the bundle description does not have a location

### getRequiredBundles

BundleSpecification[] getRequiredBundles()
Returns an array of bundle specifications defined by the Require-Bundle clause in this bundle.

Returns:
  an array of bundle specifications

### getExportPackages

ExportPackageDescription[] getExportPackages()
Returns an array of export package descriptions defined by the Export-Package clauses. All export package descriptions are returned even if they have not been selected by the resolver as an exporter of the package.

Returns:
  an array of export package descriptions

### getImportPackages

ImportPackageSpecification[] getImportPackages()
Returns an array of import package specifications defined by the Import-Package clause.

Returns:
  an array of import package specifications

### getAddedDynamicImportPackages

ImportPackageSpecification[] getAddedDynamicImportPackages()
Returns an array of dynamic import package specifications that have been added dynamically to this bundle description.

Returns:
  an array of dynamic import package specifications
Since:
  3.7
See Also:
  - `State.addDynamicImportPackages(BundleDescription, ImportPackageSpecification[])`

### getGenericRequires

GenericSpecification[] getGenericRequires()
Returns an array of generic specifications constraints required by this bundle.

Returns:
  an array of generic specifications
Since:
  3.2

### getGenericCapabilities

GenericDescription[] getGenericCapabilities()
Returns an array of generic descriptions for the capabilities of this bundle.

Returns:
  an array of generic descriptions
Since:
  3.2

### hasDynamicImports

boolean hasDynamicImports()
Returns true if this bundle has one or more dynamically imported packages.

Returns:
  true if this bundle has one or more dynamically imported packages.

### getSelectedExports

ExportPackageDescription[] getSelectedExports()
Returns all the exported packages from this bundle that have been selected by the resolver. The returned list will include the ExportPackageDescriptions returned by `getExportPackages()` that have been selected by the resolver and packages which are propagated by this bundle.

Returns:
  the selected list of packages that this bundle exports. If the bundle is unresolved or has no shared packages then an empty array is returned.

### getSelectedGenericCapabilities

GenericDescription[] getSelectedGenericCapabilities()
Returns all the capabilities provided by ths bundle that have been selected by the resolver. The returned list will include the capabilities returned by `getGenericCapabilities()` that have been selected by the resolver and any capabilities provided by fragments attached to this bundle.

Returns:
  the selected capabilities that this bundle provides. If the bundle is unresolved or has no capabilities then an empty array is returned.
Since:
  3.7

### getResolvedRequires

BundleDescription[] getResolvedRequires()
Returns all the bundle descriptions that satisfy all the require bundles for this bundle. If the bundle is not resolved or the bundle does not require any bundles then an empty array is returned.

Returns:
  the bundles descriptions that satisfy all the require bundles for this bundle.

### getResolvedImports

ExportPackageDescription[] getResolvedImports()
Returns all the export packages that satisfy all the imported packages for this bundle. If the bundle is not resolved or the bundle does not import any packages then an empty array is returned.

Returns:
  the exported packages that satisfy all the imported packages for this bundle.

### getResolvedGenericRequires

GenericDescription[] getResolvedGenericRequires()
Returns all the capabilities that satisfy all the capability requirements for this bundle. This includes any capabilities required by fragments attached to this bundle.

Returns:
  the capabilities that satisfy all the capability requirements for this bundle. If the bundle is unresolved or has no capability requirements then an empty array is returned.
Since:
  3.7

### isResolved

boolean isResolved()
Returns true if this bundle is resolved in its host state.

Returns:
  true if this bundle is resolved in its host state.

### getContainingState

State getContainingState()
Returns the state object which hosts this bundle. null is returned if this bundle is not currently in a state.

Returns:
  the state object which hosts this bundle.

### toString

String toString()
Returns the string representation of this bundle.

Overrides:
  `toString` in class `Object`
Returns:
  String representation of this bundle.

### getHost

HostSpecification getHost()
Returns the host for this bundle. null is returned if this bundle is not a fragment.

Returns:
  the host for this bundle.

### getBundleId

long getBundleId()
Returns the numeric id of this bundle. Typically a bundle description will only have a numeric id if it represents a bundle that is installed in a framework as the framework assigns the ids. -1 is returned if the id is not known.

Returns:
  the numeric id of this bundle description

### getFragments

BundleDescription[] getFragments()
Returns all fragments known to this bundle (regardless resolution status).

Returns:
  an array of BundleDescriptions containing all known fragments

### isSingleton

boolean isSingleton()
Returns whether this bundle is a singleton. Singleton bundles require that at most one single version of the bundle can be resolved at a time.

The existence of a single bundle marked as singleton causes all bundles with the same symbolic name to be treated as singletons as well.

Returns:
  `true`, if this bundle is a singleton, `false` otherwise

### isRemovalPending

boolean isRemovalPending()
Returns whether this bundle is pending a removal. A bundle is pending removal if it has been removed from the state but other bundles in the state currently depend on it.

Returns:
  `true`, if this bundle is pending a removal, `false` otherwise

### getDependents

BundleDescription[] getDependents()
Returns all bundles which depend on this bundle. A bundle depends on another bundle if it requires the bundle, imports a package which is exported by the bundle, is a fragment to the bundle or is the host of the bundle.

Returns:
  all bundles which depend on this bundle.

### getPlatformFilter

String getPlatformFilter()
Returns the platform filter in the form of an LDAP filter

Returns:
  the platfomr filter in the form of an LDAP filter

### attachFragments

boolean attachFragments()
Returns true if this bundle allows fragments to attach

Returns:
  true if this bundle allows fragments to attach

### dynamicFragments

boolean dynamicFragments()
Returns true if this bundle allows fragments to attach dynamically after it has been resolved.

Returns:
  true if this bundle allows fragments to attach dynamically

### getExecutionEnvironments

String[] getExecutionEnvironments()
Returns the list of execution environments that are required by this bundle. Any one of the listed execution environments will allow this bundle to be resolved.

Returns:
  the list of execution environments that are required.
Since:
  3.2

### getNativeCodeSpecification

NativeCodeSpecification getNativeCodeSpecification()
Returns the native code specification for this bundle. A value of `null` is returned if there is no native code specification.

Returns:
  the native code specification.
Since:
  3.4

### getSubstitutedExports

ExportPackageDescription[] getSubstitutedExports()
Returns the export packages that satisfy imported packages for this bundle description and substitute one of the exports for this bundle description. If the bundle is not resolved or the bundle does not have substituted exports then an empty array is returned.

Returns:
  all substituted exports for this bundle description
Since:
  3.4