View Javadoc

1   /*
2    * Copyright 2006 The Xanot team
3    */
4   package org.xanot.structure;
5   
6   /***
7    * Propert Setter rule. This rule define how to map sets of xml tag value into
8    * object property.
9    * 
10   * @author Ferdinand Neman (newm4n _at_ gmail.com) <p/> TODO we might need add
11   *         mandatory attributes as stated on the annotation.
12   */
13  public class PropertySetRule extends XanotRule {
14  	private String propertyName = null;
15  
16  	private String dateFormat = null;
17  
18  	/***
19  	 * Creates a new PropertySetRule object.
20  	 * 
21  	 * @param path
22  	 *            Path, should be equals to the xml tag name.
23  	 * @param propertyName
24  	 *            Property name to set.
25  	 */
26  	public PropertySetRule(String path, String propertyName) {
27  		super(path);
28  		setPropertyName(propertyName);
29  	}
30  
31  	/***
32  	 * Get the property name to set.
33  	 * 
34  	 * @return Returns the propertyName.
35  	 */
36  	public String getPropertyName() {
37  		return propertyName;
38  	}
39  
40  	/***
41  	 * Set the property name to set.
42  	 * 
43  	 * @param propertyName
44  	 *            The propertyName to set.
45  	 */
46  	public void setPropertyName(String propertyName) {
47  		this.propertyName = propertyName;
48  	}
49  
50  	/***
51  	 * Get string representation of this object.
52  	 * 
53  	 * @return String representation.
54  	 */
55  	public String toString() {
56  		return "PropertySetRule : [path:" + getPath() + "],[property:"
57  				+ propertyName + "]";
58  	}
59  
60  	/***
61  	 * Get the date format value.
62  	 * 
63  	 * @return Date format pattern
64  	 */
65  	public String getDateFormat() {
66  		return dateFormat;
67  	}
68  
69  	/***
70  	 * Set the date format value
71  	 * 
72  	 * @param dateFormat
73  	 *            new date format pattern
74  	 */
75  	public void setDateFormat(String dateFormat) {
76  		this.dateFormat = dateFormat;
77  	}
78  }