[jboss-user] [Microcontainer] - Programatically create a Inject fromContext

jaikiran do-not-reply at jboss.com
Wed Mar 18 06:59:33 EDT 2009


What is the API to create an @Inject which is equivalent to this:

public class MyBean
  | {
  |   @Inject (dependentState="DESCRIBED", fromContext = FromContext.CONTEXT)
  |   KernelControllerContext context;
  | ...
  | }

I was able to get a minimal @Inject working using this API:

public class MyBean 
  | {
  |  @Inject (dependentState = "DESCRIBED")
  |  OtherBean otherBean;
  | 
  | }
  | 
  | 

BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(someName, someClass.getClass().getName());
  | builder.setConstructorValue(someObj);
  | // Create @Inject
  | ValueMetaData inject = builder.createInject(weDependOnThisMCBeanName, null, null, ControllerState.DESCRIBED);
  | // add this @Inject to our MC bean
  | builder.addPropertyMetaData("otherBean", inject);
  | 

I couldn't find any API where i can pass more information for creating the @Inject "fromContext".


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4219009#4219009

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4219009



More information about the jboss-user mailing list