本文整理汇总了Java中org.apache.commons.digester3.binder.DigesterLoader类的典型用法代码示例。如果您正苦于以下问题:Java DigesterLoader类的具体用法?Java DigesterLoader怎么用?Java DigesterLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DigesterLoader类属于org.apache.commons.digester3.binder包,在下文中一共展示了DigesterLoader类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLoadRules
import org.apache.commons.digester3.binder.DigesterLoader; //导入依赖的package包/类
/**
* JAVADOC Method Level Comments
*
* @throws Exception JAVADOC.
*/
@Test
public void testLoadRules()
throws Exception {
Resource rulesResource = new InputStreamResource(new ByteArrayInputStream(
SIMPLE_RULES.getBytes()));
DigesterRulesModule module = new DigesterRulesModule(rulesResource);
DigesterLoader loader = DigesterLoader.newLoader(module);
Digester digester = loader.newDigester();
digester.push(new Container());
Container cont = digester.parse(new StringReader(SIMPLE_DATA));
assertNotNull("Container is null", cont);
assertNotNull("startState is null", cont.getStartState());
}
示例2: parseXMLObject
import org.apache.commons.digester3.binder.DigesterLoader; //导入依赖的package包/类
public static Object parseXMLObject(final Class clazz, Resource resource) throws RuntimeException {
try {
InputSource inputSource;
Digester digester;
java.io.InputStream is = resource.getInputStream();
inputSource = new InputSource(is);
DigesterLoader loader = newLoader(new FromAnnotationsRuleModule() {
@Override
protected void configureRules() {
bindRulesFrom(clazz);
}
});
digester = loader.newDigester();
return digester.parse(inputSource);
} catch (Exception e) {
log.error(
String.format("Fail to transfer Java Object[class: {" + clazz.getSimpleName() + "}] from {" + resource + "}, reason: "),
e);
e.printStackTrace();
throw new RuntimeException((new StringBuilder()).append("Fail to parse XML Object of ").append(resource).toString(), e);
}
}
示例3: DigesterModuleProcessDefinitionParser
import org.apache.commons.digester3.binder.DigesterLoader; //导入依赖的package包/类
/**
* Creates a new DigesterModuleWorkflowDefinitionParser object.
*
* @param rulesResource Resource containing parsing rules definition.
*/
public DigesterModuleProcessDefinitionParser(Resource rulesResource) {
Assert.notNull(rulesResource, "ruleResource is null");
loader = DigesterLoader.newLoader(new DigesterRulesModule(rulesResource));
Assert.notNull(loader, "Failed to create loader for the resource:" + rulesResource);
}
示例4: initializeDigesterLoader
import org.apache.commons.digester3.binder.DigesterLoader; //导入依赖的package包/类
/**
* initialize digester loader
*/
public void initializeDigesterLoader() {
this.loader = DigesterLoader.newLoader(createRulesModule());
}