|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.digester3.Rule
org.apache.commons.digester3.BeanPropertySetterRule
public class BeanPropertySetterRule
Rule implements sets a bean property on the top object to the body text.
The property set:
Using the second method and the ExtendedBaseRules child match pattern, all the child elements can be
automatically mapped to properties on the parent object.
| Constructor Summary | |
|---|---|
BeanPropertySetterRule()
Construct rule that automatically sets a property from the body text. |
|
BeanPropertySetterRule(String propertyName)
Construct rule that sets the given property from the body text. |
|
| Method Summary | |
|---|---|
void |
begin(String namespace,
String name,
Attributes attributes)
This method is called when the beginning of a matching XML element is encountered. |
void |
body(String namespace,
String name,
String text)
This method is called when the body of a matching XML element is encountered. |
void |
end(String namespace,
String name)
This method is called when the end of a matching XML element is encountered. |
void |
finish()
This method is called after all parsing methods have been called, to allow Rules to remove temporary data. |
protected String |
getBodyText()
Returns the body text used to set the property. |
String |
getPropertyName()
Returns the property name associated to this setter rule. |
void |
setPropertyNameFromAttribute(String propertyNameFromAttribute)
Sets the attribute name from which the property name has to be extracted. |
String |
toString()
|
| Methods inherited from class org.apache.commons.digester3.Rule |
|---|
getDigester, getNamespaceURI, setDigester, setNamespaceURI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BeanPropertySetterRule(String propertyName)
Construct rule that sets the given property from the body text.
propertyName - name of property to setpublic 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 Detail |
|---|
public String getPropertyName()
public void setPropertyNameFromAttribute(String propertyNameFromAttribute)
propertyNameFromAttribute - the attribute name from which the property name has to be extracted.protected String getBodyText()
public void begin(String namespace,
String name,
Attributes attributes)
throws Exception
begin in class Rulenamespace - 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 otherwiseattributes - The attribute list of this element
Exception - if any error occurs
public void body(String namespace,
String name,
String text)
throws Exception
body in class Rulenamespace - 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
Exception - if any error occurs
public void end(String namespace,
String name)
throws Exception
end in class Rulenamespace - 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
Exception - if any error occurs
public void finish()
throws Exception
finish in class RuleException - if any error occurspublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||