/** * 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 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)); }
/** * 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)); }
/** * 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)); }
/** * 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 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)); }
/** * 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 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 {@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)); }
/** * Adds a rule the the target digester. After a rule has been created by * parsing the XML, it is added to the digester by calling this method. * Typically, this method is called via reflection, when executing * a SetNextRule, from the Digester that is parsing the rules XML. * @param rule a Rule to add to the target digester. */ public void add(Rule rule) { targetDigester.addRule( basePath + patternStack.toString(), rule); }
/** * 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 "call parameter" rule that sets a parameter from the current * <code>Digester</code> matching path. * This is sometimes useful when using rules that support wildcards. * * @param pattern the pattern that this rule should match * @param paramIndex The zero-relative parameter number * @see CallMethodRule */ public void addCallParamPath(String pattern,int paramIndex) { addRule(pattern, new PathCallParamRule(paramIndex)); }
/** * Adds an {@link SetNestedPropertiesRule}. * * @param pattern register the rule with this pattern * @param elementName elment name that a property maps to * @param propertyName property name of the element mapped from * * @since 1.6 */ public void addSetNestedProperties(String pattern, String elementName, String propertyName) { addRule(pattern, new SetNestedPropertiesRule(elementName, propertyName)); }
/** * Add a "set properties" rule for the specified parameters. * * @param pattern Element matching pattern * @see SetPropertiesRule */ public void addSetProperties(String pattern) { addRule(pattern, new SetPropertiesRule()); }
/** * Add a "call parameter" rule. * This will either take a parameter from the stack * or from the current element body text. * * @param paramIndex The zero-relative parameter number * @param fromStack Should the call parameter be taken from the top of the stack? * @see CallParamRule */ public void addCallParam(String pattern, int paramIndex, boolean fromStack) { addRule(pattern, new CallParamRule(paramIndex, fromStack)); }
/** * Add {@link SetRootRule} with the specified parameters. * * @param pattern Element matching pattern * @param methodName Method name to call on the root object * @param paramType Java class name of the expected parameter type * @see SetRootRule */ public void addSetRoot(String pattern, String methodName, String paramType) { addRule(pattern, new SetRootRule(methodName, paramType)); }
/** * Add a "call parameter" rule that sets a parameter from the stack. * This takes a parameter from the given position on the stack. * * @param paramIndex The zero-relative parameter number * @param stackIndex set the call parameter to the stackIndex'th object down the stack, * where 0 is the top of the stack, 1 the next element down and so on * @see CallMethodRule */ public void addCallParam(String pattern, int paramIndex, int stackIndex) { addRule(pattern, new CallParamRule(paramIndex, stackIndex)); }
/** * Add an "call method" rule for the specified parameters. * * @param pattern Element matching pattern * @param methodName Method name to be called * @param paramCount Number of expected parameters (or zero * for a single parameter from the body of this element) * @see CallMethodRule */ public void addCallMethod(String pattern, String methodName, int paramCount) { addRule(pattern, new CallMethodRule(methodName, paramCount)); }