KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. The ASF licenses this file to You
4 * under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. For additional information regarding
15 * copyright in this work, please see the NOTICE file in the top level
16 * directory of this distribution.
17 */

18 /*
19  * PropertyDef.java
20  *
21  * Created on June 4, 2005, 1:13 PM
22  */

23
24 package org.apache.roller.config.runtime;
25
26 /**
27  * Represents the definition of a single runtime property.
28  *
29  * Each property definition may contain these elements
30  * - name (required)
31  * - key (required)
32  * - type (required)
33  * - default-value (required)
34  * - rows (optional)
35  * - cols (options)
36  *
37  * @author Allen Gilliland
38  */

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