当前位置: 首页>>代码示例>>Java>>正文


Java Digester.addRule方法代码示例

本文整理汇总了Java中org.apache.commons.digester.Digester.addRule方法的典型用法代码示例。如果您正苦于以下问题:Java Digester.addRule方法的具体用法?Java Digester.addRule怎么用?Java Digester.addRule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.digester.Digester的用法示例。


在下文中一共展示了Digester.addRule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSortComponentRules

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public static void addSortComponentRules(Digester digester)
{
	String componentNamespace = digester.getRuleNamespaceURI();
	
	String sortComponentPattern = "*/componentElement/sort";
	digester.addObjectCreate(sortComponentPattern, SortComponent.class.getName());
	
	digester.addSetProperties(sortComponentPattern, new String[] {
			SortComponent.PROPERTY_EVALUATION_TIME,
			}, 
			new String[0]);
	
	digester.addRule(sortComponentPattern, 
			new XmlConstantPropertyRule(
					SortComponent.PROPERTY_EVALUATION_TIME,
					EvaluationTimeEnum.values()));

	digester.addFactoryCreate(sortComponentPattern + "/symbol", SortComponentSymbolFactory.class.getName());
	
	digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE);

	digester.addFactoryCreate(sortComponentPattern + "/symbol/font", SortComponentSymbolFontFactory.class.getName());
	digester.addSetNext(sortComponentPattern + "/symbol/font", "setSymbolFont", JRFont.class.getName());

	digester.setRuleNamespaceURI(componentNamespace);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:27,代码来源:SortComponentDigester.java

示例2: addListRules

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected void addListRules(Digester digester)
{
	String listPattern = "*/componentElement/list";
	digester.addObjectCreate(listPattern, StandardListComponent.class);
	digester.addSetProperties(listPattern,
			//properties to be ignored by this rule
			new String[]{"printOrder"}, 
			new String[0]);
	digester.addRule(listPattern, new XmlConstantPropertyRule(
			"printOrder", "printOrderValue", PrintOrderEnum.values()));
	
	String listContentsPattern = listPattern + "/listContents";
	digester.addObjectCreate(listContentsPattern, DesignListContents.class);
	digester.addSetProperties(listContentsPattern);
	digester.addSetNext(listContentsPattern, "setContents");
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:17,代码来源:ComponentsXmlDigesterConfigurer.java

示例3: 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());
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:24,代码来源:ComponentsXmlDigesterConfigurer.java

示例4: 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);
	
}
 
开发者ID:camac,项目名称:Barista,代码行数:19,代码来源:ManagedBeanRuleSet.java

示例5: parseURL

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
private void parseURL(URL u) {
    Digester d = new Digester();
    d.setValidating(false);

    d.push(this);
    d.addObjectCreate("factory/template", HashMap.class);
    d.addRule("factory/template", new AttributeCopyRule());
    d.addSetNext("factory/template", "addFactoryTemplate");

    try {
        d.parse(u.openStream());
    }
    catch (Exception e) {
        throw new ManifestFactoryParseException("Unable to parse " +
                                                builder.getManifestFilename(), e);
    }
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:18,代码来源:ManifestFactory.java

示例6: parse

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public void parse() {
  String path = System.getProperty("user.dir") + File.separator  + "etc";
  File file = new File(path, "MyDocument-1.xml");

  Digester digester = new Digester();
  try {
    Rule rule = new MyRule();
    digester.addRule("book", rule);
    //digester.addRule("a/b", rule);
    digester.parse(file);
  }
  catch(Exception e) {
    e.printStackTrace();
  }
}
 
开发者ID:eclipsky,项目名称:HowTomcatWorks,代码行数:16,代码来源:UseDigesterExample.java

示例7: 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;
}
 
开发者ID:davidparsson,项目名称:jslint-checkstyle-plugin,代码行数:25,代码来源:CheckStyleRules.java

