org.jboss.osgi.resolver.spi
Class AbstractBundleRequirement

java.lang.Object
  extended by org.jboss.osgi.resolver.spi.AbstractRequirement
      extended by org.jboss.osgi.resolver.spi.AbstractBundleRequirement
All Implemented Interfaces:
XAttachmentSupport, XAttributeSupport, XBundleRequirement, XDirectiveSupport, XElement, XRequirement, BundleRequirement, Requirement

public class AbstractBundleRequirement
extends AbstractRequirement
implements XBundleRequirement

The abstract implementation of an XBundleRequirement.

Since:
30-May-2012
Author:
thomas.diesler@jboss.com

Constructor Summary
AbstractBundleRequirement(XResource resource, String namespace, Map<String,Object> atts, Map<String,String> dirs)
           
 
Method Summary
<T> T
addAttachment(Class<T> clazz, T value)
          Attach an arbirtary object with this element.
<T> T
getAttachment(Class<T> clazz)
          Get the attached object for a given key
 BundleRevision getResource()
          Returns the resource declaring this requirement.
 BundleRevision getRevision()
          Returns the bundle revision declaring this requirement.
 boolean matches(BundleCapability cap)
          Returns whether the specified capability matches this requirement.
<T> T
removeAttachment(Class<T> clazz)
          Remove an attached object for a given key
 
Methods inherited from class org.jboss.osgi.resolver.spi.AbstractRequirement
adapt, getAttribute, getAttributes, getDirective, getDirectives, getFilterFromDirective, getNamespace, isOptional, matches, namespaceValueFromFilter, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.osgi.resolver.XRequirement
adapt, isOptional, matches, validate
 
Methods inherited from interface org.jboss.osgi.resolver.XAttachmentSupport
addAttachment, getAttachment, removeAttachment
 
Methods inherited from interface org.jboss.osgi.resolver.XAttributeSupport
getAttribute, getAttributes
 
Methods inherited from interface org.jboss.osgi.resolver.XDirectiveSupport
getDirective, getDirectives
 
Methods inherited from interface org.osgi.framework.wiring.BundleRequirement
getAttributes, getDirectives, getNamespace
 
Methods inherited from interface org.osgi.resource.Requirement
equals, hashCode
 

Constructor Detail

AbstractBundleRequirement

public AbstractBundleRequirement(XResource resource,
                                 String namespace,
                                 Map<String,Object> atts,
                                 Map<String,String> dirs)
Method Detail

getResource

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

Specified by:
getResource in interface BundleRequirement
Specified by:
getResource in interface Requirement
Overrides:
getResource in class AbstractRequirement
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.

addAttachment

public <T> T addAttachment(Class<T> clazz,
                           T value)
Description copied from interface: XAttachmentSupport
Attach an arbirtary object with this element.

Specified by:
addAttachment in interface XAttachmentSupport
Parameters:
clazz - key for the attachment
Returns:
The previously attachment object or null

getAttachment

public <T> T getAttachment(Class<T> clazz)
Description copied from interface: XAttachmentSupport
Get the attached object for a given key

Specified by:
getAttachment in interface XAttachmentSupport
Parameters:
clazz - key for the attachment
Returns:
The attached object or null

removeAttachment

public <T> T removeAttachment(Class<T> clazz)
Description copied from interface: XAttachmentSupport
Remove an attached object for a given key

Specified by:
removeAttachment in interface XAttachmentSupport
Parameters:
clazz - key for the attachment
Returns:
The attached object or null


Copyright © 2012 JBoss by Red Hat. All Rights Reserved.