org.jboss.osgi.metadata.internal
Class AbstractParameterizedAttribute

java.lang.Object
  extended by org.jboss.osgi.metadata.internal.AbstractAttributeAware
      extended by org.jboss.osgi.metadata.internal.AbstractParameterizedAttribute
All Implemented Interfaces:
AttributeAware, ParameterizedAttribute
Direct Known Subclasses:
AbstractPackageAttribute

public class AbstractParameterizedAttribute
extends AbstractAttributeAware
implements ParameterizedAttribute

Parameter attribute impl.

Author:
Ales Justin, Thomas.Diesler@jboss.com

Field Summary
protected  Map<String,Parameter> attributes
           
protected  Map<String,Parameter> directives
           
 
Fields inherited from class org.jboss.osgi.metadata.internal.AbstractAttributeAware
attribute
 
Constructor Summary
AbstractParameterizedAttribute(String attribute, Map<String,Parameter> attributes, Map<String,Parameter> directives)
           
 
Method Summary
 Parameter getAttribute(String name)
          Get an attribute by name.
 Map<String,Parameter> getAttributes()
          Get the attributes.
<T> T
getAttributeValue(String name, Class<T> type)
          Get an attribute value
<T> T
getAttributeValue(String name, T defaultValue, Class<T> type)
          Get a directive value
 Parameter getDirective(String name)
          Get a directive by name.
 Map<String,Parameter> getDirectives()
          Get the declerations
<T> T
getDirectiveValue(String name, Class<T> type)
          Get a directive value
<T> T
getDirectiveValue(String name, T defaultValue, Class<T> type)
          Get a directive value
 String toString()
           
 
Methods inherited from class org.jboss.osgi.metadata.internal.AbstractAttributeAware
getAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.osgi.metadata.AttributeAware
getAttribute
 

Field Detail

attributes

protected Map<String,Parameter> attributes

directives

protected Map<String,Parameter> directives
Constructor Detail

AbstractParameterizedAttribute

public AbstractParameterizedAttribute(String attribute,
                                      Map<String,Parameter> attributes,
                                      Map<String,Parameter> directives)
Method Detail

getAttributes

public Map<String,Parameter> getAttributes()
Description copied from interface: ParameterizedAttribute
Get the attributes.

Specified by:
getAttributes in interface ParameterizedAttribute
Returns:
the attributes or an empty map

getAttribute

public Parameter getAttribute(String name)
Description copied from interface: ParameterizedAttribute
Get an attribute by name.

Specified by:
getAttribute in interface ParameterizedAttribute
Parameters:
name - attributes's name
Returns:
the attribute

getAttributeValue

public <T> T getAttributeValue(String name,
                               Class<T> type)
Description copied from interface: ParameterizedAttribute
Get an attribute value

Specified by:
getAttributeValue in interface ParameterizedAttribute
Type Parameters:
T - the expected type
Parameters:
name - the name of the attribute
type - the expected type
Returns:
the attribute value

getAttributeValue

public <T> T getAttributeValue(String name,
                               T defaultValue,
                               Class<T> type)
Description copied from interface: ParameterizedAttribute
Get a directive value

Specified by:
getAttributeValue in interface ParameterizedAttribute
Type Parameters:
T - the expected type
Parameters:
name - the name of the directive
defaultValue - the default value when no attribute is specified
type - the expected type
Returns:
the attribute value

getDirectives

public Map<String,Parameter> getDirectives()
Description copied from interface: ParameterizedAttribute
Get the declerations

Specified by:
getDirectives in interface ParameterizedAttribute
Returns:
the directives or an empty map

getDirective

public Parameter getDirective(String name)
Description copied from interface: ParameterizedAttribute
Get a directive by name.

Specified by:
getDirective in interface ParameterizedAttribute
Parameters:
name - directive's name
Returns:
the directive

getDirectiveValue

public <T> T getDirectiveValue(String name,
                               Class<T> type)
Description copied from interface: ParameterizedAttribute
Get a directive value

Specified by:
getDirectiveValue in interface ParameterizedAttribute
Type Parameters:
T - the expected type
Parameters:
name - the name of the directive
type - the expected type
Returns:
the directive value

getDirectiveValue

public <T> T getDirectiveValue(String name,
                               T defaultValue,
                               Class<T> type)
Description copied from interface: ParameterizedAttribute
Get a directive value

Specified by:
getDirectiveValue in interface ParameterizedAttribute
Type Parameters:
T - the expected type
Parameters:
name - the name of the directive
defaultValue - the default value when no directive is specified
type - the expected type
Returns:
the directive value

toString

public String toString()
Overrides:
toString in class Object


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