示例8: addNonNullPrioritizedProperty

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected void addNonNullPrioritizedProperty(Digester digester, String property, PrioritizedPropertyNameEnum name,
                                             int paramCount) {
  for (int i = 1; i <= paramCount; i++) {
    String key = property + '.' + i;
    String pattern = mappingProps.getProperty(key);
    if (pattern != null) {
      pattern = pattern.trim();
      LOG.debug("adding prioritized property [{}] with pattern [{}]", key, pattern);
      // note order of rule addition is critical
      digester.addObjectCreate(pattern, PrioritizedProperty.class);
      digester.addSetNext(pattern, "addPrioritizedProperty");
      digester.addRule(pattern, new SetLiteralRule("setPriority", i));
      digester.addRule(pattern, new SetLiteralRule("setName", name));
      digester.addCallMethod(pattern, "setProperty", 1);
      digester.addCallParam(pattern, 0);
    }
  }
}
 
开发者ID:gbif,项目名称:occurrence,代码行数:19,代码来源:AbstractRuleSet.java

示例9: addRuleInstances

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public void addRuleInstances(Digester digester) {
    final String ruleClassName = Rule.class.getName();
    digester.addFactoryCreate("*/bean-property-setter-byAttrname-rule", new BeanPropertySetterRuleFactory());
    digester.addRule("*/bean-property-setter-byAttrname-rule", new PatternRule("pattern"));
    digester.addSetNext("*/bean-property-setter-byAttrname-rule", "add", ruleClassName);

    digester.addFactoryCreate("*/object-create-rule-with-init", new ObjectCreateRuleFactoryWithInit());
    digester.addRule("*/object-create-rule-with-init", new PatternRule("pattern"));
    digester.addSetNext("*/object-create-rule-with-init", "add", ruleClassName);

    super.addRuleInstances(digester);
}
 
开发者ID:blusechen,项目名称:venus,代码行数:13,代码来源:DigesterRuleParser.java

