Package org.apache.felix.framework.wiring

# Class BundleRequirementImpl

java.lang.Object
org.apache.felix.framework.wiring.BundleRequirementImpl

All Implemented Interfaces:
  `BundleRequirement`, `Requirement`

Direct Known Subclasses:
  `WrappedRequirement`

public class BundleRequirementImpl extends Object implements BundleRequirement

## Constructor Summary

Constructors
Constructor
Description
`BundleRequirementImpl(BundleRevision revision, String namespace, Map<String,String> dirs, Map<String,Object> attrs)`
`BundleRequirementImpl(BundleRevision revision, String namespace, Map<String,String> dirs, Map<String,Object> attrs, SimpleFilter filter)`

## Method Summary

Modifier and Type
Method
Description
`Map<String,Object>`
`getAttributes()`
Returns the attributes of this requirement.
`Map<String,String>`
`getDirectives()`
Returns the directives of this requirement.
`SimpleFilter`
`getFilter()`
`String`
`getNamespace()`
Returns the namespace of this requirement.
`BundleRevision`
`getResource()`
Returns the resource declaring this requirement.
`BundleRevision`
`getRevision()`
Returns the bundle revision declaring this requirement.
`boolean`
`isOptional()`
`boolean`
`matches(BundleCapability cap)`
Returns whether the specified capability matches this requirement.
`String`
`toString()`

### Methods inherited from class java.lang.Object

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

### Methods inherited from interface org.osgi.resource.Requirement

`equals, hashCode`

## Constructor Details

### BundleRequirementImpl

public BundleRequirementImpl(BundleRevision revision, String namespace, Map<String,String> dirs, Map<String,Object> attrs, SimpleFilter filter)

### BundleRequirementImpl

public BundleRequirementImpl(BundleRevision revision, String namespace, Map<String,String> dirs, Map<String,Object> attrs)

## Method Details

### getNamespace

public String getNamespace()
Description copied from interface: `BundleRequirement`
Returns the namespace of this requirement.

Specified by:
  `getNamespace` in interface `BundleRequirement`
Specified by:
  `getNamespace` in interface `Requirement`
Returns:
  The namespace of this requirement.

### getDirectives

public Map<String,String> getDirectives()
Description copied from interface: `BundleRequirement`
Returns the directives of this requirement.

All requirement directives not specified by the `wiring namespaces` have no specified semantics and are considered extra user defined information.

Specified by:
  `getDirectives` in interface `BundleRequirement`
Specified by:
  `getDirectives` in interface `Requirement`
Returns:
  An unmodifiable map of directive names to directive values for this requirement, or an empty map if this requirement has no directives.

### getAttributes

public Map<String,Object> getAttributes()
Description copied from interface: `BundleRequirement`
Returns the attributes of this requirement.

Requirement attributes have no specified semantics and are considered extra user defined information.

Specified by:
  `getAttributes` in interface `BundleRequirement`
Specified by:
  `getAttributes` in interface `Requirement`
Returns:
  An unmodifiable map of attribute names to attribute values for this requirement, or an empty map if this requirement has no attributes.

### getResource

public BundleRevision getResource()
Description copied from interface: `BundleRequirement`
Returns the resource declaring this requirement.

This method returns the same value as `BundleRequirement.getRevision()`.

Specified by:
  `getResource` in interface `BundleRequirement`
Specified by:
  `getResource` in interface `Requirement`
Returns:
  The resource declaring this requirement. This can be `null` if this requirement is synthesized.

### getRevision

public BundleRevision getRevision()
Description copied from interface: `BundleRequirement`
Returns the bundle revision declaring this requirement.

Specified by:
  `getRevision` in interface `BundleRequirement`
Returns:
  The bundle revision declaring this requirement.

### matches

public boolean matches(BundleCapability cap)
Description copied from interface: `BundleRequirement`
Returns whether the specified capability matches this requirement.

Specified by:
  `matches` in interface `BundleRequirement`
Parameters:
  `cap` - The capability to match to this requirement.
Returns:
  `true` if the specified capability has the same `namespace` as this requirement and the filter for this requirement matches the `attributes of the specified capability`; `false` otherwise.

### isOptional

public boolean isOptional()

### getFilter

public SimpleFilter getFilter()

### toString

public String toString()

Overrides:
  `toString` in class `Object`