org.apache.felix.ipojo
Interface ConstructorInjector

All Known Implementing Classes:
ArchitectureHandler, ConfigurationHandler, ControllerHandler, Dependency, DependencyHandler, EventAdminPublisherHandler, EventAdminSubscriberHandler, ExtenderModelHandler, LifecycleCallbackHandler, MBeanHandler, PrimitiveHandler, Property, ProvidedServiceHandler, TemporalHandler, TransactionHandler, WhiteBoardPatternHandler

public interface ConstructorInjector

Interface implemented to support constructor parameter injection. When a new POJO object has to be created, all constructor injectors are called to gets the objects to injects as well as the type (to discover the constructor). Handlers willing to inject constructor parameters must register themselves using InstanceManager.register(int, ConstructorInjector) where the integer is the parameter index. Only one injector can inject a value for a specific index. If several injectors are registered for the same index, the component type is declared as invalid.

Author:
Felix Project Team

Method Summary
 Object getConstructorParameter(int index)
          Gets the type of the object to inject in the constructor parameter.
 Class getConstructorParameterType(int index)
          Gets the type of the object to
 

Method Detail

getConstructorParameter

Object getConstructorParameter(int index)
Gets the type of the object to inject in the constructor parameter. This is the type looked into the Pojo class, so it must match. Returning null will try to get the class from the injected object, however this can be wrong (implementation instead of interface, boxed objects...) and error-prone.

Parameters:
index - the parameter index
Returns:
the Class object (must fit for primitive type)

getConstructorParameterType

Class getConstructorParameterType(int index)
Gets the type of the object to

Parameters:
index -
Returns:


Copyright © 2011 Apache Software Foundation. All Rights Reserved.