org.jboss.osgi.resolver.spi
Class AbstractCapabilityWrapper

java.lang.Object
  extended by org.jboss.osgi.resolver.spi.AbstractCapabilityWrapper
All Implemented Interfaces:
XAttachmentSupport, XAttributeSupport, XCapability, XDirectiveSupport, XElement, Capability

public class AbstractCapabilityWrapper
extends Object
implements XCapability

A wrapper for XCapability.

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

Constructor Summary
AbstractCapabilityWrapper(XCapability delegate)
           
 
Method Summary
<T extends XCapability>
T
adapt(Class<T> clazz)
          Adapt this capability to another type
<T> T
addAttachment(Class<T> clazz, T value)
          Attach an arbirtary object with this element.
 boolean equals(Object obj)
          Compares this Capability to another Capability.
<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()
          Returns the namespace of this capability.
 Resource getResource()
          Returns the resource declaring this capability.
 int hashCode()
          Returns the hashCode of this Capability.
<T> T
removeAttachment(Class<T> clazz)
          Remove an attached object for a given key
 String toString()
           
 void validate()
          Validate the capability
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractCapabilityWrapper

public AbstractCapabilityWrapper(XCapability delegate)
Method Detail

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

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 Capability
Returns:
An unmodifiable map of attribute names to attribute values for this capability, or an empty map if this capability has no attributes.

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 Capability
Returns:
An unmodifiable map of directive names to directive values for this capability, or an empty map if this capability has no directives.

validate

public void validate()
Description copied from interface: XCapability
Validate the capability

Specified by:
validate in interface XCapability

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

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

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

getNamespace

public String getNamespace()
Description copied from interface: Capability
Returns the namespace of this capability.

Specified by:
getNamespace in interface Capability
Returns:
The namespace of this capability.

getResource

public Resource getResource()
Description copied from interface: Capability
Returns the resource declaring this capability.

Specified by:
getResource in interface Capability
Returns:
The resource declaring this capability.

adapt

public <T extends XCapability> T adapt(Class<T> clazz)
Description copied from interface: XCapability
Adapt this capability to another type

Specified by:
adapt in interface XCapability

equals

public boolean equals(Object obj)
Description copied from interface: Capability
Compares this Capability to another Capability.

This Capability is equal to another Capability if they have the same namespace, directives and attributes and are declared by the same resource.

Specified by:
equals in interface Capability
Overrides:
equals in class Object
Parameters:
obj - The object to compare against this Capability.
Returns:
true if this Capability is equal to the other object; false otherwise.

hashCode

public int hashCode()
Description copied from interface: Capability
Returns the hashCode of this Capability.

Specified by:
hashCode in interface Capability
Overrides:
hashCode in class Object
Returns:
The hashCode of this Capability.

toString

public String toString()
Overrides:
toString in class Object


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