org.qi4j.api
Interface Qi4j

All Known Subinterfaces:
Qi4jSPI

public interface Qi4j

Encapsulation of the Qi4j API.


Method Summary
<T> T
dereference(T composite)
          If a Modifier gets a reference to the Composite using @This, then that reference must be dereferenced using this method before handing it out for others to use.
<T> T
getConfigurationInstance(ServiceComposite serviceComposite, UnitOfWork uow)
          Finds the Configuration instance of a service.
 Class<?> getConfigurationType(Composite serviceComposite)
           
 Module getModule(Composite composite)
          Returns the Module where the Composite belongs.
 Module getModule(ServiceReference service)
          Returns the Module where the service is located.
 Module getModule(UnitOfWork uow)
          Returns the Module where the UnitOfWork belongs.
<S extends Composite,T extends S>
Class<S>
getSuperComposite(Class<T> compositeClass)
          Get the super Composite of the given Composite.
 

Method Detail

dereference

<T> T dereference(T composite)
If a Modifier gets a reference to the Composite using @This, then that reference must be dereferenced using this method before handing it out for others to use.

Parameters:
composite - instance reference injected in Modified using @This
Returns:
the dereferenced Composite

getSuperComposite

<S extends Composite,T extends S> Class<S> getSuperComposite(Class<T> compositeClass)
Get the super Composite of the given Composite.

If one Composite type MyComposite is extended by CustomMyComposite interface, then the MyComposite is considered to be the super Composite of CustomMyComposite. A Composite may only extend one other Composite, but may extend any number of other interfaces which do not in turn extend Composite.

If there are multiple super composites, this method will only return the first one found.

Parameters:
compositeClass - the Composite type whose super Composite should be returned
Returns:
the super Composite of the given Composite, or null if it does not have one

getConfigurationInstance

<T> T getConfigurationInstance(ServiceComposite serviceComposite,
                               UnitOfWork uow)
                           throws InstantiationException
Finds the Configuration instance of a service.

This is used by ConfigurationMixin to figure out the configuration instance used by a Service using Configuration, and should not be used directly by client code.

If the Configuration entity doesn't exist in the visible EntityStore, then a properties file with the name of the service identifier will be located on the classpath, and the values used to create the Configuration instance, which will then be saved to the EntityStore for future use. That means that the properties file is only used

Parameters:
serviceComposite - the service instance
uow - the UnitOfWork from which the configuration will be loaded
Returns:
configuration instance
Throws:
InstantiationException - thrown if the configuration cannot be instantiated

getConfigurationType

Class<?> getConfigurationType(Composite serviceComposite)

getModule

Module getModule(UnitOfWork uow)
Returns the Module where the UnitOfWork belongs.

Parameters:
uow - The UnitOfWork to be checked.
Returns:
The Module instance where the UnitOfWork belongs.

getModule

Module getModule(Composite composite)
Returns the Module where the Composite belongs.

Parameters:
composite - The Composite to be checked.
Returns:
The Module instance where the Composite belongs.

getModule

Module getModule(ServiceReference service)
Returns the Module where the service is located.

Parameters:
service - The service to be checked.
Returns:
The Module instance where the Composite belongs.