[jboss-user] [JBoss Seam] - Re: Progress

gavin.king@jboss.com do-not-reply at jboss.com
Mon Jul 17 15:10:16 EDT 2006


I don't believe you have the latest changes:

   private static Object handleFactoryMethodResult(String name, Component component, Object result, ScopeType scope)
  |    {
  |       Object value = Contexts.lookupInStatefulContexts(name); //see if a value was outjected by the factory method
  |       if (value==null) //usually a factory method returning a value
  |       {
  |          if (scope==ScopeType.UNSPECIFIED)
  |          {
  |             if (component==null)
  |             {
  |                throw new IllegalArgumentException("no scope specified for factory method defined in components.xml: " + name);
  |             }
  |             else //an @Factory method defaults to the same scope as the component
  |             {
  |                scope = component.getScope();
  |             }
  |          }
  |          scope.getContext().set(name, result);
  |       }
  |       else //usually a factory method with a void return type
  |       {
  |          if (scope!=ScopeType.UNSPECIFIED)
  |          {
  |             throw new IllegalArgumentException("factory method with defined scope outjected a value: " + name);
  |          }
  |       }
  |       return result;
  |    }

Use your debugger to step through this code if you really have it.

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

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



More information about the jboss-user mailing list