org.jboss.osgi.resolver.spi
Class AbstractPackageRequirement

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

public class AbstractPackageRequirement
extends AbstractRequirement
implements XPackageRequirement

The abstract implementation of a XPackageRequirement.

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

Constructor Summary
AbstractPackageRequirement(Resource res, Map<String,Object> attrs, 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
protected  Set<String> getMandatoryAttributes()
           
 String getPackageName()
          The package name
 VersionRange getVersionRange()
          The package version range.
 boolean isDynamic()
          A flag indicating that this is a dynamic package requirement
 boolean matches(XCapability cap)
          Matches this requirement against the given capability.
 boolean matchNamespaceValue(XCapability cap)
           
<T> T
removeAttachment(Class<T> clazz)
          Remove an attached object for a given key
 
Methods inherited from class org.jboss.osgi.resolver.spi.AbstractRequirement
getAttribute, getAttributes, getDirective, getDirectives, getNamespace, getResource, isOptional, matchFilterValue, toString, validateAttributes
 
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
isOptional
 
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.resource.Requirement
equals, getAttributes, getDirectives, getNamespace, getResource, hashCode
 

Constructor Detail

AbstractPackageRequirement

public AbstractPackageRequirement(Resource res,
                                  Map<String,Object> attrs,
                                  Map<String,String> dirs)
Method Detail

getMandatoryAttributes

protected Set<String> getMandatoryAttributes()
Overrides:
getMandatoryAttributes in class AbstractRequirement

getPackageName

public String getPackageName()
Description copied from interface: XPackageRequirement
The package name

Specified by:
getPackageName in interface XPackageRequirement

getVersionRange

public VersionRange getVersionRange()
Description copied from interface: XPackageRequirement
The package version range.

Specified by:
getVersionRange in interface XPackageRequirement

isDynamic

public boolean isDynamic()
Description copied from interface: XPackageRequirement
A flag indicating that this is a dynamic package requirement

Specified by:
isDynamic in interface XPackageRequirement

matchNamespaceValue

public boolean matchNamespaceValue(XCapability cap)
Overrides:
matchNamespaceValue in class AbstractRequirement

matches

public boolean matches(XCapability cap)
Description copied from interface: XRequirement
Matches this requirement against the given capability.

Specified by:
matches in interface XRequirement
Overrides:
matches in class AbstractRequirement

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.