svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libTools / src / org / gvsig / tools / persistence / PersistentState.java @ 30207
History | View | Annotate | Download (10.9 KB)
1 |
package org.gvsig.tools.persistence; |
---|---|
2 |
|
3 |
import java.io.Reader; |
4 |
import java.util.Date; |
5 |
import java.util.Iterator; |
6 |
import java.util.List; |
7 |
import java.util.Map; |
8 |
import java.util.Set; |
9 |
|
10 |
public interface PersistentState { |
11 |
/**
|
12 |
* Gets the name of the class corresponding to this persistent state
|
13 |
*
|
14 |
* @return The class name of the class represented by this state
|
15 |
*/
|
16 |
public String getTheClassName(); |
17 |
|
18 |
/**
|
19 |
* Gets an <code>int</code> property.
|
20 |
*
|
21 |
* @param name
|
22 |
* The name of the property to get
|
23 |
*
|
24 |
* @return The <code>int</code> property associated to the provided name
|
25 |
* @throws PersistenceException
|
26 |
*/
|
27 |
public int getInt(String name) throws PersistenceException; |
28 |
|
29 |
/**
|
30 |
* Gets an <code>long</code> property.
|
31 |
*
|
32 |
* @param name
|
33 |
* The name of the property to get
|
34 |
*
|
35 |
* @return The <code>long</code> property associated to the provided name
|
36 |
* @throws PersistenceException
|
37 |
*/
|
38 |
public long getLong(String name) throws PersistenceException; |
39 |
|
40 |
/**
|
41 |
* Gets a <code>double</code> property.
|
42 |
*
|
43 |
* @param name
|
44 |
* The name of the property to get
|
45 |
*
|
46 |
* @return The <code>double</code> property associated to the provided name
|
47 |
* @throws PersistenceException
|
48 |
*/
|
49 |
public double getDouble(String name) |
50 |
throws PersistenceException;
|
51 |
|
52 |
/**
|
53 |
* Gets a <code>float</code> property.
|
54 |
*
|
55 |
* @param name
|
56 |
* The name of the property to get
|
57 |
*
|
58 |
* @return The <code>float</code> property associated to the provided name
|
59 |
* @throws PersistenceException
|
60 |
*/
|
61 |
public float getFloat(String name) throws PersistenceException; |
62 |
|
63 |
/**
|
64 |
* Gets a <code>boolean</code> property.
|
65 |
*
|
66 |
* @param name
|
67 |
* The name of the property to get
|
68 |
*
|
69 |
* @return The <code>boolean</code> property associated to the provided name
|
70 |
* @throws PersistenceException
|
71 |
*/
|
72 |
public boolean getBoolean(String name) |
73 |
throws PersistenceException;
|
74 |
|
75 |
/**
|
76 |
* Gets a <code>String</code> property.
|
77 |
*
|
78 |
* @param name
|
79 |
* The name of the property to get
|
80 |
*
|
81 |
* @return The <code>String</code> property associated to the provided name
|
82 |
* @throws PersistenceException
|
83 |
*/
|
84 |
public String getString(String name) |
85 |
throws PersistenceException;
|
86 |
|
87 |
/**
|
88 |
* Gets an <code>Object</code> property.
|
89 |
*
|
90 |
* @param name
|
91 |
* The name of the property to get
|
92 |
*
|
93 |
* @return The <code>Object</code> property associated to the provided name
|
94 |
*
|
95 |
* @throws PersistenceException
|
96 |
*/
|
97 |
public Object get(String name) throws PersistenceException; |
98 |
|
99 |
/**
|
100 |
* <p>
|
101 |
* Gets an <code>Iterator</code> over properties of types {@link List},
|
102 |
* {@link Set} or {@link Map}.
|
103 |
* </p>
|
104 |
*
|
105 |
* @param name
|
106 |
* The name of the property to get
|
107 |
*
|
108 |
* @return The <code>Iterator</code> associated to the property value of
|
109 |
* provided name
|
110 |
* @throws PersistenceException
|
111 |
*/
|
112 |
public Iterator getIterator(String name) throws PersistenceException; |
113 |
|
114 |
/**
|
115 |
* <p>
|
116 |
* Sets a property of type String.
|
117 |
* </p>
|
118 |
*
|
119 |
* @param name
|
120 |
* The name of the property to store <i>(must be a valid Java
|
121 |
* identifier)</i>
|
122 |
* @param it
|
123 |
* The String object to be stored in the state.
|
124 |
*
|
125 |
* @throws PersistenceException
|
126 |
*/
|
127 |
public void set(String name, String value) throws PersistenceException; |
128 |
|
129 |
/**
|
130 |
* <p>
|
131 |
* Sets a property of type int.
|
132 |
* </p>
|
133 |
*
|
134 |
* @param name
|
135 |
* The name of the property to store <i>(must be a valid Java
|
136 |
* identifier)</i>
|
137 |
* @param it
|
138 |
* The int value to be stored in the state.
|
139 |
*
|
140 |
* @throws PersistenceException
|
141 |
*/
|
142 |
public void set(String name, int value) throws PersistenceException; |
143 |
|
144 |
/**
|
145 |
* <p>
|
146 |
* Sets a property of type long.
|
147 |
* </p>
|
148 |
*
|
149 |
* @param name
|
150 |
* The name of the property to store <i>(must be a valid Java
|
151 |
* identifier)</i>
|
152 |
* @param it
|
153 |
* The long value to be stored in the state.
|
154 |
*
|
155 |
* @throws PersistenceException
|
156 |
*/
|
157 |
public void set(String name, long value) throws PersistenceException; |
158 |
|
159 |
/**
|
160 |
* <p>
|
161 |
* Sets a property of type double.
|
162 |
* </p>
|
163 |
*
|
164 |
* @param name
|
165 |
* The name of the property to store <i>(must be a valid Java
|
166 |
* identifier)</i>
|
167 |
* @param it
|
168 |
* The double value to be stored in the state.
|
169 |
*
|
170 |
* @throws PersistenceException
|
171 |
*/
|
172 |
public void set(String name, double value) throws PersistenceException; |
173 |
|
174 |
/**
|
175 |
* <p>
|
176 |
* Sets a property of type float.
|
177 |
* </p>
|
178 |
*
|
179 |
* @param name
|
180 |
* The name of the property to store <i>(must be a valid Java
|
181 |
* identifier)</i>
|
182 |
* @param it
|
183 |
* The float value to be stored in the state.
|
184 |
*
|
185 |
* @throws PersistenceException
|
186 |
*/
|
187 |
public void set(String name, float value) throws PersistenceException; |
188 |
|
189 |
/**
|
190 |
* <p>
|
191 |
* Sets a property of type boolean.
|
192 |
* </p>
|
193 |
*
|
194 |
* @param name
|
195 |
* The name of the property to store <i>(must be a valid Java
|
196 |
* identifier)</i>
|
197 |
* @param it
|
198 |
* The boolean value to be stored in the state.
|
199 |
*
|
200 |
* @throws PersistenceException
|
201 |
*/
|
202 |
public void set(String name, boolean value) throws PersistenceException; |
203 |
|
204 |
/**
|
205 |
* <p>
|
206 |
* Sets a property of type Persistent.
|
207 |
* </p>
|
208 |
*
|
209 |
* @param name
|
210 |
* The name of the property to store <i>(must be a valid Java
|
211 |
* identifier)</i>
|
212 |
* @param it
|
213 |
* The Persistent object to be stored in the state.
|
214 |
*
|
215 |
* @throws PersistenceException
|
216 |
*/
|
217 |
public void set(String name, Persistent obj) |
218 |
throws PersistenceException;
|
219 |
|
220 |
/**
|
221 |
* <p>
|
222 |
* Sets a property of type {@link List}.
|
223 |
* </p>
|
224 |
* <p>
|
225 |
* The items of the list must be persistence supported types instance.
|
226 |
* </p>
|
227 |
* <p>
|
228 |
* <i>{@link #get(String)} return an read only {@link List} instance after
|
229 |
* {@link #load(Reader)}</i>
|
230 |
* </p>
|
231 |
*
|
232 |
* @param name
|
233 |
* The name of the property to store <i>(must be a valid Java
|
234 |
* identifier)</i>
|
235 |
* @param it
|
236 |
* The {@link List} object to be stored in the state.
|
237 |
*
|
238 |
* @throws PersistenceException
|
239 |
*/
|
240 |
public void set(String name, List value) throws PersistenceException; |
241 |
|
242 |
/**
|
243 |
* <p>
|
244 |
* Sets a property of type {@link Set}.
|
245 |
* </p>
|
246 |
* <p>
|
247 |
* The items of the set must be persistence supported type instances.
|
248 |
* </p>
|
249 |
* <p>
|
250 |
* <i>{@link #get(String)} return an read only {@link Set} instance after
|
251 |
* {@link #load(Reader)}</i>
|
252 |
* </p>
|
253 |
*
|
254 |
* @param name
|
255 |
* The name of the property to store <i>(must be a valid Java
|
256 |
* identifier)</i>
|
257 |
* @param it
|
258 |
* The {@link Set} object to be stored in the state.
|
259 |
*
|
260 |
* @throws PersistenceException
|
261 |
*/
|
262 |
public void set(String name, Set value) throws PersistenceException; |
263 |
|
264 |
/**
|
265 |
* <p>
|
266 |
* Sets a property of type {@link Map}.
|
267 |
* </p>
|
268 |
* <p>
|
269 |
* The values and keys of the map must be persistence supported type
|
270 |
* instances.
|
271 |
* </p>
|
272 |
* <i>{@link #get(String)} return an read only {@link Map} instance after
|
273 |
* {@link #load(Reader)}</i> </p>
|
274 |
*
|
275 |
* @param name
|
276 |
* The name of the property to store <i>(must be a valid Java
|
277 |
* identifier)</i>
|
278 |
* @param it
|
279 |
* The {@link Map} object to be stored in the state.
|
280 |
*
|
281 |
* @throws PersistenceException
|
282 |
*/
|
283 |
public void set(String name, Map value) throws PersistenceException; |
284 |
|
285 |
/**
|
286 |
* <p>
|
287 |
* Sets a property of type {@link Boolean}.
|
288 |
* </p>
|
289 |
*
|
290 |
* @param name
|
291 |
* The name of the property to store <i>(must be a valid Java
|
292 |
* identifier)</i>
|
293 |
* @param it
|
294 |
* The {@link Boolean} object to be stored in the state.
|
295 |
*
|
296 |
* @throws PersistenceException
|
297 |
*/
|
298 |
public void set(String name, Boolean value) throws PersistenceException; |
299 |
|
300 |
/**
|
301 |
* <p>
|
302 |
* Sets a property of type {@link Date}.
|
303 |
* </p>
|
304 |
*
|
305 |
* @param name
|
306 |
* The name of the property to store <i>(must be a valid Java
|
307 |
* identifier)</i>
|
308 |
* @param it
|
309 |
* The {@link Date} object to be stored in the state.
|
310 |
*
|
311 |
* @throws PersistenceException
|
312 |
*/
|
313 |
public void set(String name, Date value) throws PersistenceException; |
314 |
|
315 |
/**
|
316 |
* <p>
|
317 |
* Sets a property of type {@link Integer}.
|
318 |
* </p>
|
319 |
*
|
320 |
* @param name
|
321 |
* The name of the property to store <i>(must be a valid Java
|
322 |
* identifier)</i>
|
323 |
* @param it
|
324 |
* The {@link Integer} object to be stored in the state.
|
325 |
*
|
326 |
* @throws PersistenceException
|
327 |
*/
|
328 |
public void set(String name, Integer value) throws PersistenceException; |
329 |
|
330 |
/**
|
331 |
* <p>
|
332 |
* Sets a property of type {@link Long}.
|
333 |
* </p>
|
334 |
*
|
335 |
* @param name
|
336 |
* The name of the property to store <i>(must be a valid Java
|
337 |
* identifier)</i>
|
338 |
* @param it
|
339 |
* The {@link Long} object to be stored in the state.
|
340 |
*
|
341 |
* @throws PersistenceException
|
342 |
*/
|
343 |
public void set(String name, Long value) throws PersistenceException; |
344 |
|
345 |
/**
|
346 |
* <p>
|
347 |
* Sets a property of type {@link Float}.
|
348 |
* </p>
|
349 |
*
|
350 |
* @param name
|
351 |
* The name of the property to store <i>(must be a valid Java
|
352 |
* identifier)</i>
|
353 |
* @param it
|
354 |
* The {@link Float} object to be stored in the state.
|
355 |
*
|
356 |
* @throws PersistenceException
|
357 |
*/
|
358 |
public void set(String name, Float value) throws PersistenceException; |
359 |
|
360 |
/**
|
361 |
* <p>
|
362 |
* Sets a property of type {@link Double}.
|
363 |
* </p>
|
364 |
*
|
365 |
* @param name
|
366 |
* The name of the property to store <i>(must be a valid Java
|
367 |
* identifier)</i>
|
368 |
* @param it
|
369 |
* The {@link Double} object to be stored in the state.
|
370 |
*
|
371 |
* @throws PersistenceException
|
372 |
*/
|
373 |
public void set(String name, Double value) throws PersistenceException; |
374 |
|
375 |
/**
|
376 |
* <p>
|
377 |
* Sets a property of type {@link List} (<i>like do
|
378 |
* {@link #set(String, List)} </i>) filled with the values provided by a
|
379 |
* {@link Iterator}
|
380 |
* </p>
|
381 |
* <p>
|
382 |
* The items of the iteration must be persistence supported types instance.
|
383 |
* </p>
|
384 |
*
|
385 |
* @param name
|
386 |
* The name of the property to store <i>(must be a valid Java
|
387 |
* identifier)</i>
|
388 |
* @param it
|
389 |
* The iterator to get values to store in the list property.
|
390 |
*
|
391 |
* @throws PersistenceException
|
392 |
* @see {@link #set(String, List)}
|
393 |
*/
|
394 |
public void set(String name, Iterator it) |
395 |
throws PersistenceException;
|
396 |
|
397 |
|
398 |
/**
|
399 |
* <p>
|
400 |
* Sets a property.
|
401 |
* </p>
|
402 |
* <p>
|
403 |
* <code>value</value> must be a supported type or manager must have
|
404 |
* a {@link PersistenceFactory} that know how persist it.
|
405 |
* </p>
|
406 |
*
|
407 |
* @param name
|
408 |
* The name of the property to store <i>(must be a valid Java
|
409 |
* identifier)</i>
|
410 |
* @param it
|
411 |
* The {@link Float} object to be stored in the state.
|
412 |
*
|
413 |
* @throws PersistenceException
|
414 |
*/
|
415 |
public void set(String name, Object value) throws PersistenceException; |
416 |
|
417 |
/**
|
418 |
* <p>Gets an iterator over the names of the properties contained
|
419 |
* in this PersistentState.</p>
|
420 |
*
|
421 |
* @return An iterator which provides the name of all the
|
422 |
* properties contained in this state.
|
423 |
*/
|
424 |
public Iterator getNames(); |
425 |
|
426 |
|
427 |
/**
|
428 |
* Informs that a property is set or not.
|
429 |
*
|
430 |
* @param name
|
431 |
* @return
|
432 |
*/
|
433 |
public boolean hasValue(String name); |
434 |
} |