當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。