示例10: setHtmlComponentRules

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
protected void setHtmlComponentRules(Digester digester)
{
	String htmlComponentPattern = "*/componentElement/html";
	digester.addObjectCreate(htmlComponentPattern, HtmlComponent.class.getName());
	
	digester.addSetProperties(htmlComponentPattern, new String[] {
			HtmlComponent.PROPERTY_SCALE_TYPE,
			HtmlComponent.PROPERTY_HORIZONTAL_ALIGN,
			HtmlComponent.PROPERTY_VERTICAL_ALIGN,
			HtmlComponent.PROPERTY_EVALUATION_TIME }, 
			new String[0]);
			
	digester.addRule(htmlComponentPattern, 
			new XmlConstantPropertyRule(
					HtmlComponent.PROPERTY_SCALE_TYPE,
					ScaleImageEnum.values()));
	digester.addRule(htmlComponentPattern, 
			new XmlConstantPropertyRule(
					HtmlComponent.PROPERTY_HORIZONTAL_ALIGN,
					"horizontalImageAlign",
					HorizontalImageAlignEnum.values()));
	digester.addRule(htmlComponentPattern, 
			new XmlConstantPropertyRule(
					HtmlComponent.PROPERTY_VERTICAL_ALIGN,
					"verticalImageAlign",
					VerticalImageAlignEnum.values()));
	digester.addRule(htmlComponentPattern, 
			new XmlConstantPropertyRule(
					HtmlComponent.PROPERTY_EVALUATION_TIME,
					EvaluationTimeEnum.values()));

	String htmlContentPattern = htmlComponentPattern + "/htmlContentExpression";
	digester.addFactoryCreate(htmlContentPattern, JRExpressionFactory.StringExpressionFactory.class.getName());
	digester.addCallMethod(htmlContentPattern, "setText", 0);
	digester.addSetNext(htmlContentPattern, "setHtmlContentExpression", JRExpression.class.getName());
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:38,代码来源:HtmlComponentDigester.java

示例11: addComponentRules

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected static void addComponentRules(JasperReportsContext jasperReportsContext, Digester digester)
{
	digester.addFactoryCreate("*/componentElement", JRComponentElementFactory.class.getName());
	digester.addSetNext("*/componentElement", "addElement", JRDesignElement.class.getName());
	
	Collection<ComponentsBundle> components = ComponentsEnvironment.getInstance(jasperReportsContext).getBundles();
	for (Iterator<ComponentsBundle> it = components.iterator(); it.hasNext();)
	{
		ComponentsBundle componentsBundle = it.next();
		ComponentsXmlParser xmlParser = componentsBundle.getXmlParser();
		digester.setRuleNamespaceURI(xmlParser.getNamespace());
		
		XmlDigesterConfigurer configurer = xmlParser.getDigesterConfigurer();
		if (configurer != null)
		{
			configurer.configureDigester(digester);
		}
		
		digester.setRuleNamespaceURI(xmlParser.getNamespace());
		for (Iterator<String> namesIt = componentsBundle.getComponentNames().iterator(); 
				namesIt.hasNext();)
		{
			String componentName = namesIt.next();
			digester.addRule("*/componentElement/" + componentName, 
					JRComponentRule.newInstance());
		}
	}
	
	digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:31,代码来源:JRXmlDigesterFactory.java

示例12: addPartComponentRules

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected static void addPartComponentRules(JasperReportsContext jasperReportsContext, Digester digester)
{
	digester.addFactoryCreate("*/part", JRPartFactory.class.getName());
	digester.addRule("*/part", new UuidPropertyRule("uuid", "UUID"));
	digester.addSetNext("*/part", "addPart", JRPart.class.getName());

	addExpressionRules(digester, "*/part/" + JRXmlConstants.ELEMENT_partNameExpression, "setPartNameExpression");

	Collection<PartComponentsBundle> components = PartComponentsEnvironment.getInstance(jasperReportsContext).getBundles();
	for (Iterator<PartComponentsBundle> it = components.iterator(); it.hasNext();)
	{
		PartComponentsBundle componentsBundle = it.next();
		ComponentsXmlParser xmlParser = componentsBundle.getXmlParser();
		digester.setRuleNamespaceURI(xmlParser.getNamespace());
		
		XmlDigesterConfigurer configurer = xmlParser.getDigesterConfigurer();
		if (configurer != null)
		{
			configurer.configureDigester(digester);
		}
		
		digester.setRuleNamespaceURI(xmlParser.getNamespace());
		for (Iterator<String> namesIt = componentsBundle.getComponentNames().iterator(); 
				namesIt.hasNext();)
		{
			String componentName = namesIt.next();
			digester.addRule("*/part/" + componentName, 
					JRPartComponentRule.newInstance());
		}
	}
	
	digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:34,代码来源:JRXmlDigesterFactory.java

示例13: addDatasetRules

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
private static void addDatasetRules(Digester digester)
{
	String subDatasetPattern = "jasperReport/" + JRXmlConstants.ELEMENT_subDataset;
	digester.addFactoryCreate(subDatasetPattern, JRDatasetFactory.class.getName());
	digester.addSetNext(subDatasetPattern, "addDataset", JRDesignDataset.class.getName());

	String datasetRunPattern = "*/" + JRXmlConstants.ELEMENT_datasetRun;
	digester.addFactoryCreate(datasetRunPattern, JRDatasetRunFactory.class.getName());
	digester.addSetNext(datasetRunPattern, "setDatasetRun", JRDatasetRun.class.getName());

	String datasetParamPattern = datasetRunPattern + "/" + JRXmlConstants.ELEMENT_datasetParameter;
	digester.addFactoryCreate(datasetParamPattern, JRDatasetRunParameterFactory.class.getName());
	digester.addSetNext(datasetParamPattern, "addParameter", JRDatasetParameter.class.getName());

	String datasetParamExprPattern = datasetParamPattern + "/" + JRXmlConstants.ELEMENT_datasetParameterExpression;
	digester.addFactoryCreate(datasetParamExprPattern, JRExpressionFactory.class.getName());
	digester.addSetNext(datasetParamExprPattern, "setExpression", JRExpression.class.getName());
	digester.addCallMethod(datasetParamExprPattern, "setText", 0);

	String returnValuePattern = datasetRunPattern + "/" + JRXmlConstants.ELEMENT_returnValue;
	digester.addObjectCreate(returnValuePattern, DesignReturnValue.class.getName());
	digester.addSetProperties(returnValuePattern, 
			new String[]{JRXmlConstants.ATTRIBUTE_incrementerFactoryClass, JRXmlConstants.ATTRIBUTE_calculation}, 
			new String[]{"incrementerFactoryClassName"});
	digester.addRule(returnValuePattern, new XmlConstantPropertyRule(
			JRXmlConstants.ATTRIBUTE_calculation, CalculationEnum.values()));
	digester.addSetNext(returnValuePattern, "addReturnValue");
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:29,代码来源:JRXmlDigesterFactory.java

示例14: addFrameRules

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
private static void addFrameRules(Digester digester)
{
	String framePattern = "*/" + JRXmlConstants.ELEMENT_frame;
	digester.addFactoryCreate(framePattern, JRFrameFactory.class.getName());
	digester.addSetNext(framePattern, "addElement", JRDesignElement.class.getName());
	digester.addRule(framePattern, new XmlConstantPropertyRule(JRXmlConstants.ATTRIBUTE_borderSplitType, BorderSplitType.values()));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:8,代码来源:JRXmlDigesterFactory.java

示例15: addIconLabelComponentRules

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public static void addIconLabelComponentRules(Digester digester)
{
	String componentNamespace = digester.getRuleNamespaceURI();
	
	String iconLabelComponentPattern = "*/componentElement/iconLabel";
	digester.addFactoryCreate(iconLabelComponentPattern, IconLabelComponentFactory.class.getName());

	digester.addSetProperties(iconLabelComponentPattern, new String[] {
			IconLabelComponent.PROPERTY_ICON_POSITION,
			IconLabelComponent.PROPERTY_LABEL_FILL,
			IconLabelComponent.PROPERTY_HORIZONTAL_ALIGNMENT,
			IconLabelComponent.PROPERTY_VERTICAL_ALIGNMENT }, 
			new String[0]);
	
	digester.addRule(iconLabelComponentPattern, 
			new XmlConstantPropertyRule(
					IconLabelComponent.PROPERTY_ICON_POSITION,
					IconPositionEnum.values()));
	digester.addRule(iconLabelComponentPattern, 
			new XmlConstantPropertyRule(
					IconLabelComponent.PROPERTY_LABEL_FILL,
					ContainerFillEnum.values()));
	digester.addRule(iconLabelComponentPattern, 
			new XmlConstantPropertyRule(
					IconLabelComponent.PROPERTY_HORIZONTAL_ALIGNMENT,
					"horizontalImageAlign",
					HorizontalImageAlignEnum.values()));
	digester.addRule(iconLabelComponentPattern, 
			new XmlConstantPropertyRule(
					IconLabelComponent.PROPERTY_VERTICAL_ALIGNMENT,
					"verticalImageAlign",
					VerticalImageAlignEnum.values()));
	
	digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE);

	digester.addFactoryCreate(iconLabelComponentPattern + "/label/textField", LabelTextFieldFactory.class.getName());
	digester.addFactoryCreate(iconLabelComponentPattern + "/icon/textField", IconTextFieldFactory.class.getName());

	digester.setRuleNamespaceURI(componentNamespace);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:41,代码来源:IconLabelComponentDigester.java


注:本文中的org.apache.commons.digester.Digester.addRule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。