1
2
3
4 package org.xanot.structure;
5
6 /***
7 * Attribute setter rule. This rule define how an XML element's attribute tobe
8 * mapped to an object's property.
9 *
10 * @author Ferdinand Neman (newm4n _at_ gmail.com)
11 */
12 public class AttributeSetRule extends XanotRule {
13 private String propertyName = null;
14
15 private String xmlAttributeName = null;
16
17 private String dateFormat = null;
18
19 /***
20 * Creates a new AttributeSetRule object. TODO Consider the usage of the
21 * xmlAttributeName. Should we remove it ?
22 *
23 * @param path
24 * The path, should be equals to the parent path. Hmm. what for.
25 * @param propertyName
26 * The object's property name.
27 * @param xmlAttributeName
28 * The XML attribute name.
29 */
30 public AttributeSetRule(String path, String propertyName,
31 String xmlAttributeName) {
32 super(path);
33 setPropertyName(propertyName);
34 setXmlAttributeName(xmlAttributeName);
35 }
36
37 /***
38 * Get Object's property name
39 *
40 * @return Returns the propertyName.
41 */
42 public String getPropertyName() {
43 return propertyName;
44 }
45
46 /***
47 * set Object's property name
48 *
49 * @param propertyName
50 * The propertyName to set.
51 */
52 public void setPropertyName(String propertyName) {
53 this.propertyName = propertyName;
54 }
55
56 /***
57 * @return Returns the xmlAttributeName.
58 */
59 public String getXmlAttributeName() {
60 return xmlAttributeName;
61 }
62
63 /***
64 * @param xmlAttributeName
65 * The xmlAttributeName to set.
66 */
67 public void setXmlAttributeName(String xmlAttributeName) {
68 this.xmlAttributeName = xmlAttributeName;
69 }
70
71 /***
72 * Get string representation of this object.
73 *
74 * @return String representation.
75 */
76 public String toString() {
77 return "AttributeSetRule : [path:" + getPath() + "],[property:"
78 + propertyName + "],[xmlAttributeName:" + xmlAttributeName
79 + "]";
80 }
81
82 /***
83 * Get the date format value.
84 *
85 * @return Date format pattern
86 */
87 public String getDateFormat() {
88 return dateFormat;
89 }
90
91 /***
92 * Set the date format value
93 *
94 * @param dateFormat
95 * new date format pattern
96 */
97 public void setDateFormat(String dateFormat) {
98 this.dateFormat = dateFormat;
99 }
100
101 }