Type converters and the Blueprint Container

During injection, the Blueprint Container converts the XML value elements into value objects that are injected into the manager components. The elements are converted based on the type of the injected property.

The Blueprint Container provides the following built-in conversions:

The Blueprint Container also supports generics. If the generics information is available, the Blueprint Container uses that information for the conversions. For example, in the following Blueprint XML example code, the list element is converted into a list of java.util.Long objects.

public class AccountManager {      
   ...
      public void setAccountNumbers(List<Long> accounts) {
         ...
      }
}
<bean id=”accountManagerFour” class=“org.apache.aries.AccountManager”>
   <property name=”accountNumbers”>
      <list>
         <value>123</value>
         <value>456</value>
         <value>789</value>
      </list>
   </property>
</bean>

A Blueprint bundle can also provide its own converters. The custom converters are bean managers that provide an object that implements the Blueprint Converter interface. Specify the custom converters in the type-converters element under the Blueprint element. When the Blueprint Container is initialized, the type converters are initialized first, so that other managers can use the custom converters. For further details, see the Blueprint Container specification.


Concept topic

Terms of use | Feedback


Timestamp icon Last updated: Tuesday, 20 September 2011
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-base-dist&topic=ca_blueprint_type

Copyright IBM Corporation 2009, 2011. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)