org.apache.felix.ipojo

## Class IPojoFactory.RequiredHandler

- java.lang.Object
- - org.apache.felix.ipojo.IPojoFactory.RequiredHandler

All Implemented Interfaces:
  java.lang.Comparable

Enclosing class:
  IPojoFactory

    protected class IPojoFactory.RequiredHandler
    extends java.lang.Object
    implements java.lang.Comparable

Structure storing required handlers. Access to this class must mostly be with the lock on the factory. (except to access final fields)

### Constructor Summary

Constructors
Constructor and Description
`RequiredHandler(java.lang.String name, java.lang.String namespace)` Crates a Required Handler.

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `compareTo(java.lang.Object object)` Start level Comparison.
`boolean` `equals(java.lang.Object object)` Equals method.
`HandlerFactory` `getFactory()` Gets the factory object used for this handler.
`java.lang.String` `getFullName()` Gets the handler qualified name (`namespace:name`).
`int` `getLevel()`
`java.lang.String` `getName()`
`java.lang.String` `getNamespace()`
`org.osgi.framework.ServiceReference<? extends HandlerFactory>` `getReference()`
`int` `hashCode()` Hashcode method.
`void` `setReference(org.osgi.framework.ServiceReference<? extends HandlerFactory> ref)` Sets the service reference.
`void` `unRef()` Releases the reference of the used factory.

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

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

### Constructor Detail

#### RequiredHandler

    public RequiredHandler(java.lang.String name,
                           java.lang.String namespace)

Crates a Required Handler.

Parameters:
  `name` - the handler name.
  `namespace` - the handler namespace.

### Method Detail

#### equals

    public boolean equals(java.lang.Object object)

Equals method. Two handlers are equals if they have same name and namespace or they share the same service reference.

Overrides:
  `equals` in class `java.lang.Object`
Parameters:
  `object` - the object to compare to the current object.
Returns:
  `true` if the two compared object are equals
See Also:
  `Object.equals(java.lang.Object)`

#### hashCode

    public int hashCode()

Hashcode method. This method delegates to the `Object.hashCode()`.

Overrides:
  `hashCode` in class `java.lang.Object`
Returns:
  the object hashcode.
See Also:
  `Object.hashCode()`

#### getFactory

    public HandlerFactory getFactory()

Gets the factory object used for this handler. The object is get when used for the first time. This method is called with the lock avoiding concurrent modification and on a valid factory.

Returns:
  the factory object.

#### getFullName

    public java.lang.String getFullName()

Gets the handler qualified name (`namespace:name`).

Returns:
  the handler full name

#### getName

    public java.lang.String getName()

#### getNamespace

    public java.lang.String getNamespace()

#### getReference

    public org.osgi.framework.ServiceReference<? extends HandlerFactory> getReference()

#### getLevel

    public int getLevel()

#### unRef

    public void unRef()

Releases the reference of the used factory. This method is called with the lock on the current factory.

#### setReference

    public void setReference(org.osgi.framework.ServiceReference<? extends HandlerFactory> ref)

Sets the service reference. If the new service reference is `null`, it ungets the used factory (if already get). This method is called with the lock on the current factory.

Parameters:
  `ref` - the new service reference.

#### compareTo

    public int compareTo(java.lang.Object object)

Start level Comparison. This method is used to sort the handler array. This method is called with the lock.

Specified by:
  `compareTo` in interface `java.lang.Comparable`
Parameters:
  `object` - the object on which compare.
Returns:
  `-1`, `0`, `+1` according to the comparison of their start levels.
See Also:
  `Comparable.compareTo(java.lang.Object)`