public class RequirementImpl extends Object implements org.osgi.resource.Requirement
Modifier and Type | Field and Description |
---|---|
protected Map<String,Object> |
attributes
Optional attributes.
|
protected Map<String,String> |
directives
Optional attributes.
|
protected String |
namespace
The namespace.
|
protected org.osgi.resource.Resource |
resource
The resource.
|
Constructor and Description |
---|
RequirementImpl(org.osgi.resource.Resource resource,
org.osgi.resource.Requirement requirement)
Create a requirement based on an existing requirement, providing the resource.
|
RequirementImpl(org.osgi.resource.Resource res,
String ns,
Map<String,String> dirs,
Map<String,Object> attrs)
Create a requirement.
|
RequirementImpl(org.osgi.resource.Resource resource,
String path,
Map<String,String> dirs,
Map<String,Object> attrs,
SimpleFilter sf) |
RequirementImpl(org.osgi.resource.Resource res,
String ns,
String filter)
Create a requirement with a namespace and a filter.
|
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
getAttributes()
Return the attributes.
|
Map<String,String> |
getDirectives()
Return the directives.
|
SimpleFilter |
getFilter() |
static SimpleFilter |
getFilter(org.osgi.resource.Requirement requirement)
Utility method to obtain a SimpleFilter from a given requirement.
|
String |
getNamespace()
Return the namespace.
|
org.osgi.resource.Resource |
getResource()
Return the resource.
|
boolean |
isOptional() |
static boolean |
isOptional(org.osgi.resource.Requirement requirement)
Utility method to check whether a requirement is optional.
|
boolean |
matches(org.osgi.resource.Capability cap) |
String |
toString() |
protected final org.osgi.resource.Resource resource
protected final String namespace
public RequirementImpl(org.osgi.resource.Resource res, String ns, Map<String,String> dirs, Map<String,Object> attrs)
res
- The resource associated with the requirement.ns
- The namespace of the requirement.attrs
- The attributes of the requirement.dirs
- The directives of the requirement.public RequirementImpl(org.osgi.resource.Resource res, String ns, String filter)
res
- The resource associated with the requirement.ns
- The namespace for the requirement.filter
- The filter.public RequirementImpl(org.osgi.resource.Resource resource, org.osgi.resource.Requirement requirement)
requirement
- The requirement to base the new requirement on.resource
- The resource to be associated with the requirementpublic boolean matches(org.osgi.resource.Capability cap)
public boolean isOptional()
public SimpleFilter getFilter()
public static boolean isOptional(org.osgi.resource.Requirement requirement)
requirement
- A requirementtrue
if the requirement it optional, false
otherwise.public static SimpleFilter getFilter(org.osgi.resource.Requirement requirement)
Constants.FILTER_DIRECTIVE
directive,
it will be used, else, the filter will be derived from the attributes.requirement
- A requirementnull
.public String getNamespace()
public Map<String,Object> getAttributes()
public Map<String,String> getDirectives()
public org.osgi.resource.Resource getResource()
Copyright © 2006–2020 The Apache Software Foundation. All rights reserved.