本文整理匯總了Java中org.apache.commons.digester.Digester.setClassLoader方法的典型用法代碼示例。如果您正苦於以下問題:Java Digester.setClassLoader方法的具體用法?Java Digester.setClassLoader怎麽用?Java Digester.setClassLoader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.digester.Digester
的用法示例。
在下文中一共展示了Digester.setClassLoader方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDigester
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
* Creates a new digester.
*
* @return the new digester.
* @throws ParserConfigurationException
* if digester is not configured properly
*/
private Digester createDigester() throws ParserConfigurationException {
Digester digester = new Digester();
digester.setValidating(false);
digester.setClassLoader(CheckStyleRules.class.getClassLoader());
String section = "*/section";
digester.addObjectCreate(section, Rule.class);
digester.addSetProperties(section);
digester.addSetNext(section, "add");
String subSection = "*/section/subsection";
digester.addObjectCreate(subSection, Topic.class);
digester.addSetProperties(subSection);
digester.addSetNext(subSection, "setDescription");
digester.addRule(subSection, new TopicRule());
return digester;
}
示例2: TestConfigFactory
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
* Creates a factory instance.
*/
public TestConfigFactory() {
digester = new Digester();
digester.setClassLoader(Thread.currentThread().getContextClassLoader());
digester.addObjectCreate("testportlet-config", ArrayList.class);
digester.addObjectCreate("testportlet-config/testsuite-config",
TestConfig.class);
digester.addBeanPropertySetter("testportlet-config/testsuite-config/name",
"name");
digester.addBeanPropertySetter("testportlet-config/testsuite-config/class",
"testClassName");
digester.addBeanPropertySetter("testportlet-config/testsuite-config/display-uri",
"displayURI");
digester.addCallMethod("testportlet-config/testsuite-config/init-param", "addInitParameter", 2);
digester.addCallParam("testportlet-config/testsuite-config/init-param/name", 0);
digester.addCallParam("testportlet-config/testsuite-config/init-param/value", 1);
digester.addCallMethod("testportlet-config/testsuite-config/action-param", "addActionParameter", 2);
digester.addCallParam("testportlet-config/testsuite-config/action-param/name", 0);
digester.addCallParam("testportlet-config/testsuite-config/action-param/value", 1);
digester.addCallMethod("testportlet-config/testsuite-config/render-param", "addRenderParameter", 2);
digester.addCallParam("testportlet-config/testsuite-config/render-param/name", 0);
digester.addCallParam("testportlet-config/testsuite-config/render-param/value", 1);
digester.addSetRoot("testportlet-config/testsuite-config", "add");
}
示例3: ResourceConfigReader
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
private ResourceConfigReader() {
digester = new Digester();
// digester.setLogger(LOG); // Too many log messages.
digester.setClassLoader(Thread.currentThread().getContextClassLoader());
init();
}
示例4: setupDigester
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
private Digester setupDigester() {
Digester d = new Digester();
d.setClassLoader(getClass().getClassLoader());
// d.setUseContextClassLoader(true);
d.push(this);
/*
* <measurableProperties> <property>
* <propertyId>object://image/dimension/width</propertyId> <name>image
* width</name> <description>the width of an image in
* pixel</description> <scale type="positiveInteger"> <unit>pixel</unit>
* </scale> <possibleMetrics> <metric metricId="equal"/> <metric
* metricId="indDiff"/> </possibleMetrics> </property>
*/
d.addObjectCreate("*/property", MeasurableProperty.class);
d.addSetNext("*/property", "addProperty");
d.addBeanPropertySetter("*/property/category", "categoryAsString");
d.addBeanPropertySetter("*/property/propertyId");
d.addBeanPropertySetter("*/property/name");
d.addBeanPropertySetter("*/property/description");
d.addObjectCreate("*/property/possibleMetrics", ArrayList.class);
d.addSetNext("*/property/possibleMetrics", "setPossibleMetrics");
// d.addObjectCreate("*/property/possibleMetrics/metric", Metric.class);
d.addObjectCreate("*/possibleMetrics/metric", Metric.class);
d.addSetProperties("*/possibleMetrics/metric");
d.addSetNext("*/possibleMetrics/metric", "add");
/*
* <metric> <name>equal</name> <description></description> <scale
* type="boolean" /> </metric>
*/
d.addObjectCreate("*/metrics/metric", Metric.class);
d.addSetProperties("*/metrics/metric");
d.addBeanPropertySetter("*/metrics/metric/metricId");
d.addBeanPropertySetter("*/metrics/metric/name");
d.addBeanPropertySetter("*/metrics/metric/description");
d.addSetNext("*/metrics/metric", "addMetric");
addCreateScale(d, BooleanScale.class);
addCreateScale(d, FloatRangeScale.class);
addCreateScale(d, FloatScale.class);
addCreateScale(d, IntegerScale.class);
addCreateScale(d, IntRangeScale.class);
addCreateScale(d, OrdinalScale.class);
addCreateScale(d, PositiveFloatScale.class);
addCreateScale(d, PositiveIntegerScale.class);
addCreateScale(d, YanScale.class);
addCreateScale(d, FreeStringScale.class);
return d;
}