@Override public void end(String namespace, String name) throws Exception { digester.pop(); } }
/** * <p>Register a new Rule matching the specified pattern. * This method sets the <code>Digester</code> property on the rule.</p> * * @param pattern Element matching pattern * @param rule Rule to be registered */ public void addRule(String pattern, Rule rule) { rule.setDigester(this); getRules().add(pattern, rule); }
/** * Adds an {@link SetNestedPropertiesRule}. * * @param pattern register the rule with this pattern * @param elementNames elment names that (in order) map to properties * @param propertyNames property names that (in order) elements are mapped to * * @since 1.6 */ public void addSetNestedProperties(String pattern, String[] elementNames, String[] propertyNames) { addRule(pattern, new SetNestedPropertiesRule(elementNames, propertyNames)); }
@Override public void begin(String namespace, String name, Attributes attributes) throws Exception { Object instance = clazz.newInstance(); digester.push(instance); }
/** * Add an "object create" rule for the specified parameters. * * @param pattern Element matching pattern * @param className Java class name to be created * @see ObjectCreateRule */ public void addObjectCreate(String pattern, String className) { addRule(pattern, new ObjectCreateRule(className)); }
/** * Add a "bean property setter" rule for the specified parameters. * * @param pattern Element matching pattern * @see BeanPropertySetterRule */ public void addBeanPropertySetter(String pattern) { addRule(pattern, new BeanPropertySetterRule()); }
/** * Add an "call method" rule for a method which accepts no arguments. * * @param pattern Element matching pattern * @param methodName Method name to be called * @see CallMethodRule */ public void addCallMethod(String pattern, String methodName) { addRule( pattern, new CallMethodRule(methodName)); }
/** * Add a "set next" rule for the specified parameters. * * @param pattern Element matching pattern * @param methodName Method name to call on the parent element * @see SetNextRule */ public void addSetNext(String pattern, String methodName) { addRule(pattern, new SetNextRule(methodName)); }
/** * Add a "call parameter" rule for the specified parameters. * * @param pattern Element matching pattern * @param paramIndex Zero-relative parameter index to set * (from the body of this element) * @see CallParamRule */ public void addCallParam(String pattern, int paramIndex) { addRule(pattern, new CallParamRule(paramIndex)); }
/** * Add a "set property" rule for the specified parameters. * * @param pattern Element matching pattern * @param name Attribute name containing the property name to be set * @param value Attribute name containing the property value to set * @see SetPropertyRule */ public void addSetProperty(String pattern, String name, String value) { addRule(pattern, new SetPropertyRule(name, value)); }
/** * Add {@link SetRootRule} with the specified parameters. * * @param pattern Element matching pattern * @param methodName Method name to call on the root object * @see SetRootRule */ public void addSetRoot(String pattern, String methodName) { addRule(pattern, new SetRootRule(methodName)); }
/** * Add a "set top" rule for the specified parameters. * * @param pattern Element matching pattern * @param methodName Method name to call on the parent element * @see SetTopRule */ public void addSetTop(String pattern, String methodName) { addRule(pattern, new SetTopRule(methodName)); }
/** Invoked when rule is added to digester. */ @Override public void setDigester(Digester digester) { super.setDigester(digester); log = digester.getLogger(); }
/** * This is only invoked after all child elements have been processed, * so we can remove the custom Rules object that does the * child-element-matching. */ @Override public void body(String bodyText) throws Exception { AnyChildRules newRules = (AnyChildRules) digester.getRules(); digester.setRules(newRules.getOldRules()); }
/** Sets digeseter using these Rules */ public void setDigester(Digester digester) { wrappedRules.setDigester(digester); for (Rule rule : defaultRules) { rule.setDigester(digester); } }
/** * Set the namespace URI that will be applied to all subsequently * added <code>Rule</code> objects. * * @param ruleNamespaceURI Namespace URI that must match on all * subsequently added rules, or <code>null</code> for matching * regardless of the current namespace URI */ public void setRuleNamespaceURI(String ruleNamespaceURI) { getRules().setNamespaceURI(ruleNamespaceURI); }
/** * Return the <code>Rules</code> implementation object containing our * rules collection and associated matching policy. If none has been * established, a default implementation will be created and returned. */ public Rules getRules() { if (this.rules == null) { this.rules = new RulesBase(); this.rules.setDigester(this); } return (this.rules); }
/** * Adds an {@link SetNestedPropertiesRule}. * * @param pattern register the rule with this pattern * * @since 1.6 */ public void addSetNestedProperties(String pattern) { addRule(pattern, new SetNestedPropertiesRule()); }
/** * Add an "object create" rule for the specified parameters. * * @param pattern Element matching pattern * @param clazz Java class to be created * @see ObjectCreateRule */ public void addObjectCreate(String pattern, Class<?> clazz) { addRule(pattern, new ObjectCreateRule(clazz)); }
/** * Add a "bean property setter" rule for the specified parameters. * * @param pattern Element matching pattern * @param propertyName Name of property to set * @see BeanPropertySetterRule */ public void addBeanPropertySetter(String pattern, String propertyName) { addRule(pattern, new BeanPropertySetterRule(propertyName)); }