private static Object handleFactoryMethodResult(String name, Component component, Object result, ScopeType scope) { // see if a value was outjected by the factory method Object value = Contexts.lookupInStatefulContexts(name); if (value == null) { // usually a factory method returning a value ScopeType outScope = getOutScope(scope, component); if (outScope != STATELESS) { // the null check is for page scope, which doesn't handle setting a null value if (result != null) { outScope.getContext().set(name, result); } // shouldn't need to call remove since there wasn't previously a value } return result; } else { // usually a factory method with a void return type if (scope != UNSPECIFIED) { throw new IllegalArgumentException("factory method with defined scope outjected a value: " + name); } return value; } }
Init.FactoryExpression methodBinding = init.getFactoryMethodExpression(name); Init.FactoryExpression valueBinding = init.getFactoryValueExpression(name); if (methodBinding != null && getOutScope(methodBinding.getScope(), null).isContextActive()) else if (valueBinding != null && getOutScope(valueBinding.getScope(), null).isContextActive()) else if (factoryMethod != null && getOutScope(factoryMethod.getScope(), factoryMethod.getComponent()).isContextActive()) ScopeType scopeResult = getOutScope(factoryMethod.getScope(), factoryMethod.getComponent()); ScopeType scopeFactory = factoryMethod.getComponent().getScope();
getOutScope( out.scope(), this ) : component.getScope();
ScopeType scope = wrapper.getVariableScope(dataModelAnn); Object dataModel = getOutScope(scope, this).getContext().get(name); if ( dataModel!=null )
Annotation dataModelAnn = dataModelGetter.getAnnotation(); ScopeType scope = wrapper.getVariableScope(dataModelAnn); Context context = getOutScope(scope, this).getContext(); Object existingDataModel = context.get(name);