org.apache.felix.ipojo.handlers.lifecycle.controller

## Class ControllerHandler

- java.lang.Object
- - org.apache.felix.ipojo.Handler
  - - org.apache.felix.ipojo.PrimitiveHandler
    - - org.apache.felix.ipojo.handlers.lifecycle.controller.ControllerHandler

All Implemented Interfaces:
  ConstructorInjector, FieldInterceptor, MethodInterceptor

    public class ControllerHandler
    extends PrimitiveHandler

Lifecycle Controller handler. This handler allow a POJO to vote for the instance state. By setting a boolean field to true or false, the handler state changed.

Author:
  Felix Project Team

### Field Summary

### Fields inherited from class org.apache.felix.ipojo.PrimitiveHandler

`HANDLER_TYPE`

### Fields inherited from class org.apache.felix.ipojo.Handler

`HANDLER_LEVEL_PROPERTY, HANDLER_NAME_PROPERTY, HANDLER_NAMESPACE_PROPERTY, HANDLER_TYPE_PROPERTY, m_instance, m_isValid`

### Constructor Summary

Constructors
Constructor and Description
`ControllerHandler()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `configure(org.apache.felix.ipojo.metadata.Element metadata, java.util.Dictionary configuration)` Configure method.
`void` `initializeComponentFactory(ComponentTypeDescription desc, org.apache.felix.ipojo.metadata.Element metadata)` Initialize the component factory.
`java.lang.Object` `onGet(java.lang.Object pojo, java.lang.String field, java.lang.Object value)` GetterCallback.
`void` `onSet(java.lang.Object pojo, java.lang.String field, java.lang.Object value)` SetterCallback.
`void` `start()` Start method.
`void` `stop()` Stop method.

### Methods inherited from class org.apache.felix.ipojo.PrimitiveHandler

`attach, getConstructorParameter, getConstructorParameterType, getFactory, getHandler, getInstanceManager, getLogger, getPojoMetadata, onCreation, onEntry, onError, onExit, onFinally, setFactory`

### Methods inherited from class org.apache.felix.ipojo.Handler

`debug, error, error, getDescription, getHandlerManager, getValidity, info, isValid, reconfigure, setValidity, stateChanged, warn, warn`

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

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

### Constructor Detail

#### ControllerHandler

    public ControllerHandler()

### Method Detail

#### configure

    public void configure(org.apache.felix.ipojo.metadata.Element metadata,
                          java.util.Dictionary configuration)
                   throws ConfigurationException

Configure method. Look for the first 'controller' element.

Specified by:
  `configure` in class `Handler`
Parameters:
  `metadata` - : metadata
  `configuration` - : configuration
Throws:
  `ConfigurationException` - : the field attribute is missing or does not exist in the class.
See Also:
  `Handler.configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)`

#### start

    public void start()

Start method. This methods initializes the controller value.

Specified by:
  `start` in class `Handler`
See Also:
  `Handler.start()`

#### stop

    public void stop()

Stop method. Nothing to do.

Specified by:
  `stop` in class `Handler`
See Also:
  `Handler.stop()`

#### onGet

    public java.lang.Object onGet(java.lang.Object pojo,
                                  java.lang.String field,
                                  java.lang.Object value)

GetterCallback.

Specified by:
  `onGet` in interface `FieldInterceptor`
Overrides:
  `onGet` in class `PrimitiveHandler`
Parameters:
  `pojo` - : the pojo object on which the field is accessed Return the stored value.
  `field` - : field name.
  `value` - : value given by the previous handler.
Returns:
  : the handler state.
See Also:
  `FieldInterceptor.onGet(Object, String, Object)`

#### onSet

    public void onSet(java.lang.Object pojo,
                      java.lang.String field,
                      java.lang.Object value)

SetterCallback.

Specified by:
  `onSet` in interface `FieldInterceptor`
Overrides:
  `onSet` in class `PrimitiveHandler`
Parameters:
  `pojo` - : the pojo object on which the field is accessed Store the new field value & invalidate / validate the handler is required.
  `field` - : field name.
  `value` - : new value.
See Also:
  `FieldInterceptor.onSet(Object, String, Object)`

#### initializeComponentFactory

    public void initializeComponentFactory(ComponentTypeDescription desc,
                                           org.apache.felix.ipojo.metadata.Element metadata)
                                    throws ConfigurationException

Initialize the component factory. The controller field is checked to avoid configure check.

Overrides:
  `initializeComponentFactory` in class `Handler`
Parameters:
  `desc` - : component description
  `metadata` - : component type metadata
Throws:
  `ConfigurationException` - : occurs if the controller field is not in the POJO class or is not a boolean.
See Also:
  `Handler.initializeComponentFactory(org.apache.felix.ipojo.architecture.ComponentTypeDescription, org.apache.felix.ipojo.metadata.Element)`