All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gate.util.spring.xml.UrlBeanDefinitionParser Maven / Gradle / Ivy

There is a newer version: 9.0.1
Show newest version
package gate.util.spring.xml;

import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.util.xml.DomUtils;
import org.w3c.dom.Element;

/**
 * Bean definition parser for
 * <gate:url>path</gate:url>, producing the
 * equivalent of
 * 
 * 
 * <bean class="gate.util.spring.SpringFactory"
 *          factory-method="resourceToUrl">
 *   <constructor-arg value="path" />
 * </bean>
 * 
* * The <gate:url> element can take an id * attribute, but in most cases it will be used inline (e.g. as the value * of a property or as an entry in a feature map). */ public class UrlBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { @Override protected void doParse(Element element, BeanDefinitionBuilder builder) { builder.setFactoryMethod("resourceToUrl"); builder.addConstructorArgValue(DomUtils.getTextValue(element)); } @Override protected String getBeanClassName(Element element) { return "gate.util.spring.SpringFactory"; } @Override protected boolean shouldGenerateIdAsFallback() { return true; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy