org.apache.felix.ipojo
Class IPojoFactory.RequiredHandler

java.lang.Object
  extended by org.apache.felix.ipojo.IPojoFactory.RequiredHandler
All Implemented Interfaces:
Comparable
Enclosing class:
IPojoFactory

protected class IPojoFactory.RequiredHandler
extends Object
implements 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
IPojoFactory.RequiredHandler(String name, String namespace)
          Crates a Required Handler.
 
Method Summary
 int compareTo(Object object)
          Start level Comparison.
 boolean equals(Object object)
          Equals method.
 HandlerFactory getFactory()
          Gets the factory object used for this handler.
 String getFullName()
          Gets the handler qualified name (namespace:name).
 int getLevel()
           
 String getName()
           
 String getNamespace()
           
 ServiceReference getReference()
           
 int hashCode()
          Hashcode method.
 void setReference(ServiceReference 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

IPojoFactory.RequiredHandler

public IPojoFactory.RequiredHandler(String name,
                                    String namespace)
Crates a Required Handler.

Parameters:
name - the handler name.
namespace - the handler namespace.
Method Detail

equals

public boolean equals(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 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 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 String getFullName()
Gets the handler qualified name (namespace:name).

Returns:
the handler full name

getName

public String getName()

getNamespace

public String getNamespace()

getReference

public ServiceReference 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(ServiceReference 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(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 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)


Copyright © 2011 Apache Software Foundation. All Rights Reserved.