org.apache.felix.utils.resource

## Class CapabilityImpl

- java.lang.Object
- - org.apache.felix.utils.resource.CapabilityImpl

All Implemented Interfaces:
  org.osgi.resource.Capability

    public class CapabilityImpl
    extends Object
    implements org.osgi.resource.Capability

Implementation of the OSGi Capability interface.

### Field Summary

Fields
`protected Map<String,Object>` `attributes` Optional attributes.
`protected Map<String,String>` `directives` Optional attributes.
`protected Set<String>` `mandatory`
`protected String` `namespace` The namespace.
`protected org.osgi.resource.Resource` `resource` The resource.

### Constructor Summary

Constructors
Constructor and Description
`CapabilityImpl(org.osgi.resource.Resource resource, org.osgi.resource.Capability capability)` Create a capability based on an existing capability, providing the resource.
`CapabilityImpl(org.osgi.resource.Resource res, String ns, Map<String,String> dirs, Map<String,Object> attrs)` Create a capability.

### Method Summary

All Methods Instance Methods Concrete Methods
`Map<String,Object>` `getAttributes()` Return the attributes.
`Map<String,String>` `getDirectives()` Return the directives.
`String` `getNamespace()` Return the namespace.
`org.osgi.resource.Resource` `getResource()` Return the resource.
`boolean` `isAttributeMandatory(String name)`
`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.Capability

`equals, getAttributes, getDirectives, getNamespace, getResource, hashCode`

### Field Detail

#### mandatory

    protected final Set<String> mandatory

#### resource

    protected final org.osgi.resource.Resource resource

The resource. Required.

#### namespace

    protected final String namespace

The namespace. Required.

#### directives

    protected final Map<String,String> directives

Optional attributes. Never null.

#### attributes

    protected final Map<String,Object> attributes

Optional attributes. Never null.

### Constructor Detail

#### CapabilityImpl

    public CapabilityImpl(org.osgi.resource.Resource res,
                          String ns,
                          Map<String,String> dirs,
                          Map<String,Object> attrs)

Create a capability.

Parameters:
  `res` - The resource associated with the capability.
  `ns` - The namespace of the capability.
  `attrs` - The attributes of the capability.
  `dirs` - The directives of the capability.

#### CapabilityImpl

    public CapabilityImpl(org.osgi.resource.Resource resource,
                          org.osgi.resource.Capability capability)

Create a capability based on an existing capability, providing the resource. The namespace, attributes and directives are copied from the provided capability.

Parameters:
  `capability` - The capability to base the new requirement on.
  `resource` - The resource to be associated with the capability

### Method Detail

#### isAttributeMandatory

    public boolean isAttributeMandatory(String name)

#### getNamespace

    public String getNamespace()

Return the namespace.

Returns:
  The namespace. This is never @{code null}.

#### getAttributes

    public Map<String,Object> getAttributes()

Return the attributes.

Returns:
  The attributes, might be empty.

#### getDirectives

    public Map<String,String> getDirectives()

Return the directives.

Returns:
  The directives, might be empty.

#### getResource

    public org.osgi.resource.Resource getResource()

Return the resource.

Returns:
  The resource or @{code null}.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`