KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > config > runtime > PropertyDef


1 /*
2  * PropertyDef.java
3  *
4  * Created on June 4, 2005, 1:13 PM
5  */

6
7 package org.roller.config.runtime;
8
9 /**
10  * Represents the definition of a single runtime property.
11  *
12  * Each property definition may contain these elements
13  * - name (required)
14  * - key (required)
15  * - type (required)
16  * - default-value (required)
17  * - rows (optional)
18  * - cols (options)
19  *
20  * @author Allen Gilliland
21  */

22 public class PropertyDef {
23     
24     private String JavaDoc name = null;
25     private String JavaDoc key = null;
26     private String JavaDoc type = null;
27     private String JavaDoc defaultValue = null;
28     private int rows = 5;
29     private int cols = 25;
30     
31     
32     /** Creates a new instance of PropertyDef */
33     public PropertyDef() {}
34
35     public String JavaDoc toString() {
36         return "["+name+","+key+","+type+","+defaultValue+","+rows+","+cols+"]";
37     }
38     
39     public String JavaDoc getName() {
40         return name;
41     }
42
43     public void setName(String JavaDoc name) {
44         this.name = name;
45     }
46
47     public String JavaDoc getKey() {
48         return key;
49     }
50
51     public void setKey(String JavaDoc key) {
52         this.key = key;
53     }
54
55     public String JavaDoc getType() {
56         return type;
57     }
58
59     public void setType(String JavaDoc type) {
60         this.type = type;
61     }
62
63     public String JavaDoc getDefaultValue() {
64         return defaultValue;
65     }
66
67     public void setDefaultValue(String JavaDoc defaultvalue) {
68         this.defaultValue = defaultvalue;
69     }
70
71     public int getRows() {
72         return rows;
73     }
74
75     public void setRows(int rows) {
76         this.rows = rows;
77     }
78
79     public void setRows(String JavaDoc rows) {
80         //convert to int
81
try {
82             int r = Integer.parseInt(rows);
83             this.rows = r;
84         } catch(Exception JavaDoc e) {
85             // hmmm ... bogus value
86
}
87     }
88     public int getCols() {
89         return cols;
90     }
91
92     public void setCols(int cols) {
93         this.cols = cols;
94     }
95     
96     public void setCols(String JavaDoc cols) {
97         //convert to int
98
try {
99             int c = Integer.parseInt(cols);
100             this.cols = c;
101         } catch(Exception JavaDoc e) {
102             // hmmm ... bogus value
103
}
104     }
105 }
106
Popular Tags