本文整理汇总了Java中org.apache.commons.digester.Digester.addCallMethod方法的典型用法代码示例。如果您正苦于以下问题:Java Digester.addCallMethod方法的具体用法?Java Digester.addCallMethod怎么用?Java Digester.addCallMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.digester.Digester
的用法示例。
在下文中一共展示了Digester.addCallMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPieChartRules
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
protected void setPieChartRules(Digester digester)
{
String pieChartPattern = "*/componentElement/pieChart";
digester.addFactoryCreate(pieChartPattern, PieChartXmlFactory.class.getName());
String pieDatasetPattern = pieChartPattern + "/pieDataset";
digester.addObjectCreate(pieDatasetPattern, DesignPieDataset.class.getName());
digester.addSetNext(pieDatasetPattern, "setDataset", PieDataset.class.getName());
String keyExpressionPattern = pieDatasetPattern + "/keyExpression";
digester.addFactoryCreate(keyExpressionPattern, JRExpressionFactory.StringExpressionFactory.class.getName());
digester.addCallMethod(keyExpressionPattern, "setText", 0);
digester.addSetNext(keyExpressionPattern, "setKeyExpression", JRExpression.class.getName());
String valueExpressionPattern = pieDatasetPattern + "/valueExpression";
digester.addFactoryCreate(valueExpressionPattern, JRExpressionFactory.NumberExpressionFactory.class.getName());
digester.addCallMethod(valueExpressionPattern, "setText", 0);
digester.addSetNext(valueExpressionPattern, "setValueExpression", JRExpression.class.getName());
String titleExpressionPattern = pieChartPattern + "/titleExpression";
digester.addFactoryCreate(titleExpressionPattern, JRExpressionFactory.StringExpressionFactory.class.getName());
digester.addCallMethod(titleExpressionPattern, "setText", 0);
digester.addSetNext(titleExpressionPattern, "setTitleExpression", JRExpression.class.getName());
}
示例2: addBarcodeRules
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
protected <T> void addBarcodeRules(Digester digester,
String barcodePattern, Class<T> barcodeComponentClass,
String[] ignoredProperties)
{
digester.addObjectCreate(barcodePattern, barcodeComponentClass);
digester.addSetProperties(barcodePattern,
//properties to be ignored by this rule
ignoredProperties,
new String[0]);
//rule to set evaluation time
digester.addRule(barcodePattern,
new XmlConstantPropertyRule(
JRXmlConstants.ATTRIBUTE_evaluationTime, "evaluationTimeValue",
EvaluationTimeEnum.values()));
String codeExpressionPattern = barcodePattern + "/codeExpression";
digester.addFactoryCreate(codeExpressionPattern,
JRExpressionFactory.StringExpressionFactory.class.getName());
digester.addCallMethod(codeExpressionPattern, "setText", 0);
digester.addSetNext(codeExpressionPattern, "setCodeExpression",
JRExpression.class.getName());
}
示例3: addItemRules
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected void addItemRules(Digester digester, String itemPattern, String namespace)
{
digester.addFactoryCreate(itemPattern, ItemXmlFactory.class.getName());
digester.addSetNext(itemPattern, "addItem", Item.class.getName());
String locationItemPropertyPattern = itemPattern + "/itemProperty";
digester.addFactoryCreate(locationItemPropertyPattern, ItemPropertyXmlFactory.class.getName());
digester.addSetNext(locationItemPropertyPattern, "addItemProperty", ItemProperty.class.getName());
digester.setRuleNamespaceURI(namespace);
String locationItemPropertyValueExpressionPattern = locationItemPropertyPattern + "/" + JRXmlConstants.ELEMENT_valueExpression;
digester.addFactoryCreate(locationItemPropertyValueExpressionPattern, JRExpressionFactory.class.getName());
digester.addCallMethod(locationItemPropertyValueExpressionPattern, "setText", 0);
digester.addSetNext(locationItemPropertyValueExpressionPattern, "setValueExpression", JRExpression.class.getName());
}
示例4: addExpressionRules
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected <T> void addExpressionRules(Digester digester, String expressionPattern,
Class<T> factoryClass, String setterMethod, boolean jrNamespace)
{
String originalNamespace = digester.getRuleNamespaceURI();
if (jrNamespace)
{
digester.setRuleNamespaceURI(JRXmlWriter.JASPERREPORTS_NAMESPACE.getNamespaceURI());
}
digester.addFactoryCreate(expressionPattern, factoryClass);
digester.addCallMethod(expressionPattern, "setText", 0);
digester.addSetNext(expressionPattern, setterMethod,
JRExpression.class.getName());
if (jrNamespace)
{
digester.setRuleNamespaceURI(originalNamespace);
}
}
示例5: addRuleInstances
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
@Override
public void addRuleInstances(Digester digester) {
digester.addRule("faces-config", new FacesConfigRule());
digester.addRule(
"faces-config/managed-bean", new ManagedBeanRule());
digester.addCallMethod(
"faces-config/managed-bean/managed-bean-class",
"setManagedBeanClass", 0);
digester.addCallMethod(
"faces-config/managed-bean/managed-bean-name",
"setManagedBeanName", 0);
digester.addCallMethod(
"faces-config/managed-bean/managed-bean-scope",
"setManagedBeanScope", 0);
}
示例6: processSources
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
* <p>Read xml configuration for source directories into SourceDirectory instances.</p>
* <p/>
* <p>package scope so that it could be individually tested</p>
*
* @param xml String xml to parse
* @throws IOException when an input/output error occurs
* @throws SAXException when given xml can not be parsed
*/
void processSources(final String xml)
throws IOException, SAXException {
final Digester digester = getDigester();
digester.addObjectCreate(XmlConfiguration.sources, ArrayList.class);
digester.addObjectCreate(XmlConfiguration.source, SourceDirectory.class);
digester.addCallMethod(XmlConfiguration.source, "setPath", 0);
digester.addSetProperties(XmlConfiguration.source, "not-found", "notFound");
digester.addSetNext(XmlConfiguration.source, "add");
final StringReader reader = new StringReader(xml);
Object o = digester.parse(reader);
if ((o != null) && o instanceof List) {
final List<SourceDirectory> parsedSources = (ArrayList<SourceDirectory>) o;
for (final SourceDirectory sourceDirectory : parsedSources) {
getSources().add(sourceDirectory);
}
}
}
示例7: processRules
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
* <p>Process XML configuration to read rules elements into <code>Rules</code></p>
* <p/>
* <p>package scope so that it could be individually tested</p>
*
* @param xml String xml to parse
* @throws IOException when an input/output error occurs
* @throws SAXException when given xml can not be parsed
*/
void processRules(final String xml)
throws IOException, SAXException {
final Digester digester = getDigester();
digester.addObjectCreate(XmlConfiguration.rules, ArrayList.class);
digester.addObjectCreate(XmlConfiguration.rule, Rule.class);
digester.addSetProperties(XmlConfiguration.rule, "id", "idString");
digester.addCallMethod(XmlConfiguration.ruleComment, "setComment", 0);
digester.addCallMethod(XmlConfiguration.rulePackage, "addPackage", 0);
digester.addCallMethod(XmlConfiguration.ruleViolation, "addViolation", 0);
digester.addSetNext(XmlConfiguration.rule, "add");
final StringReader reader = new StringReader(xml);
Object o = digester.parse(reader);
if (o != null) {
final List<Rule> parsedRules = (ArrayList<Rule>) o;
getRules().addAll(parsedRules);
}
}
示例8: configureDigester
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
private static void configureDigester(Digester digester) {
digester.setValidating(false);
digester.addObjectCreate("params", ClientCertificate.class);
digester.addObjectCreate("*/param/value/struct/member/", Member.class);
digester.addCallMethod("*/param/value/struct/member/name",
"setName", 0);
digester.addCallMethod("*/param/value/struct/member/value/string",
"addValue", 0);
digester.addObjectCreate("*/param/value/struct/member/value/array",
ArrayList.class);
digester.addCallMethod(
"*/param/value/struct/member/value/array/data/value/string",
"add", 0);
digester.addSetNext("*/param/value/struct/member/value/array",
"setValues");
digester.addSetNext("*/param/value/struct/member", "addMember");
}
示例9: main
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public static void main(String[] args) {
String path = System.getProperty("user.dir") + File.separator + "etc";
File file = new File(path, "employee1.xml");
Digester digester = new Digester();
// add rules
digester.addObjectCreate("employee", "ex15.pyrmont.digestertest.Employee");
digester.addSetProperties("employee");
digester.addCallMethod("employee", "printName");
try {
Employee employee = (Employee) digester.parse(file);
System.out.println("First name : " + employee.getFirstName());
System.out.println("Last name : " + employee.getLastName());
}
catch(Exception e) {
e.printStackTrace();
}
}
示例10: parseXML
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public static GoPluginDescriptor parseXML(InputStream pluginXML, String pluginJarFileLocation, File pluginBundleLocation, boolean isBundledPlugin) throws IOException, SAXException {
Digester digester = initDigester();
GoPluginDescriptorParser parserForThisXML = new GoPluginDescriptorParser(pluginJarFileLocation, pluginBundleLocation, isBundledPlugin);
digester.push(parserForThisXML);
digester.addCallMethod("go-plugin", "createPlugin", 2);
digester.addCallParam("go-plugin", 0, "id");
digester.addCallParam("go-plugin", 1, "version");
digester.addCallMethod("go-plugin/about", "createAbout", 4);
digester.addCallParam("go-plugin/about/name", 0);
digester.addCallParam("go-plugin/about/version", 1);
digester.addCallParam("go-plugin/about/target-go-version", 2);
digester.addCallParam("go-plugin/about/description", 3);
digester.addCallMethod("go-plugin/about/vendor", "createVendor", 2);
digester.addCallParam("go-plugin/about/vendor/name", 0);
digester.addCallParam("go-plugin/about/vendor/url", 1);
digester.addCallMethod("go-plugin/about/target-os/value", "addTargetOS", 1);
digester.addCallParam("go-plugin/about/target-os/value", 0);
digester.parse(pluginXML);
return parserForThisXML.descriptor;
}
示例11: get
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
* Reading the checksum file (xml) from an InputSream and put it in a Map.
*
* @param in
* @return A Map with the file name as key and the checksum as value.
*/
public static Map<String, String> get(final InputStream in) {
Digester digester = new Digester();
digester.setValidating(false);
digester.addObjectCreate("checksums", HashMap.class);
digester.addCallMethod("checksums/file", "put", 2);
digester.addCallParam("checksums/file/name", 0);
digester.addCallParam("checksums/file/checksum", 1);
try {
@SuppressWarnings("unchecked")
Map<String, String> checksums = (Map<String, String>) digester.parse(in);
return checksums;
} catch (Exception e) {
throw new FatalException("Error while parsing checksums: " + e.getMessage(), e);
}
}
示例12: xml2Object
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public void xml2Object() throws SAXException
{
Digester digester = new Digester();
digester.push(this);
digester.addCallMethod("datasources/datasource", "addDataSource", 5 );
digester.addCallParam("datasources/datasource/name", 0);
digester.addCallParam("datasources/datasource/driver", 1);
digester.addCallParam("datasources/datasource/url", 2);
digester.addCallParam("datasources/datasource/username", 3);
digester.addCallParam("datasources/datasource/password", 4);
try{
//java.io.InputStream xmlFile = getClass().getResourceAsStream("xml/datasource.xml");
java.io.InputStream xmlFile
= new java.io.FileInputStream(gafetes.util.VariablesAmbiente.getArchivoDBConfiguracion());
digester.parse(xmlFile);
}catch( java.io.IOException ioex ){
System.out.println();
}
}
示例13: xmlConfiguration2Object
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public void xmlConfiguration2Object() throws SAXException
{
Digester digester = new Digester();
digester.push(this);
digester.addCallMethod("datasources/datasource", "addDataConfigurationSource", 4 );
digester.addCallParam("datasources/datasource/rutaFotos", 0);
digester.addCallParam("datasources/datasource/rutaCarpetaFotos", 1);
digester.addCallParam("datasources/datasource/rutaFotoNoExiste", 2);
digester.addCallParam("datasources/datasource/passPhrase", 3);
try{
//java.io.InputStream xmlFile = getClass().getResourceAsStream("xml/datasource.xml");
java.io.InputStream xmlFile
= new java.io.FileInputStream(gafetes.util.VariablesAmbiente.getArchivoConfiguracion());
digester.parse(xmlFile);
}catch( java.io.IOException ioex ){
System.out.println();
}
}
示例14: getFormat
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected Format getFormat() throws IOException, SAXException {
// parse the XML ...
// create a field object per field element
if (format == null) {
Digester digester = new Digester();
digester.setValidating(true);
digester.setUseContextClassLoader(true);
digester.addObjectCreate("format", "com.sapienter.jbilling.server.mediation.Format");
digester.addObjectCreate("format/field", "com.sapienter.jbilling.server.mediation.FormatField");
digester.addCallMethod("format/field/name","setName",0);
digester.addCallMethod("format/field/type","setType",0);
digester.addCallMethod("format/field/startPosition","setStartPosition",0);
digester.addCallMethod("format/field/durationFormat","setDurationFormat",0);
digester.addCallMethod("format/field/length","setLength",0);
digester.addCallMethod("format/field/isKey","isKeyTrue");
digester.addSetNext("format/field", "addField", "com.sapienter.jbilling.server.mediation.FormatField");
format = (Format) digester.parse(new File(formatFileName));
LOG.debug("using format: " + format);
}
return format;
}
示例15: DigesterXmlDocument
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public DigesterXmlDocument() {
dig = new Digester();
dig.setValidating(false);
dig.addObjectCreate("address-book", DigesterXmlDocument.class);
dig.addObjectCreate("address-book/contact", Contact.class);
dig.addSetProperties("address-book/contact", "type", "type");
dig.addCallMethod("address-book/contact/name", "setName", 0);
dig.addCallMethod("address-book/contact/address", "setAddress", 0);
dig.addCallMethod("address-book/contact/city", "setCity", 0);
dig.addCallMethod("address-book/contact/province", "setProvince", 0);
dig.addCallMethod("address-book/contact/postalcode", "setPostalcode", 0);
dig.addCallMethod("address-book/contact/country", "setCountry", 0);
dig.addCallMethod("address-book/contact/telephone", "setTelephone", 0);
dig.addSetNext("address-book/contact", "populateDocument");
}