Package javax.webbeans

Examples of javax.webbeans.ComponentFactory


      key = pair.getKey();
    }

    if (key instanceof Class) {
      Class clazz = (Class) key;
      ComponentFactory component = null;

      if (log.isLoggable(Level.FINE))
        log.fine("Creating new instance from " + clazz);

      synchronized (_componentMap) {
        component = _componentMap.get(clazz);

        if (component == null) {
          component = _webBeans.resolveByType(clazz);

          if (component == null)
            component = _webBeans.createTransient(clazz);

          _componentMap.put(clazz, component);
        }
      }

      return component.get();
    }
    else if (key instanceof String) {
      ComponentFactory component = _webBeans.findByName((String) key);

      if (component == null) {
        throw new ObjectNotFoundException(L.l("Cannot find component with name '{0}'", key));
      }

      return component.get();
    }
    else {
      throw new ObjectNotFoundException(L.l("Component keys of type {0} are not understood", key.getClass().getName()));
    }
  }
View Full Code Here

TOP

Related Classes of javax.webbeans.ComponentFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.