applicationimpl.java

来自「RESIN 3.2 最新源码」· Java 代码 · 共 1,774 行 · 第 1/4 页

JAVA
1,774
字号
  }  public void setNavigationHandler(NavigationHandler handler)  {    if (handler == null)      throw new NullPointerException();    _navigationHandler = handler;  }  public NavigationHandlerImpl getDefaultNavigationHandler(){    return _defaultNavigationHandler;  }  @Deprecated  public PropertyResolver getPropertyResolver()  {    if (_propertyResolver == null)      _propertyResolver = new PropertyResolverAdapter(getELResolver());    return _propertyResolver;  }  @Deprecated  public void setPropertyResolver(PropertyResolver resolver)  {    if (_legacyPropertyResolver == null ||        _legacyPropertyResolver instanceof DummyPropertyResolver) {       addELResolver(new PropertyResolverChainWrapper());    }    _legacyPropertyResolver = resolver;  }  public PropertyResolver getLegacyPropertyResolver()  {    if (_legacyPropertyResolver == null)      _legacyPropertyResolver = new DummyPropertyResolver();        return _legacyPropertyResolver;  }  @Deprecated  public VariableResolver getVariableResolver()  {    if (_variableResolver == null)      _variableResolver = new VariableResolverAdapter(getELResolver());    return _variableResolver;  }  @Deprecated  public void setVariableResolver(VariableResolver resolver)  {    if (_legacyVariableResolver == null ||        _legacyVariableResolver instanceof DummyVariableResolver) {      addELResolver(new VariableResolverChainWrapper());    }    _legacyVariableResolver = resolver;  }  public VariableResolver getLegacyVariableResolver(){    if (_legacyVariableResolver == null)      _legacyVariableResolver = new DummyVariableResolver();    return _legacyVariableResolver;  }  /**   * @Since 1.2   */  public void addELResolver(ELResolver resolver)  {    if (_isInit)      throw new IllegalStateException(L.l(	"Can't add ELResolver after Application has been initialized"));    _elResolver.addELResolver(resolver);  }  /**   * @Since 1.2   */  public void addELContextListener(ELContextListener listener)  {    _elContextListenerList.add(listener);    _elContextListeners = null;  }  /**   * @Since 1.2   */  public void removeELContextListener(ELContextListener listener)  {    _elContextListenerList.remove(listener);    _elContextListeners = null;  }  /**   * @Since 1.2   */  public ELContextListener []getELContextListeners()  {    synchronized (_elContextListenerList) {      if (_elContextListeners == null) {	_elContextListeners	  = new ELContextListener[_elContextListenerList.size()];	_elContextListenerList.toArray(_elContextListeners);      }    }    return _elContextListeners;  }  /**   * @Since 1.2   */  public ExpressionFactory getExpressionFactory()  {    return _jsfExpressionFactory;  }  @Override  public ELResolver getELResolver()  {    return _elResolver;  }  public ViewHandler getViewHandler()  {    return _viewHandler;  }  public void setViewHandler(ViewHandler handler)  {    if (handler == null)      throw new NullPointerException();    _viewHandler = handler;  }  @Override  public ResourceHandler getResourceHandler()  {    return _resourceHandler;  }  @Override  public void setResourceHandler(ResourceHandler resourceHandler)  {    _resourceHandler = resourceHandler;  }  public StateManager getStateManager()  {    return _stateManager;  }  public void setStateManager(StateManager manager)  {    _stateManager = manager;  }  public void addComponent(String componentType,			   String componentClass)  {    if (componentType == null)      throw new NullPointerException();    synchronized (_componentClassNameMap) {      _componentClassNameMap.put(componentType, componentClass);    }  }  public UIComponent createComponent(String componentType)    throws FacesException  {    if (componentType == null)      throw new NullPointerException();    Class cl = getComponentClass(componentType);    if (cl == null)      throw new FacesException(L.l(	"'{0}' is an unknown UI componentType to create",	componentType));    try {      return (UIComponent) cl.newInstance();    }    catch (RuntimeException e) {      throw e;    }    catch (Exception e) {      throw new FacesException(e);    }  }  private Class getComponentClass(String name)  {    synchronized (_componentClassMap) {      Class cl = _componentClassMap.get(name);      if (cl != null)	return cl;      String className = _componentClassNameMap.get(name);      if (className == null)	throw new FacesException(L.l("'{0}' is an unknown component type",				     name));      try {	ClassLoader loader = Thread.currentThread().getContextClassLoader();	cl = Class.forName(className, false, loader);	Config.validate(cl, UIComponent.class);	_componentClassMap.put(name, cl);	return cl;      }      catch (RuntimeException e) {	throw e;      }      catch (Exception e) {	throw new FacesException(e);      }    }  }  /**   * @Since 1.2   */  public UIComponent createComponent(ValueExpression componentExpr,				     FacesContext context,				     String componentType)    throws FacesException  {    if (componentExpr == null	|| context == null	|| componentType == null)      throw new NullPointerException();    Object value = componentExpr.getValue(context.getELContext());    if (value instanceof UIComponent)      return (UIComponent) value;    UIComponent component = createComponent(componentType);    componentExpr.setValue(context.getELContext(), component);    return component;  }  @Deprecated  public UIComponent createComponent(ValueBinding componentBinding,				     FacesContext context,				     String componentType)    throws FacesException  {    if (componentBinding == null	|| context == null	|| componentType == null)      throw new NullPointerException();    return createComponent(new ValueExpressionAdapter(componentBinding,						      UIComponent.class),			   context,			   componentType);  }  public Iterator<String> getComponentTypes()  {    return _componentClassNameMap.keySet().iterator();  }  public void addConverter(String converterId,			   String converterClass)  {    if (converterId == null)      throw new NullPointerException();    synchronized (_converterIdMap) {      _converterIdNameMap.put(converterId, converterClass);    }  }  public Converter createConverter(String converterId)    throws FacesException  {    if (converterId == null)      throw new NullPointerException();    Class cl = getConverterIdClass(converterId);    if (cl == null)      return null;    try {      return (Converter) cl.newInstance();    }    catch (RuntimeException e) {      throw e;    }    catch (Exception e) {      throw new FacesException(e);    }  }  private Class getConverterIdClass(String id)  {    synchronized (_converterIdMap) {      Class cl = _converterIdMap.get(id);      if (cl != null)	return cl;      String className = _converterIdNameMap.get(id);      if (className == null)	throw new FacesException(L.l("'{0}' is an unknown converter type",				     id));      try {	ClassLoader loader = Thread.currentThread().getContextClassLoader();	cl = Class.forName(className, false, loader);	Config.validate(cl, Converter.class);	_converterIdMap.put(id, cl);	return cl;      }      catch (RuntimeException e) {	throw e;      }      catch (Exception e) {	throw new FacesException(e);      }    }  }  public Iterator<String> getConverterIds()  {    return _converterIdNameMap.keySet().iterator();  }  public void addConverter(Class type,			   String converterClass)  {    if (type == null)      throw new NullPointerException();    synchronized (_converterClassMap) {      try {	ClassLoader loader = Thread.currentThread().getContextClassLoader();	Class cl = Class.forName(converterClass, false, loader);	Config.validate(cl, Converter.class);	_converterClassMap.put(type, cl);      }      catch (RuntimeException e) {	throw e;      }      catch (Exception e) {	throw new FacesException(e);      }    }  }  public Converter createConverter(Class type)    throws FacesException  {    if (type == null)      throw new NullPointerException();    Class cl = findConverter(type);    if (cl == null)      return null;    try {      try {	Constructor constructor = cl.getConstructor(Class.class);	return (Converter) constructor.newInstance(type);      }      catch (NoSuchMethodException ignore) {      }      return (Converter) cl.newInstance();    }    catch (RuntimeException e) {      throw e;    }    catch (Exception e) {      throw new FacesException(e);    }  }  private Class findConverter(Class type)  {    if (type == null)      return null;    Class cl;    synchronized (_converterClassMap) {      cl = _converterClassMap.get(type);    }    if (cl != null)      return cl;    Class []interfaces = type.getInterfaces();    for (int i = 0; i < interfaces.length; i++) {      cl = findConverter(interfaces[i]);      if (cl != null)	return cl;    }    return findConverter(type.getSuperclass());  }  public Iterator<Class> getConverterTypes()  {    return _converterClassMap.keySet().iterator();  }  @Deprecated  public MethodBinding createMethodBinding(String ref,					   Class []param)    throws ReferenceSyntaxException  {    ExpressionFactory factory = getExpressionFactory();

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?