root / trunk / extensions / extNormalization / src / org / gvsig / patterns / normalization / Fieldtype.java @ 22976
History | View | Annotate | Download (4.76 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
|
23 |
/*
|
24 |
* AUTHORS (In addition to CIT):
|
25 |
* 2008 Prodevelop S.L. main development
|
26 |
*/
|
27 |
|
28 |
package org.gvsig.patterns.normalization; |
29 |
|
30 |
/**
|
31 |
*
|
32 |
* @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a>
|
33 |
* @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a>
|
34 |
*
|
35 |
*/
|
36 |
|
37 |
import org.gvsig.tools.storage.IStorable; |
38 |
import org.gvsig.tools.storage.IStorage; |
39 |
|
40 |
/**
|
41 |
* Class Fieldtype.
|
42 |
*
|
43 |
* @version $Revision$ $Date$
|
44 |
*/
|
45 |
public class Fieldtype implements IStorable { |
46 |
|
47 |
// --------------------------/
|
48 |
// - Class/Member Variables -/
|
49 |
// --------------------------/
|
50 |
|
51 |
/**
|
52 |
* Field _stringvalue
|
53 |
*/
|
54 |
private Stringvalue _stringvalue;
|
55 |
|
56 |
/**
|
57 |
* Field _datevalue
|
58 |
*/
|
59 |
private Datevalue _datevalue;
|
60 |
|
61 |
/**
|
62 |
* Field _decimalvalue
|
63 |
*/
|
64 |
private Decimalvalue _decimalvalue;
|
65 |
|
66 |
/**
|
67 |
* Field _integervalue
|
68 |
*/
|
69 |
private Integervalue _integervalue;
|
70 |
|
71 |
// ----------------/
|
72 |
// - Constructors -/
|
73 |
// ----------------/
|
74 |
|
75 |
public Fieldtype() {
|
76 |
super();
|
77 |
} |
78 |
|
79 |
// -----------/
|
80 |
// - Methods -/
|
81 |
// -----------/
|
82 |
|
83 |
/**
|
84 |
* Returns the value of field 'datevalue'.
|
85 |
*
|
86 |
* @return the value of field 'datevalue'.
|
87 |
*/
|
88 |
public Datevalue getDatevalue() {
|
89 |
return this._datevalue; |
90 |
} |
91 |
|
92 |
/**
|
93 |
* Returns the value of field 'decimalvalue'.
|
94 |
*
|
95 |
* @return the value of field 'decimalvalue'.
|
96 |
*/
|
97 |
public Decimalvalue getDecimalvalue() {
|
98 |
return this._decimalvalue; |
99 |
} |
100 |
|
101 |
/**
|
102 |
* Returns the value of field 'integervalue'.
|
103 |
*
|
104 |
* @return the value of field 'integervalue'.
|
105 |
*/
|
106 |
public Integervalue getIntegervalue() {
|
107 |
return this._integervalue; |
108 |
} |
109 |
|
110 |
/**
|
111 |
* Returns the value of field 'stringvalue'.
|
112 |
*
|
113 |
* @return the value of field 'stringvalue'.
|
114 |
*/
|
115 |
public Stringvalue getStringvalue() {
|
116 |
return this._stringvalue; |
117 |
} |
118 |
|
119 |
/**
|
120 |
* Sets the value of field 'datevalue'.
|
121 |
*
|
122 |
* @param datevalue
|
123 |
* the value of field 'datevalue'.
|
124 |
*/
|
125 |
public void setDatevalue(Datevalue datevalue) { |
126 |
this._datevalue = datevalue;
|
127 |
} |
128 |
|
129 |
/**
|
130 |
* Sets the value of field 'decimalvalue'.
|
131 |
*
|
132 |
* @param decimalvalue
|
133 |
* the value of field 'decimalvalue'.
|
134 |
*/
|
135 |
public void setDecimalvalue(Decimalvalue decimalvalue) { |
136 |
this._decimalvalue = decimalvalue;
|
137 |
} |
138 |
|
139 |
/**
|
140 |
* Sets the value of field 'integervalue'.
|
141 |
*
|
142 |
* @param integervalue
|
143 |
* the value of field 'integervalue'.
|
144 |
*/
|
145 |
public void setIntegervalue(Integervalue integervalue) { |
146 |
this._integervalue = integervalue;
|
147 |
} |
148 |
|
149 |
/**
|
150 |
* Sets the value of field 'stringvalue'.
|
151 |
*
|
152 |
* @param stringvalue
|
153 |
* the value of field 'stringvalue'.
|
154 |
*/
|
155 |
public void setStringvalue(Stringvalue stringvalue) { |
156 |
this._stringvalue = stringvalue;
|
157 |
} |
158 |
|
159 |
public void getstate(IStorage state) { |
160 |
state.setTheClass(this);
|
161 |
if (this._stringvalue != null) { |
162 |
state.put("stringvalue", this._stringvalue); |
163 |
} |
164 |
else if (this._datevalue != null) { |
165 |
state.put("datevalue", this._datevalue); |
166 |
} |
167 |
else if (this._decimalvalue != null){ |
168 |
state.put("decimalvalue", this._decimalvalue); |
169 |
} |
170 |
else{
|
171 |
state.put("integervalue", this._integervalue); |
172 |
} |
173 |
} |
174 |
|
175 |
public void setstate(IStorage state) { |
176 |
try {
|
177 |
if (state.getObject("stringvalue") != null) { |
178 |
this._stringvalue = (Stringvalue) state.getObject("stringvalue"); |
179 |
} |
180 |
else if (state.getObject("datevalue") != null) { |
181 |
this._datevalue = (Datevalue) state.getObject("datevalue"); |
182 |
} |
183 |
else if (state.getObject("decimalvalue") != null) { |
184 |
this._decimalvalue = (Decimalvalue) state.getObject("decimalvalue"); |
185 |
} |
186 |
else {
|
187 |
this._integervalue = (Integervalue) state.getObject("integervalue"); |
188 |
} |
189 |
} catch (InstantiationException e) { |
190 |
// TODO Auto-generated catch block
|
191 |
e.printStackTrace(); |
192 |
} catch (IllegalAccessException e) { |
193 |
// TODO Auto-generated catch block
|
194 |
e.printStackTrace(); |
195 |
} |
196 |
} |
197 |
|
198 |
} |