Package org.apache.commons.digester
Class BeanPropertySetterRule
java.lang.Object
org.apache.commons.digester.Rule
org.apache.commons.digester.BeanPropertySetterRule
Rule implements sets a bean property on the top object to the body text.
The property set:
- can be specified when the rule is created
- or can match the current element when the rule is called.
Using the second method and the ExtendedBaseRules
child match
pattern, all the child elements can be automatically mapped to properties
on the parent object.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
The body text used to set the property.protected String
Set this property on the top object.Fields inherited from class org.apache.commons.digester.Rule
digester, namespaceURI
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct rule that automatically sets a property from the body text.BeanPropertySetterRule
(String propertyName) Construct rule that sets the given property from the body text.BeanPropertySetterRule
(Digester digester) Deprecated.BeanPropertySetterRule
(Digester digester, String propertyName) Deprecated.The digester instance is now set in theDigester.addRule(java.lang.String, org.apache.commons.digester.Rule)
method. -
Method Summary
Methods inherited from class org.apache.commons.digester.Rule
begin, begin, body, end, getDigester, getNamespaceURI, setDigester, setNamespaceURI
-
Field Details
-
propertyName
Set this property on the top object. -
bodyText
The body text used to set the property.
-
-
Constructor Details
-
BeanPropertySetterRule
Deprecated.The digester instance is now set in theDigester.addRule(java.lang.String, org.apache.commons.digester.Rule)
method. UseBeanPropertySetterRule(String propertyName)
instead.Construct rule that sets the given property from the body text.
- Parameters:
digester
- associatedDigester
propertyName
- name of property to set
-
BeanPropertySetterRule
Deprecated.The digester instance is now set in theDigester.addRule(java.lang.String, org.apache.commons.digester.Rule)
method. UseBeanPropertySetterRule()
instead.Construct rule that automatically sets a property from the body text.
This construct creates a rule that sets the property on the top object named the same as the current element.
- Parameters:
digester
- associatedDigester
-
BeanPropertySetterRule
Construct rule that sets the given property from the body text.
- Parameters:
propertyName
- name of property to set
-
BeanPropertySetterRule
public BeanPropertySetterRule()Construct rule that automatically sets a property from the body text.
This construct creates a rule that sets the property on the top object named the same as the current element.
-
-
Method Details
-
body
Process the body text of this element.- Overrides:
body
in classRule
- Parameters:
namespace
- the namespace URI of the matching element, or an empty string if the parser is not namespace aware or the element has no namespacename
- the local name if the parser is namespace aware, or just the element name otherwisetext
- The text of the body of this element- Throws:
Exception
-
end
Process the end of this element.- Overrides:
end
in classRule
- Parameters:
namespace
- the namespace URI of the matching element, or an empty string if the parser is not namespace aware or the element has no namespacename
- the local name if the parser is namespace aware, or just the element name otherwise- Throws:
NoSuchMethodException
- if the bean does not have a writeable property of the specified nameException
-
finish
Clean up after parsing is complete. -
toString
Render a printable version of this Rule.
-
Digester.addRule(java.lang.String, org.apache.commons.digester.Rule)
method.