gate.util.spring.xml.UrlBeanDefinitionParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gate-spring Show documentation
Show all versions of gate-spring Show documentation
Helper classes to support the use of GATE within the Spring framework
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