Classes used to construct BeanMetaData programatically as shown below:

   Kernel kernel = ...//Get from bootstrap
   BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("SomeBean", SimpleBean.class.getName());
   builder.addAlias("BeanA");
   kernel.getController().install(builder.getBeanMetaData());
   
   builder = BeanMetaDataBuilderFactory.createBuilder("OtherBean", OtherBean.class.getName());
   ValueMetaData vmd = builder.createInject("BeanA");
   builder.addPropertyMetaData("someBean", vmd);
   kernel.getController().install(builder.getBeanMetaData());
    

This example obtains a reference to the Kernel from the bootstrap. It then creates the metadata for a bean, giving it the name SomeBean and the class SimpleBean, and adds an alias BeanA. The bean metadata is then installed into the kernel's controller.

Next a bean called OtherBean with the class OtherBean is created. The metadata is then set up to inject the bean BeanA (which is SomeBean's alias) into the someBean property of OtherBean.

Package Specification

Related Documentation