org.jboss.osgi.resolver.spi
Class AbstractBundleRequirement

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

public class AbstractBundleRequirement
extends Object
implements XRequirement, org.osgi.framework.wiring.BundleRequirement

The abstract implementation of a BundleRequirement.

Since:
02-Jul-2010
Author:
thomas.diesler@jboss.com

Constructor Summary
protected AbstractBundleRequirement(XRequirement requirement)
           
 
Method Summary
<T> T
adapt(Class<T> clazz)
           
<T> T
addAttachment(Class<T> clazz, T value)
          Attach an arbirtary object with this element.
 boolean equals(Object obj)
           
<T> T
getAttachment(Class<T> clazz)
          Get the attached object for a given key
 Object getAttribute(String key)
          Get the value of the given attribute
 Map<String,Object> getAttributes()
          Get the attributes
 String getDirective(String key)
          Get the value of the given directive
 Map<String,String> getDirectives()
          Get the directives
 String getNamespace()
           
 org.osgi.framework.wiring.BundleRevision getResource()
           
 org.osgi.framework.wiring.BundleRevision getRevision()
           
 int hashCode()
           
 boolean isOptional()
           
 boolean matches(org.osgi.framework.wiring.BundleCapability capability)
           
 boolean matches(org.osgi.framework.resource.Capability capability)
           
<T> T
removeAttachment(Class<T> clazz)
          Remove an attached object for a given key
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.osgi.resolver.XElement
adapt
 
Methods inherited from interface org.jboss.osgi.resolver.XAttachmentSupport
addAttachment, getAttachment, removeAttachment
 

Constructor Detail

AbstractBundleRequirement

protected AbstractBundleRequirement(XRequirement requirement)
Method Detail

getNamespace

public String getNamespace()
Specified by:
getNamespace in interface org.osgi.framework.resource.Requirement
Specified by:
getNamespace in interface org.osgi.framework.wiring.BundleRequirement

isOptional

public boolean isOptional()
Specified by:
isOptional in interface XRequirement

getDirectives

public Map<String,String> getDirectives()
Description copied from interface: XDirectiveSupport
Get the directives

Specified by:
getDirectives in interface XDirectiveSupport
Specified by:
getDirectives in interface org.osgi.framework.resource.Requirement
Specified by:
getDirectives in interface org.osgi.framework.wiring.BundleRequirement

getDirective

public String getDirective(String key)
Description copied from interface: XDirectiveSupport
Get the value of the given directive

Specified by:
getDirective in interface XDirectiveSupport
Returns:
null if no such directive is associated with this capability

getAttributes

public Map<String,Object> getAttributes()
Description copied from interface: XAttributeSupport
Get the attributes

Specified by:
getAttributes in interface XAttributeSupport
Specified by:
getAttributes in interface org.osgi.framework.resource.Requirement
Specified by:
getAttributes in interface org.osgi.framework.wiring.BundleRequirement

getAttribute

public Object getAttribute(String key)
Description copied from interface: XAttributeSupport
Get the value of the given attribute

Specified by:
getAttribute in interface XAttributeSupport
Returns:
null if no such attribute is associated with this capability

getRevision

public org.osgi.framework.wiring.BundleRevision getRevision()
Specified by:
getRevision in interface org.osgi.framework.wiring.BundleRequirement

getResource

public org.osgi.framework.wiring.BundleRevision getResource()
Specified by:
getResource in interface org.osgi.framework.resource.Requirement
Specified by:
getResource in interface org.osgi.framework.wiring.BundleRequirement

matches

public boolean matches(org.osgi.framework.wiring.BundleCapability capability)
Specified by:
matches in interface org.osgi.framework.wiring.BundleRequirement

matches

public boolean matches(org.osgi.framework.resource.Capability capability)
Specified by:
matches in interface org.osgi.framework.resource.Requirement
Specified by:
matches in interface org.osgi.framework.wiring.BundleRequirement

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

adapt

public <T> T adapt(Class<T> clazz)
Specified by:
adapt in interface XElement

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. All Rights Reserved.