org.apache.hivemind.annotations
Class AbstractAnnotatedModule

java.lang.Object
  extended by org.apache.hivemind.annotations.AbstractAnnotatedModule

public class AbstractAnnotatedModule
extends java.lang.Object

Ancestor for annotated module classes. Provides convenience methods for the access to TypedRegistry and Autowiring.

Author:
Achim Huegen

Constructor Summary
AbstractAnnotatedModule()
           
 
Method Summary
protected
<T> T
autowireProperties(T target)
          Autowires any object by use of the Autowiring service.
protected
<T> T
configuration(java.lang.Class<T> configurationType)
          Finds a configuration by its type.
protected
<T> T
configuration(java.lang.String configurationId, java.lang.Class<T> configurationType)
          Returns the specified configuration from the registry.
protected  org.apache.hivemind.service.Autowiring getAutowiring()
           
 TypedRegistry getRegistry()
           
protected
<T> T
service(java.lang.Class<T> serviceInterface)
          Finds a service that implements the provided interface.
protected
<T> T
service(java.lang.String serviceId, java.lang.Class<T> serviceInterface)
          Returns a service from the registry.
 void setRegistry(TypedRegistry typedRegistry)
          This setter is used to inject the registry reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAnnotatedModule

public AbstractAnnotatedModule()
Method Detail

getRegistry

public TypedRegistry getRegistry()
Returns:
the registry the module is loaded in

setRegistry

public void setRegistry(TypedRegistry typedRegistry)
This setter is used to inject the registry reference.

Parameters:
typedRegistry - the registry

getAutowiring

protected org.apache.hivemind.service.Autowiring getAutowiring()
Returns:
a reference to the Autowiring service.

autowireProperties

protected <T> T autowireProperties(T target)
Autowires any object by use of the Autowiring service.

Parameters:
target - the object to wire
Returns:
the wired object

service

protected <T> T service(java.lang.String serviceId,
                        java.lang.Class<T> serviceInterface)
Returns a service from the registry.

See Also:
Registry.getService(String, Class)

service

protected <T> T service(java.lang.Class<T> serviceInterface)
Finds a service that implements the provided interface. Exactly one such service may exist or an exception is thrown.

See Also:
Registry.getService(Class)

configuration

protected <T> T configuration(java.lang.String configurationId,
                              java.lang.Class<T> configurationType)
Returns the specified configuration from the registry.

See Also:
Registry.getConfiguration(String)

configuration

protected <T> T configuration(java.lang.Class<T> configurationType)
Finds a configuration by its type. Exactly one such configuration may exist or an exception is thrown.

See Also:
Registry.getConfiguration(String)


Copyright © 2006-2007 Apache Software Foundation. All Rights Reserved.