📄 jsfbeandefinitionparserutils.java
字号:
/* * Copyright 2002-2004 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package de.mindmatters.faces.spring.factory.xml;import org.springframework.beans.factory.support.AbstractBeanDefinition;import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate;import org.springframework.beans.factory.xml.ParserContext;import org.w3c.dom.Element;/** * Miscellaneous parser utility methods for the '<code>jsh</code>' * namespace. Mainly for internal use within the framework. * * @author Andreas Kuhrwahl * */public final class JsfBeanDefinitionParserUtils { /** * The '<code>order</code>' attribute of an * {@link de.mindmatters.faces.spring.factory.OrderedRootBeanDefinition}. */ public static final String ORDER_ATTRIBUTE = "order"; /** * The '<code>id</code>' attribute of a * {@link org.springframework.beans.factory.config.BeanDefinition}. */ public static final String ID_ATTRIBUTE = BeanDefinitionParserDelegate.ID_ATTRIBUTE; /** * The '<code>component-family</code>' attribute of a * {@link javax.faces.render.Renderer} definition. */ public static final String COMPONENT_FAMILY_ATTRIBUTE = "component-family"; /** * The '<code>type</code>' attribute of a * {@link javax.faces.render.Renderer} definition. */ public static final String RENDERER_TYPE_ATTRIBUTE = "type"; /** * The '<code>lifecycle-id</code>' attribute of a * {@link javax.faces.event.PhaseListener} definition. */ public static final String LIFECYCLE_ID_ATTRIBUTE = "lifecycle-id"; /** * It's a static class. */ private JsfBeanDefinitionParserUtils() { super(); } /** * Determine the class of the wrapped bean of the given * {@link AbstractBeanDefinition} <code>bd</code>, if the bean definition * has a bean class. * * @param element * the {@link Element} representing the bean definition * @param bd * the bean definition * @param parserContext * the {@link ParserContext} * @return the resolved bean class or <code>null</code> if the bean * defintion has no bean class. */ public static Class resolveBeanClass(final Element element, final AbstractBeanDefinition bd, final ParserContext parserContext) { Class resolvedClass = null; if (!bd.hasBeanClass()) { try { resolvedClass = bd.resolveBeanClass(parserContext .getReaderContext().getReader().getBeanClassLoader()); } catch (ClassNotFoundException ex) { parserContext.getReaderContext().error( "Bean class [" + bd.getBeanClassName() + "] not found", parserContext.extractSource(element), null, ex); } catch (NoClassDefFoundError err) { parserContext.getReaderContext().error( "Class that bean class [" + bd.getBeanClassName() + "] depends on not found", parserContext.extractSource(element), null, err); } catch (Throwable ex) { parserContext.getReaderContext().error( "Unexpected failure during bean definition parsing", parserContext.extractSource(element), null, ex); } } return resolvedClass; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -