本文整理匯總了Java中org.apache.commons.digester.Digester.addSetProperties方法的典型用法代碼示例。如果您正苦於以下問題:Java Digester.addSetProperties方法的具體用法?Java Digester.addSetProperties怎麽用?Java Digester.addSetProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.digester.Digester
的用法示例。
在下文中一共展示了Digester.addSetProperties方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createStopDigester
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
* Create and configure the Digester we will be using for shutdown.
*/
protected Digester createStopDigester() {
// Initialize the digester
Digester digester = new Digester();
if (debug)
digester.setDebug(999);
// Configure the rules we need for shutting down
digester.addObjectCreate("Server",
"org.apache.catalina.core.StandardServer",
"className");
digester.addSetProperties("Server");
digester.addSetNext("Server",
"setServer",
"org.apache.catalina.Server");
return (digester);
}
示例2: addTextInputComponentRules
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
public static void addTextInputComponentRules(Digester digester)
{
String componentNamespace = digester.getRuleNamespaceURI();
String textInputComponentPattern = "*/componentElement/textInput";
// digester.addObjectCreate(textInputComponentPattern, TextInputComponent.class.getName());
digester.addFactoryCreate(textInputComponentPattern, TextInputComponentFactory.class.getName());
digester.addSetProperties(textInputComponentPattern);
// digester.addSetProperties(textInputComponentPattern,
// //properties to be ignored by this rule
// new String[]{JRXmlConstants.ATTRIBUTE_evaluationTime, StandardBarbecueComponent.PROPERTY_ROTATION},
// new String[0]);
digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE);
digester.addFactoryCreate(textInputComponentPattern + "/textField", TextInputTextFieldFactory.class.getName());
digester.setRuleNamespaceURI(componentNamespace);
}
示例3: 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);
}
示例4: 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");
}
示例5: 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());
}
示例6: getWebworkPackages
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
* Parse file to webwork configuration
*
* @param webworkConfigurationFile Webwork configuration file
* @return Webwork configuration package list
* @throws IOException IOException
* @throws SAXException SAXException
*/
@SuppressWarnings("unchecked")
public List<WebworkPackage> getWebworkPackages(File webworkConfigurationFile) throws IOException, SAXException {
final Digester digester = new Digester();
digester.addObjectCreate("xwork", ArrayList.class);
digester.addObjectCreate("xwork/package", WebworkPackage.class);
digester.addSetProperties("xwork/package", "name", "name");
digester.addSetProperties("xwork/package", "namespace", "namespace");
digester.addObjectCreate("xwork/package/action", WebworkAction.class);
digester.addSetProperties("xwork/package/action", "name", "name");
digester.addSetProperties("xwork/package/action", "class", "className");
digester.addSetNext("xwork/package/action", "addAction");
digester.addSetNext("xwork/package", "add");
return (List<WebworkPackage>)digester.parse(webworkConfigurationFile);
}
示例7: 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);
}
}
}
示例8: 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);
}
}
示例9: configurePrefsDigester
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
public static Digester configurePrefsDigester(Digester digester) {
// prefs root
digester.addObjectCreate("prefs", PrefsData.class );
digester.addSetProperties("prefs" );
digester.addBeanPropertySetter("prefs/listToolEventsOnlyAvailableInSite", "setListToolEventsOnlyAvailableInSite" );
digester.addBeanPropertySetter("prefs/chartIn3D", "setChartIn3D" );
digester.addBeanPropertySetter("prefs/chartTransparency", "setChartTransparency" );
digester.addBeanPropertySetter("prefs/itemLabelsVisible", "setItemLabelsVisible" );
digester.addBeanPropertySetter("prefs/useAllTools", "setUseAllTools" );
// toolEventsDef
digester = configureToolEventsDefDigester("prefs/", digester);
digester.addSetNext("prefs/toolEventsDef", "setToolEventsDef" );
return digester;
}
示例10: createDigester
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
private static Digester createDigester() {
Digester d = new Digester();
d.setValidating(false);
d.addObjectCreate("hyracks-cluster", HyracksCluster.class);
d.addSetProperties("hyracks-cluster");
d.addObjectCreate("hyracks-cluster/cluster-controller", ClusterController.class);
d.addSetProperties("hyracks-cluster/cluster-controller");
d.addSetNext("hyracks-cluster/cluster-controller", "setClusterController");
d.addObjectCreate("hyracks-cluster/node-controllers/node-controller", NodeController.class);
d.addSetProperties("hyracks-cluster/node-controllers/node-controller");
d.addSetNext("hyracks-cluster/node-controllers/node-controller", "addNodeController");
d.addObjectCreate("*/container-specification", ContainerSpecification.class);
d.addSetProperties("*/container-specification");
d.addSetNext("*/container-specification", "setContainerSpecification");
return d;
}
示例11: 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();
}
}
示例12: 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;
}
示例13: 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");
}
示例14: initDigesterForComponentsDefinitionsSyntax
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
* Init digester for components syntax.
* This is an old set of rules, left for backward compatibility.
* @param digester Digester instance to use.
*/
private void initDigesterForComponentsDefinitionsSyntax( Digester digester )
{
// Common constants
String PACKAGE_NAME = "org.apache.struts.tiles.xmlDefinition";
String DEFINITION_TAG = "component-definitions/definition";
String definitionHandlerClass = PACKAGE_NAME + ".XmlDefinition";
String PUT_TAG = DEFINITION_TAG + "/put";
String putAttributeHandlerClass = PACKAGE_NAME + ".XmlAttribute";
String LIST_TAG = DEFINITION_TAG + "/putList";
String listHandlerClass = PACKAGE_NAME + ".XmlListAttribute";
String ADD_LIST_ELE_TAG = LIST_TAG + "/add";
// syntax rules
digester.addObjectCreate( DEFINITION_TAG, definitionHandlerClass );
digester.addSetProperties( DEFINITION_TAG);
digester.addSetNext( DEFINITION_TAG, "putDefinition", definitionHandlerClass);
// put / putAttribute rules
digester.addObjectCreate( PUT_TAG, putAttributeHandlerClass);
digester.addSetNext( PUT_TAG, "addAttribute", putAttributeHandlerClass);
digester.addSetProperties( PUT_TAG);
digester.addCallMethod( PUT_TAG, "setBody", 0);
// list rules
digester.addObjectCreate( LIST_TAG, listHandlerClass);
digester.addSetProperties( LIST_TAG);
digester.addSetNext( LIST_TAG, "addAttribute", putAttributeHandlerClass);
// list elements rules
// We use Attribute class to avoid rewriting a new class.
// Name part can't be used in listElement attribute.
digester.addObjectCreate( ADD_LIST_ELE_TAG, putAttributeHandlerClass);
digester.addSetNext( ADD_LIST_ELE_TAG, "add", putAttributeHandlerClass);
digester.addSetProperties( ADD_LIST_ELE_TAG);
digester.addCallMethod( ADD_LIST_ELE_TAG, "setBody", 0);
}
示例15: initDigesterForInstancesSyntax
import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
* Init digester in order to parse instances definition file syntax.
* Instances is an old name for "definition". This method is left for
* backwards compatibility.
* @param digester Digester instance to use.
*/
private void initDigesterForInstancesSyntax( Digester digester )
{
// Build a digester to process our configuration resource
String PACKAGE_NAME = "org.apache.struts.tiles.xmlDefinition";
String INSTANCE_TAG = "component-instances/instance";
String instanceHandlerClass = PACKAGE_NAME + ".XmlDefinition";
String PUT_TAG = INSTANCE_TAG + "/put";
String PUTATTRIBUTE_TAG = INSTANCE_TAG + "/putAttribute";
String putAttributeHandlerClass = PACKAGE_NAME + ".XmlAttribute";
String LIST_TAG = INSTANCE_TAG + "/putList";
String listHandlerClass = PACKAGE_NAME + ".XmlListAttribute";
String ADD_LIST_ELE_TAG = LIST_TAG + "/add";
// component instance rules
digester.addObjectCreate( INSTANCE_TAG, instanceHandlerClass );
digester.addSetProperties( INSTANCE_TAG);
digester.addSetNext( INSTANCE_TAG, "putDefinition", instanceHandlerClass);
// put / putAttribute rules
digester.addObjectCreate( PUTATTRIBUTE_TAG, putAttributeHandlerClass);
digester.addSetProperties( PUTATTRIBUTE_TAG);
digester.addSetNext( PUTATTRIBUTE_TAG, "addAttribute", putAttributeHandlerClass);
// put / putAttribute rules
digester.addObjectCreate( PUT_TAG, putAttributeHandlerClass);
digester.addSetProperties( PUT_TAG);
digester.addSetNext( PUT_TAG, "addAttribute", putAttributeHandlerClass);
// list rules
digester.addObjectCreate( LIST_TAG, listHandlerClass);
digester.addSetProperties( LIST_TAG);
digester.addSetNext( LIST_TAG, "addAttribute", putAttributeHandlerClass);
// list elements rules
// We use Attribute class to avoid rewriting a new class.
// Name part can't be used in listElement attribute.
digester.addObjectCreate( ADD_LIST_ELE_TAG, putAttributeHandlerClass);
digester.addSetProperties( ADD_LIST_ELE_TAG);
digester.addSetNext( ADD_LIST_ELE_TAG, "add", putAttributeHandlerClass);
}