# Class Descriptor

java.lang.Object
org.apache.sling.feature.scanner.Descriptor

Direct Known Subclasses:
  `ArtifactDescriptor, ContainerDescriptor`

public abstract class Descriptor extends Object
A descriptor holds information about requirements and capabilities. Note that this implementation is not synchronized. If multiple threads access a descriptor concurrently, and at least one of the threads modifies the descriptor structurally, it must be synchronized externally. However, once a descriptor is locked, it is safe to access it concurrently.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`Descriptor(String name)`
Constructor for a new descriptor

## Method Summary

Modifier and Type
Method
Description
`protected void`
`aggregate(Descriptor d)`
Aggregate with data from provided descriptor
`protected void`
`checkLocked()`
Internal method for checking locked state
`final Set<org.osgi.resource.Capability>`
`getCapabilities()`
Return the list of capabilities.
`final Set<org.osgi.resource.Capability>`
`getCapabilities(String namespace)`
`final Set<PackageInfo>`
`getDynamicImportedPackages()`
Return a set of dynamic imported packages
`final Set<PackageInfo>`
`getExportedPackages()`
Return a set of exported packages
`final Set<PackageInfo>`
`getExportedPackages(String packageName)`
`final Set<PackageInfo>`
`getImportedPackages()`
Return a set of imported packages
`String`
`getName()`
Returns the name of the entity associated with this descriptor.
`final Set<org.apache.sling.feature.MatchingRequirement>`
`getRequirements()`
Return the list of requirements.
`final boolean`
`isLocked()`
Check if the descriptor is locked
`void`
`lock()`
Lock the descriptor.
`String`
`toString()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### Descriptor

protected Descriptor(String name)
Constructor for a new descriptor

Parameters:
  `name` - Name
Throws:
  `IllegalArgumentException` - if name is `null`

## Method Details

### lock

public void lock()
Lock the descriptor. Once invoked no changes can be made to the descriptor.

### isLocked

public final boolean isLocked()
Check if the descriptor is locked

Returns:
  `true` if locked.

### checkLocked

protected void checkLocked()
Internal method for checking locked state

Throws:
  `IllegalStateException` - If locked

### aggregate

protected void aggregate(Descriptor d)
Aggregate with data from provided descriptor

Parameters:
  `d` - The other descriptor

### getExportedPackages

public final Set<PackageInfo> getExportedPackages()
Return a set of exported packages

Returns:
  The exported packages. Might be empty.

### getExportedPackages

public final Set<PackageInfo> getExportedPackages(String packageName)

### getImportedPackages

public final Set<PackageInfo> getImportedPackages()
Return a set of imported packages

Returns:
  The imported packages. Might be empty.

### getDynamicImportedPackages

public final Set<PackageInfo> getDynamicImportedPackages()
Return a set of dynamic imported packages

Returns:
  The dynamic imported packages. Might be empty.

### getName

public String getName()
Returns the name of the entity associated with this descriptor.

Returns:
  the name.

### getRequirements

public final Set<org.apache.sling.feature.MatchingRequirement> getRequirements()
Return the list of requirements.

Returns:
  The list of requirements. The list might be empty.

### getCapabilities

public final Set<org.osgi.resource.Capability> getCapabilities()
Return the list of capabilities.

Returns:
  The list of capabilities. The list might be empty.

### getCapabilities

public final Set<org.osgi.resource.Capability> getCapabilities(String namespace)

### toString

public String toString()

Overrides:
  `toString` in class `Object`