org.apache.felix.ipojo.util

## Class DependencyMetadataHelper

- java.lang.Object
- - org.apache.felix.ipojo.util.DependencyMetadataHelper

    public class DependencyMetadataHelper
    extends java.lang.Object

A set of methods to simplify the parsing of dependency attributes.

### Constructor Summary

Constructors
Constructor and Description
`DependencyMetadataHelper()`

### Method Summary

All Methods Static Methods Concrete Methods
`static java.util.Comparator` `getComparator(org.apache.felix.ipojo.metadata.Element dep, org.osgi.framework.BundleContext context)` Helper method parsing the comparator attribute and returning the comparator object.
`static int` `getPolicy(org.apache.felix.ipojo.metadata.Element dep)` Helper method parsing the binding policy.
`static java.lang.Class` `loadSpecification(java.lang.String specification, org.osgi.framework.BundleContext context)` Loads the given specification class.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DependencyMetadataHelper

    public DependencyMetadataHelper()

### Method Detail

#### getComparator

    public static java.util.Comparator getComparator(org.apache.felix.ipojo.metadata.Element dep,
                                                     org.osgi.framework.BundleContext context)
                                              throws ConfigurationException

Helper method parsing the comparator attribute and returning the comparator object. If the 'comparator' attribute is not set, this method returns null. If the 'comparator' attribute is set to 'osgi', this method returns the normal OSGi comparator. In other case, it tries to create an instance of the declared comparator class.

Parameters:
  `dep` - the Element describing the dependency
  `context` - the bundle context (to load the comparator class)
Returns:
  the comparator object, `null` if not set.
Throws:
  `ConfigurationException` - the comparator class cannot be load or the comparator cannot be instantiated correctly.

#### loadSpecification

    public static java.lang.Class loadSpecification(java.lang.String specification,
                                                    org.osgi.framework.BundleContext context)
                                             throws ConfigurationException

Loads the given specification class.

Parameters:
  `specification` - the specification class name to load
  `context` - the bundle context
Returns:
  the class object for the given specification
Throws:
  `ConfigurationException` - if the class cannot be loaded correctly.

#### getPolicy

    public static int getPolicy(org.apache.felix.ipojo.metadata.Element dep)
                         throws ConfigurationException

Helper method parsing the binding policy. If the 'policy' attribute is not set in the dependency, the method returns the 'DYNAMIC BINDING POLICY'. Accepted policy values are : dynamic, dynamic-priority and static.

Parameters:
  `dep` - the Element describing the dependency
Returns:
  the policy attached to this dependency
Throws:
  `ConfigurationException` - if an unknown binding policy was described.