Revision 1861 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/persistence/PersistentState.java

View differences:

PersistentState.java
37 37
import org.gvsig.tools.persistence.exception.PersistenceException;
38 38

  
39 39
public interface PersistentState {
40
	/**
41
	 * Gets the name of the java class corresponding to this persistent state
42
	 *
43
	 * @return The class name of the java class represented by this state
44
	 */
45
	public String getTheClassName();
46 40

  
47
	/**
48
	 * Returns the struct definition associated to this state
49
	 * 
50
	 * @return the DynStruct definition of the state.
51
	 */
52
	public DynStruct getDefinition();
53
	
54
	
55
	public PersistentContext getContext();
56
	
57
	/**
58
	 * Gets an <code>int</code> property.
59
	 *
60
	 * @param name
61
	 *            The name of the property to get
62
	 *
63
	 * @return The <code>int</code> property associated to the provided name
64
	 * @throws PersistenceException
65
	 */
66
	public int getInt(String name) throws PersistenceException;
41
    /**
42
     * Gets the name of the java class corresponding to this persistent state
43
     *
44
     * @return The class name of the java class represented by this state
45
     */
46
    public String getTheClassName();
67 47

  
68
	public int getInt(String name, int defaultValue)
69
		throws PersistenceException;
48
    /**
49
     * Returns the struct definition associated to this state
50
     *
51
     * @return the DynStruct definition of the state.
52
     */
53
    public DynStruct getDefinition();
70 54

  
55
    public PersistentContext getContext();
71 56

  
72
	/**
73
	 * Gets an <code>long</code> property.
74
	 *
75
	 * @param name
76
	 *            The name of the property to get
77
	 *
78
	 * @return The <code>long</code> property associated to the provided name
79
	 * @throws PersistenceException
80
	 */
81
	public long getLong(String name) throws PersistenceException;
82
	
83
	public long getLong(String name, long defaultValue)
84
			throws PersistenceException;
57
    /**
58
     * Gets an <code>int</code> property.
59
     *
60
     * @param name The name of the property to get
61
     *
62
     * @return The <code>int</code> property associated to the provided name
63
     * @throws PersistenceException
64
     */
65
    public int getInt(String name) throws PersistenceException;
85 66

  
67
    public int getInt(String name, int defaultValue)
68
            throws PersistenceException;
86 69

  
87
	/**
88
	 * Gets a <code>Date</code> property.
89
	 * 
90
	 * @param name
91
	 * @return The <code>Date</code> property associated to the provided name
92
	 * @throws PersistenceException
93
	 */
94
	public Date getDate(String name)
95
			throws PersistenceException;
70
    /**
71
     * Gets an <code>long</code> property.
72
     *
73
     * @param name The name of the property to get
74
     *
75
     * @return The <code>long</code> property associated to the provided name
76
     * @throws PersistenceException
77
     */
78
    public long getLong(String name) throws PersistenceException;
96 79

  
97
	/**
98
	 * Gets a <code>double</code> property.
99
	 *
100
	 * @param name
101
	 *            The name of the property to get
102
	 *
103
	 * @return The <code>double</code> property associated to the provided name
104
	 * @throws PersistenceException
105
	 */
106
	public double getDouble(String name)
107
			throws PersistenceException;
80
    public long getLong(String name, long defaultValue)
81
            throws PersistenceException;
108 82

  
109
	public double getDouble(String name, double defaultValue)
110
			throws PersistenceException;
83
    /**
84
     * Gets a <code>Date</code> property.
85
     *
86
     * @param name
87
     * @return The <code>Date</code> property associated to the provided name
88
     * @throws PersistenceException
89
     */
90
    public Date getDate(String name)
91
            throws PersistenceException;
111 92

  
112
	/**
113
	 * Gets a <code>float</code> property.
114
	 *
115
	 * @param name
116
	 *            The name of the property to get
117
	 *
118
	 * @return The <code>float</code> property associated to the provided name
119
	 * @throws PersistenceException
120
	 */
121
	public float getFloat(String name) throws PersistenceException;
122
	public float getFloat(String name, float defaultValue) throws PersistenceException;
93
    /**
94
     * Gets a <code>double</code> property.
95
     *
96
     * @param name The name of the property to get
97
     *
98
     * @return The <code>double</code> property associated to the provided name
99
     * @throws PersistenceException
100
     */
101
    public double getDouble(String name)
102
            throws PersistenceException;
123 103

  
124
	/**
125
	 * Gets a <code>boolean</code> property.
126
	 *
127
	 * @param name
128
	 *            The name of the property to get
129
	 *
130
	 * @return The <code>boolean</code> property associated to the provided name
131
	 * @throws PersistenceException
132
	 */
133
	public boolean getBoolean(String name) throws PersistenceException;
134
	public boolean getBoolean(String name, boolean defaultValue) throws PersistenceException;
104
    public double getDouble(String name, double defaultValue)
105
            throws PersistenceException;
135 106

  
136
	/**
137
	 * Gets a <code>String</code> property.
138
	 *
139
	 * @param name
140
	 *            The name of the property to get
141
	 *
142
	 * @return The <code>String</code> property associated to the provided name
143
	 * @throws PersistenceException
144
	 */
145
	public String getString(String name)
146
			throws PersistenceException;
107
    /**
108
     * Gets a <code>float</code> property.
109
     *
110
     * @param name The name of the property to get
111
     *
112
     * @return The <code>float</code> property associated to the provided name
113
     * @throws PersistenceException
114
     */
115
    public float getFloat(String name) throws PersistenceException;
147 116

  
148
	/**
149
	 * Gets a {@link List} property.
150
	 * 
151
	 * <strong>Don't use the returned List as it is, as it may not work as you
152
	 * expect. Instead, choose you own implementation and do something
153
	 * like:</strong> <code>
154
	 * List myAttribute = new ArrayList(state.getList("prop"))
155
	 * </code>
156
	 * 
157
	 * @param name
158
	 *            The name of the property to get
159
	 * 
160
	 * @return The {@link List} property value associated to the provided name
161
	 * 
162
	 * @throws PersistenceException
163
	 *             if there is an error getting the property value
164
	 */
165
	public List getList(String name) throws PersistenceException;
117
    public float getFloat(String name, float defaultValue) throws PersistenceException;
166 118

  
167
	/**
168
	 * Returns an array whose elements are of the class given. This is useful to
169
	 * be able to cast the returned Object[] to the real class. To be able to
170
	 * store and load a property as an array, the type of the property defined
171
	 * in the {@link DynStruct} must be List.
172
	 * <p>
173
	 * Ex: <code> 
174
	 * Color[] colors = (Color[])state.getArray("colors", Color.class);
175
	 * </code>
176
	 * </p>
177
	 * 
178
	 * @param name
179
	 *            The name of the property to get
180
	 * @param valueClass
181
	 *            the class of the array elements
182
	 * @return the array of elements
183
	 * @throws PersistenceException
184
	 *             if there is an error getting the property value
185
	 */
186
	public Object[] getArray(String name, Class valueClass)
187
			throws PersistenceException;
119
    /**
120
     * Gets a <code>boolean</code> property.
121
     *
122
     * @param name The name of the property to get
123
     *
124
     * @return The <code>boolean</code> property associated to the provided name
125
     * @throws PersistenceException
126
     */
127
    public boolean getBoolean(String name) throws PersistenceException;
188 128

  
189
	/**
190
	 * Returns an array whose elements are of boolean basic type. To be able to
191
	 * store and load a property as an array, the type of the property defined
192
	 * in the {@link DynStruct} must be List.
193
	 * 
194
	 * @param name
195
	 *            The name of the property to get
196
	 * @return the array of elements
197
	 * @throws PersistenceException
198
	 *             if there is an error getting the property value
199
	 */
200
	public boolean[] getBooleanArray(String name) throws PersistenceException;
129
    public boolean getBoolean(String name, boolean defaultValue) throws PersistenceException;
201 130

  
202
	/**
203
	 * Returns an array whose elements are of int basic type. To be able to
204
	 * store and load a property as an array, the type of the property defined
205
	 * in the {@link DynStruct} must be List.
206
	 * 
207
	 * @param name
208
	 *            The name of the property to get
209
	 * @return the array of elements
210
	 * @throws PersistenceException
211
	 *             if there is an error getting the property value
212
	 */
213
	public int[] getIntArray(String name) throws PersistenceException;
131
    /**
132
     * Gets a <code>String</code> property.
133
     *
134
     * @param name The name of the property to get
135
     *
136
     * @return The <code>String</code> property associated to the provided name
137
     * @throws PersistenceException
138
     */
139
    public String getString(String name)
140
            throws PersistenceException;
214 141

  
215
	/**
216
	 * Returns an array whose elements are of long basic type. To be able to
217
	 * store and load a property as an array, the type of the property defined
218
	 * in the {@link DynStruct} must be List.
219
	 * 
220
	 * @param name
221
	 *            The name of the property to get
222
	 * @return the array of elements
223
	 * @throws PersistenceException
224
	 *             if there is an error getting the property value
225
	 */
226
	public long[] getLongArray(String name) throws PersistenceException;
142
    /**
143
     * Gets a {@link List} property.
144
     *
145
     * <strong>Don't use the returned List as it is, as it may not work as you
146
     * expect. Instead, choose you own implementation and do something
147
     * like:</strong> <code>
148
     * List myAttribute = new ArrayList(state.getList("prop"))
149
     * </code>
150
     *
151
     * @param name The name of the property to get
152
     *
153
     * @return The {@link List} property value associated to the provided name
154
     *
155
     * @throws PersistenceException if there is an error getting the property
156
     * value
157
     */
158
    public List getList(String name) throws PersistenceException;
227 159

  
228
	/**
229
	 * Returns an array whose elements are of float basic type. To be able to
230
	 * store and load a property as an array, the type of the property defined
231
	 * in the {@link DynStruct} must be List.
232
	 * 
233
	 * @param name
234
	 *            The name of the property to get
235
	 * @return the array of elements
236
	 * @throws PersistenceException
237
	 *             if there is an error getting the property value
238
	 */
239
	public float[] getFloatArray(String name) throws PersistenceException;
160
    /**
161
     * Returns an array whose elements are of the class given. This is useful to
162
     * be able to cast the returned Object[] to the real class. To be able to
163
     * store and load a property as an array, the type of the property defined
164
     * in the {@link DynStruct} must be List.
165
     * <p>
166
     * Ex: <code>
167
     * Color[] colors = (Color[])state.getArray("colors", Color.class);
168
     * </code>
169
     * </p>
170
     *
171
     * @param name The name of the property to get
172
     * @param valueClass the class of the array elements
173
     * @return the array of elements
174
     * @throws PersistenceException if there is an error getting the property
175
     * value
176
     */
177
    public Object[] getArray(String name, Class valueClass)
178
            throws PersistenceException;
240 179

  
241
	/**
242
	 * Returns an array whose elements are of double basic type. To be able to
243
	 * store and load a property as an array, the type of the property defined
244
	 * in the {@link DynStruct} must be List.
245
	 * 
246
	 * @param name
247
	 *            The name of the property to get
248
	 * @return the array of elements
249
	 * @throws PersistenceException
250
	 *             if there is an error getting the property value
251
	 */
252
	public double[] getDoubleArray(String name) throws PersistenceException;
180
    /**
181
     * Returns an array whose elements are of boolean basic type. To be able to
182
     * store and load a property as an array, the type of the property defined
183
     * in the {@link DynStruct} must be List.
184
     *
185
     * @param name The name of the property to get
186
     * @return the array of elements
187
     * @throws PersistenceException if there is an error getting the property
188
     * value
189
     */
190
    public boolean[] getBooleanArray(String name) throws PersistenceException;
253 191

  
254
	/**
255
	 * Returns an array whose elements are of Date type. 
256
	 * 
257
	 * To be able to
258
	 * store and load a property as an array, the type of the property defined
259
	 * in the {@link DynStruct} must be List.
260
	 * 
261
	 * @param name
262
	 * @return
263
	 * @throws PersistenceException
264
	 */
265
	public Date[] getDateArray(String name) throws PersistenceException;
192
    /**
193
     * Returns an array whose elements are of int basic type. To be able to
194
     * store and load a property as an array, the type of the property defined
195
     * in the {@link DynStruct} must be List.
196
     *
197
     * @param name The name of the property to get
198
     * @return the array of elements
199
     * @throws PersistenceException if there is an error getting the property
200
     * value
201
     */
202
    public int[] getIntArray(String name) throws PersistenceException;
266 203

  
267
	/**
268
	 * Returns an array whose elements are of String type. 
269
	 * 
270
	 * To be able to
271
	 * store and load a property as an array, the type of the property defined
272
	 * in the {@link DynStruct} must be List.
273
	 *  
274
	 * @param name
275
	 * @return
276
	 * @throws PersistenceException
277
	 */
278
	public String[] getStringArray(String name) throws PersistenceException;
204
    /**
205
     * Returns an array whose elements are of long basic type. To be able to
206
     * store and load a property as an array, the type of the property defined
207
     * in the {@link DynStruct} must be List.
208
     *
209
     * @param name The name of the property to get
210
     * @return the array of elements
211
     * @throws PersistenceException if there is an error getting the property
212
     * value
213
     */
214
    public long[] getLongArray(String name) throws PersistenceException;
279 215

  
280
	/**
281
	 * Gets a {@link Map} property. <strong>Don't use the returned Map as is, as
282
	 * it may not be a real usable Map implementation.</strong>
283
	 * 
284
	 * <strong>Don't use the returned Map as it is, as it may not work as you
285
	 * expect. Instead, choose you own implementation and do something
286
	 * like:</strong> <code>
287
	 * Map myAttribute = new HashMap(state.getSet("prop"))
288
	 * </code>
289
	 * 
290
	 * @param name
291
	 *            The name of the property to get
292
	 * 
293
	 * @return The {@link Map} property value associated to the provided name
294
	 * 
295
	 * @throws PersistenceException
296
	 *             if there is an error getting the property value
297
	 */
298
	public Map getMap(String name) throws PersistenceException;
216
    /**
217
     * Returns an array whose elements are of float basic type. To be able to
218
     * store and load a property as an array, the type of the property defined
219
     * in the {@link DynStruct} must be List.
220
     *
221
     * @param name The name of the property to get
222
     * @return the array of elements
223
     * @throws PersistenceException if there is an error getting the property
224
     * value
225
     */
226
    public float[] getFloatArray(String name) throws PersistenceException;
299 227

  
300
	/**
301
	 * Gets a {@link Set} property.
302
	 * 
303
	 * <strong>Don't use the returned Set as it is, as it may not work as you
304
	 * expect. Instead, choose you own implementation and do something
305
	 * like:</strong> <code>
306
	 * Set myAttribute = new HashSet(state.getSet("prop"))
307
	 * </code>
308
	 * 
309
	 * @param name
310
	 *            The name of the property to get
311
	 * 
312
	 * @return The {@link Set} property value associated to the provided name
313
	 * 
314
	 * @throws PersistenceException
315
	 *             if there is an error getting the property value
316
	 */
317
	public Set getSet(String name) throws PersistenceException;
228
    /**
229
     * Returns an array whose elements are of double basic type. To be able to
230
     * store and load a property as an array, the type of the property defined
231
     * in the {@link DynStruct} must be List.
232
     *
233
     * @param name The name of the property to get
234
     * @return the array of elements
235
     * @throws PersistenceException if there is an error getting the property
236
     * value
237
     */
238
    public double[] getDoubleArray(String name) throws PersistenceException;
318 239

  
319
	public URL getURL(String name) throws PersistenceException;
320
	
321
	public URI getURI(String name) throws PersistenceException;
322
	
323
	public File getFile(String name) throws PersistenceException;
240
    /**
241
     * Returns an array whose elements are of Date type.
242
     *
243
     * To be able to store and load a property as an array, the type of the
244
     * property defined in the {@link DynStruct} must be List.
245
     *
246
     * @param name
247
     * @return
248
     * @throws PersistenceException
249
     */
250
    public Date[] getDateArray(String name) throws PersistenceException;
324 251

  
325
	/**
326
	 * Gets an <code>Object</code> property.
327
	 * 
328
	 * @param name
329
	 *            The name of the property to get
330
	 * 
331
	 * @return The <code>Object</code> property associated to the provided name
332
	 * 
333
	 * @throws PersistenceException
334
	 */
335
	public Object get(String name) throws PersistenceException;
252
    /**
253
     * Returns an array whose elements are of String type.
254
     *
255
     * To be able to store and load a property as an array, the type of the
256
     * property defined in the {@link DynStruct} must be List.
257
     *
258
     * @param name
259
     * @return
260
     * @throws PersistenceException
261
     */
262
    public String[] getStringArray(String name) throws PersistenceException;
336 263

  
337
        public boolean isNull(String name);
338
	/**
339
	 * <p>
340
	 * Gets an <code>Iterator</code> over properties of types {@link List},
341
	 * {@link Set} or {@link Map}.
342
	 * </p>
343
	 * 
344
	 * @param name
345
	 *            The name of the property to get
346
	 * 
347
	 * @return The <code>Iterator</code> associated to the property value of
348
	 *         provided name
349
	 * @throws PersistenceException
350
	 */
351
	public Iterator getIterator(String name) throws PersistenceException;
264
    /**
265
     * Gets a {@link Map} property. <strong>Don't use the returned Map as is, as
266
     * it may not be a real usable Map implementation.</strong>
267
     *
268
     * <strong>Don't use the returned Map as it is, as it may not work as you
269
     * expect. Instead, choose you own implementation and do something
270
     * like:</strong> <code>
271
     * Map myAttribute = new HashMap(state.getSet("prop"))
272
     * </code>
273
     *
274
     * @param name The name of the property to get
275
     *
276
     * @return The {@link Map} property value associated to the provided name
277
     *
278
     * @throws PersistenceException if there is an error getting the property
279
     * value
280
     */
281
    public Map getMap(String name) throws PersistenceException;
352 282

  
353
	/**
354
	 * <p>
355
	 * Sets a property of type String.
356
	 * </p>
357
	 *
358
	 * @param name
359
	 *            The name of the property to store <i>(must be a valid Java
360
	 *            identifier)</i>
361
	 * @param it
362
	 *            The String object to be stored in the state.
363
	 *
364
	 * @throws PersistenceException
365
	 */
366
	public void set(String name, String value) throws PersistenceException;
283
    /**
284
     * Gets a {@link Set} property.
285
     *
286
     * <strong>Don't use the returned Set as it is, as it may not work as you
287
     * expect. Instead, choose you own implementation and do something
288
     * like:</strong> <code>
289
     * Set myAttribute = new HashSet(state.getSet("prop"))
290
     * </code>
291
     *
292
     * @param name The name of the property to get
293
     *
294
     * @return The {@link Set} property value associated to the provided name
295
     *
296
     * @throws PersistenceException if there is an error getting the property
297
     * value
298
     */
299
    public Set getSet(String name) throws PersistenceException;
367 300

  
368
	public void set(String name, File value) throws PersistenceException;
369
	
370
	public void set(String name, URL value) throws PersistenceException;
301
    public URL getURL(String name) throws PersistenceException;
371 302

  
372
	public void set(String name, URI value) throws PersistenceException;
303
    public URI getURI(String name) throws PersistenceException;
373 304

  
374
	/**
375
	 * <p>
376
	 * Sets a property of type int.
377
	 * </p>
378
	 *
379
	 * @param name
380
	 *            The name of the property to store <i>(must be a valid Java
381
	 *            identifier)</i>
382
	 * @param it
383
	 *            The int value to be stored in the state.
384
	 *
385
	 * @throws PersistenceException
386
	 */
387
	public void set(String name, int value) throws PersistenceException;
305
    public File getFile(String name) throws PersistenceException;
388 306

  
389
	/**
390
	 * <p>
391
	 * Sets a property of type long.
392
	 * </p>
393
	 *
394
	 * @param name
395
	 *            The name of the property to store <i>(must be a valid Java
396
	 *            identifier)</i>
397
	 * @param it
398
	 *            The long value to be stored in the state.
399
	 *
400
	 * @throws PersistenceException
401
	 */
402
	public void set(String name, long value) throws PersistenceException;
307
    /**
308
     * Gets an <code>Object</code> property.
309
     *
310
     * @param name The name of the property to get
311
     *
312
     * @return The <code>Object</code> property associated to the provided name
313
     *
314
     * @throws PersistenceException
315
     */
316
    public Object get(String name) throws PersistenceException;
403 317

  
404
	/**
405
	 * <p>
406
	 * Sets a property of type double.
407
	 * </p>
408
	 *
409
	 * @param name
410
	 *            The name of the property to store <i>(must be a valid Java
411
	 *            identifier)</i>
412
	 * @param it
413
	 *            The double value to be stored in the state.
414
	 *
415
	 * @throws PersistenceException
416
	 */
417
	public void set(String name, double value) throws PersistenceException;
318
    public boolean isNull(String name);
418 319

  
419
	/**
420
	 * <p>
421
	 * Sets a property of type float.
422
	 * </p>
423
	 *
424
	 * @param name
425
	 *            The name of the property to store <i>(must be a valid Java
426
	 *            identifier)</i>
427
	 * @param it
428
	 *            The float value to be stored in the state.
429
	 *
430
	 * @throws PersistenceException
431
	 */
432
	public void set(String name, float value) throws PersistenceException;
320
    /**
321
     * <p>
322
     * Gets an <code>Iterator</code> over properties of types {@link List},
323
     * {@link Set} or {@link Map}.
324
     * </p>
325
     *
326
     * @param name The name of the property to get
327
     *
328
     * @return The <code>Iterator</code> associated to the property value of
329
     * provided name
330
     * @throws PersistenceException
331
     */
332
    public Iterator getIterator(String name) throws PersistenceException;
433 333

  
434
	/**
435
	 * <p>
436
	 * Sets a property of type boolean.
437
	 * </p>
438
	 *
439
	 * @param name
440
	 *            The name of the property to store <i>(must be a valid Java
441
	 *            identifier)</i>
442
	 * @param it
443
	 *            The boolean value to be stored in the state.
444
	 *
445
	 * @throws PersistenceException
446
	 */
447
	public void set(String name, boolean value) throws PersistenceException;
334
    /**
335
     * <p>
336
     * Sets a property of type String.
337
     * </p>
338
     *
339
     * @param name The name of the property to store <i>(must be a valid Java
340
     * identifier)</i>
341
     * @param value
342
     *
343
     * @throws PersistenceException
344
     */
345
    public void set(String name, String value) throws PersistenceException;
448 346

  
449
	/**
450
	 * <p>
451
	 * Sets a property of type Persistent.
452
	 * </p>
453
	 * 
454
	 * @param name
455
	 *            The name of the property to store <i>(must be a valid Java
456
	 *            identifier)</i>
457
	 * @param obj
458
	 *            The Persistent object to be stored in the state.
459
	 * 
460
	 * @throws PersistenceException
461
	 */
462
	public void set(String name, Persistent obj)
463
			throws PersistenceException;
347
    public void set(String name, File value) throws PersistenceException;
464 348

  
465
	/**
466
	 * <p>
467
	 * Sets a property of type {@link List}.
468
	 * </p>
469
	 * <p>
470
	 * The items of the list must be persistence supported types instance.
471
	 * </p>
472
	 * <p>
473
	 * <i>{@link #get(String)} return an read only {@link List} instance after
474
	 * {@link #load(Reader)}</i>
475
	 * </p>
476
	 * 
477
	 * @param name
478
	 *            The name of the property to store <i>(must be a valid Java
479
	 *            identifier)</i>
480
	 * @param value
481
	 *            The {@link List} object to be stored in the state.
482
	 * 
483
	 * @throws PersistenceException
484
	 */
485
	public void set(String name, List value) throws PersistenceException;
349
    public void set(String name, URL value) throws PersistenceException;
486 350

  
487
	/**
488
	 * Sets a property of type {@link List} with an array. To be able to store
489
	 * and load a property as an array, the type of the property defined in the
490
	 * {@link DynStruct} must be List.
491
	 * 
492
	 * @param name
493
	 *            The name of the property to set
494
	 * @param value
495
	 *            the value to set
496
	 * @throws PersistenceException
497
	 *             if there is an error setting the property value
498
	 */
499
	public void set(String name, Object[] value) throws PersistenceException;
351
    public void set(String name, URI value) throws PersistenceException;
500 352

  
501
	/**
502
	 * Sets a property of type {@link List} with an array of int. To be able to
503
	 * store and load a property as an array, the type of the property defined
504
	 * in the {@link DynStruct} must be List.
505
	 * 
506
	 * @param name
507
	 *            The name of the property to set
508
	 * @param value
509
	 *            the value to set
510
	 * @throws PersistenceException
511
	 *             if there is an error setting the property value
512
	 */
513
	public void set(String name, int[] value) throws PersistenceException;
353
    /**
354
     * <p>
355
     * Sets a property of type int.
356
     * </p>
357
     *
358
     * @param name The name of the property to store <i>(must be a valid Java
359
     * identifier)</i>
360
     * @param value
361
     *
362
     * @throws PersistenceException
363
     */
364
    public void set(String name, int value) throws PersistenceException;
514 365

  
515
	/**
516
	 * Sets a property of type {@link List} with an array of long. To be able to
517
	 * store and load a property as an array, the type of the property defined
518
	 * in the {@link DynStruct} must be List.
519
	 * 
520
	 * @param name
521
	 *            The name of the property to set
522
	 * @param value
523
	 *            the value to set
524
	 * @throws PersistenceException
525
	 *             if there is an error setting the property value
526
	 */
527
	public void set(String name, long[] value) throws PersistenceException;
366
    /**
367
     * <p>
368
     * Sets a property of type long.
369
     * </p>
370
     *
371
     * @param name The name of the property to store <i>(must be a valid Java
372
     * identifier)</i>
373
     * @param value
374
     *
375
     * @throws PersistenceException
376
     */
377
    public void set(String name, long value) throws PersistenceException;
528 378

  
529
	/**
530
	 * Sets a property of type {@link List} with an array of float. To be able
531
	 * to store and load a property as an array, the type of the property
532
	 * defined in the {@link DynStruct} must be List.
533
	 * 
534
	 * @param name
535
	 *            The name of the property to set
536
	 * @param value
537
	 *            the value to set
538
	 * @throws PersistenceException
539
	 *             if there is an error setting the property value
540
	 */
541
	public void set(String name, float[] value) throws PersistenceException;
379
    /**
380
     * <p>
381
     * Sets a property of type double.
382
     * </p>
383
     *
384
     * @param name The name of the property to store <i>(must be a valid Java
385
     * identifier)</i>
386
     * @param value
387
     *
388
     * @throws PersistenceException
389
     */
390
    public void set(String name, double value) throws PersistenceException;
542 391

  
543
	/**
544
	 * Sets a property of type {@link List} with an array of double. To be able
545
	 * to store and load a property as an array, the type of the property
546
	 * defined in the {@link DynStruct} must be List.
547
	 * 
548
	 * @param name
549
	 *            The name of the property to set
550
	 * @param value
551
	 *            the value to set
552
	 * @throws PersistenceException
553
	 *             if there is an error setting the property value
554
	 */
555
	public void set(String name, double[] value) throws PersistenceException;
392
    /**
393
     * <p>
394
     * Sets a property of type float.
395
     * </p>
396
     *
397
     * @param name The name of the property to store <i>(must be a valid Java
398
     * identifier)</i>
399
     * @param value
400
     *
401
     * @throws PersistenceException
402
     */
403
    public void set(String name, float value) throws PersistenceException;
556 404

  
557
	/**
558
	 * Sets a property of type {@link List} with an array of Date. 
559
	 * 
560
	 * To be able
561
	 * to store and load a property as an array, the type of the property
562
	 * defined in the {@link DynStruct} must be List.
563
	 * 
564
	 * @param name
565
	 * @param value the Date array to set.
566
	 * @throws PersistenceException
567
	 */
568
	public void set(String name, Date[] value) throws PersistenceException;
405
    /**
406
     * <p>
407
     * Sets a property of type boolean.
408
     * </p>
409
     *
410
     * @param name The name of the property to store <i>(must be a valid Java
411
     * identifier)</i>
412
     * @param value
413
     *
414
     * @throws PersistenceException
415
     */
416
    public void set(String name, boolean value) throws PersistenceException;
569 417

  
570
	/**
571
	 * Sets a property of type {@link List} with an array of String. 
572
	 * 
573
	 * To be able
574
	 * to store and load a property as an array, the type of the property
575
	 * defined in the {@link DynStruct} must be List.
576
	 * 
577
	 * @param name
578
	 * @param value
579
	 * @throws PersistenceException
580
	 */
581
	public void set(String name, String[] value) throws PersistenceException;
418
    /**
419
     * <p>
420
     * Sets a property of type Persistent.
421
     * </p>
422
     *
423
     * @param name The name of the property to store <i>(must be a valid Java
424
     * identifier)</i>
425
     * @param obj The Persistent object to be stored in the state.
426
     *
427
     * @throws PersistenceException
428
     */
429
    public void set(String name, Persistent obj)
430
            throws PersistenceException;
582 431

  
583
	/**
584
	 * Sets a property of type {@link List} with an array of boolean. To be able
585
	 * to store and load a property as an array, the type of the property
586
	 * defined in the {@link DynStruct} must be List.
587
	 * 
588
	 * @param name
589
	 *            The name of the property to set
590
	 * @param value
591
	 *            the value to set
592
	 * @throws PersistenceException
593
	 *             if there is an error setting the property value
594
	 */
595
	public void set(String name, boolean[] value) throws PersistenceException;
432
    /**
433
     * <p>
434
     * Sets a property of type {@link List}.
435
     * </p>
436
     * <p>
437
     * The items of the list must be persistence supported types instance.
438
     * </p>
439
     * <p>
440
     * <i>{@link #get(String)} return an read only {@link List} instance after
441
     * {@link #load(Reader)}</i>
442
     * </p>
443
     *
444
     * @param name The name of the property to store <i>(must be a valid Java
445
     * identifier)</i>
446
     * @param value The {@link List} object to be stored in the state.
447
     *
448
     * @throws PersistenceException
449
     */
450
    public void set(String name, List value) throws PersistenceException;
596 451

  
597
	/**
598
	 * <p>
599
	 * Sets a property of type {@link Set}.
600
	 * </p>
601
	 * <p>
602
	 * The items of the set must be persistence supported type instances.
603
	 * </p>
604
	 * <p>
605
	 * <i>{@link #get(String)} return an read only {@link Set} instance after
606
	 * {@link #load(Reader)}</i>
607
	 * </p>
608
	 *
609
	 * @param name
610
	 *            The name of the property to store <i>(must be a valid Java
611
	 *            identifier)</i>
612
	 * @param it
613
	 *            The {@link Set} object to be stored in the state.
614
	 *
615
	 * @throws PersistenceException
616
	 */
617
	public void set(String name, Set value) throws PersistenceException;
452
    /**
453
     * Sets a property of type {@link List} with an array. To be able to store
454
     * and load a property as an array, the type of the property defined in the
455
     * {@link DynStruct} must be List.
456
     *
457
     * @param name The name of the property to set
458
     * @param value the value to set
459
     * @throws PersistenceException if there is an error setting the property
460
     * value
461
     */
462
    public void set(String name, Object[] value) throws PersistenceException;
618 463

  
619
	/**
620
	 * <p>
621
	 * Sets a property of type {@link Map}.
622
	 * </p>
623
	 * <p>
624
	 * The values and keys of the map must be persistence supported type
625
	 * instances.
626
	 * </p>
627
	 * <i>{@link #get(String)} return an read only {@link Map} instance after
628
	 * {@link #load(Reader)}</i> </p>
629
	 *
630
	 * @param name
631
	 *            The name of the property to store <i>(must be a valid Java
632
	 *            identifier)</i>
633
	 * @param it
634
	 *            The {@link Map} object to be stored in the state.
635
	 *
636
	 * @throws PersistenceException
637
	 */
638
	public void set(String name, Map value) throws PersistenceException;
464
    /**
465
     * Sets a property of type {@link List} with an array of int. To be able to
466
     * store and load a property as an array, the type of the property defined
467
     * in the {@link DynStruct} must be List.
468
     *
469
     * @param name The name of the property to set
470
     * @param value the value to set
471
     * @throws PersistenceException if there is an error setting the property
472
     * value
473
     */
474
    public void set(String name, int[] value) throws PersistenceException;
639 475

  
640
	/**
641
	 * <p>
642
	 * Sets a property of type {@link Boolean}.
643
	 * </p>
644
	 *
645
	 * @param name
646
	 *            The name of the property to store <i>(must be a valid Java
647
	 *            identifier)</i>
648
	 * @param it
649
	 *            The {@link Boolean} object to be stored in the state.
650
	 *
651
	 * @throws PersistenceException
652
	 */
653
	public void set(String name, Boolean value) throws PersistenceException;
476
    /**
477
     * Sets a property of type {@link List} with an array of long. To be able to
478
     * store and load a property as an array, the type of the property defined
479
     * in the {@link DynStruct} must be List.
480
     *
481
     * @param name The name of the property to set
482
     * @param value the value to set
483
     * @throws PersistenceException if there is an error setting the property
484
     * value
485
     */
486
    public void set(String name, long[] value) throws PersistenceException;
654 487

  
655
	/**
656
	 * <p>
657
	 * Sets a property of type {@link Date}.
658
	 * </p>
659
	 *
660
	 * @param name
661
	 *            The name of the property to store <i>(must be a valid Java
662
	 *            identifier)</i>
663
	 * @param it
664
	 *            The {@link Date} object to be stored in the state.
665
	 *
666
	 * @throws PersistenceException
667
	 */
668
	public void set(String name, Date value) throws PersistenceException;
488
    /**
489
     * Sets a property of type {@link List} with an array of float. To be able
490
     * to store and load a property as an array, the type of the property
491
     * defined in the {@link DynStruct} must be List.
492
     *
493
     * @param name The name of the property to set
494
     * @param value the value to set
495
     * @throws PersistenceException if there is an error setting the property
496
     * value
497
     */
498
    public void set(String name, float[] value) throws PersistenceException;
669 499

  
670
	/**
671
	 * <p>
672
	 * Sets a property of type {@link Integer}.
673
	 * </p>
674
	 *
675
	 * @param name
676
	 *            The name of the property to store <i>(must be a valid Java
677
	 *            identifier)</i>
678
	 * @param it
679
	 *            The {@link Integer} object to be stored in the state.
680
	 *
681
	 * @throws PersistenceException
682
	 */
683
	public void set(String name, Integer value) throws PersistenceException;
500
    /**
501
     * Sets a property of type {@link List} with an array of double. To be able
502
     * to store and load a property as an array, the type of the property
503
     * defined in the {@link DynStruct} must be List.
504
     *
505
     * @param name The name of the property to set
506
     * @param value the value to set
507
     * @throws PersistenceException if there is an error setting the property
508
     * value
509
     */
510
    public void set(String name, double[] value) throws PersistenceException;
684 511

  
685
	/**
686
	 * <p>
687
	 * Sets a property of type {@link Long}.
688
	 * </p>
689
	 *
690
	 * @param name
691
	 *            The name of the property to store <i>(must be a valid Java
692
	 *            identifier)</i>
693
	 * @param it
694
	 *            The {@link Long} object to be stored in the state.
695
	 *
696
	 * @throws PersistenceException
697
	 */
698
	public void set(String name, Long value) throws PersistenceException;
512
    /**
513
     * Sets a property of type {@link List} with an array of Date.
514
     *
515
     * To be able to store and load a property as an array, the type of the
516
     * property defined in the {@link DynStruct} must be List.
517
     *
518
     * @param name
519
     * @param value the Date array to set.
520
     * @throws PersistenceException
521
     */
522
    public void set(String name, Date[] value) throws PersistenceException;
699 523

  
700
	/**
701
	 * <p>
702
	 * Sets a property of type {@link Float}.
703
	 * </p>
704
	 *
705
	 * @param name
706
	 *            The name of the property to store <i>(must be a valid Java
707
	 *            identifier)</i>
708
	 * @param it
709
	 *            The {@link Float} object to be stored in the state.
710
	 *
711
	 * @throws PersistenceException
712
	 */
713
	public void set(String name, Float value) throws PersistenceException;
524
    /**
525
     * Sets a property of type {@link List} with an array of String.
526
     *
527
     * To be able to store and load a property as an array, the type of the
528
     * property defined in the {@link DynStruct} must be List.
529
     *
530
     * @param name
531
     * @param value
532
     * @throws PersistenceException
533
     */
534
    public void set(String name, String[] value) throws PersistenceException;
714 535

  
715
	/**
716
	 * <p>
717
	 * Sets a property of type {@link Double}.
718
	 * </p>
719
	 *
720
	 * @param name
721
	 *            The name of the property to store <i>(must be a valid Java
722
	 *            identifier)</i>
723
	 * @param it
724
	 *            The {@link Double} object to be stored in the state.
725
	 *
726
	 * @throws PersistenceException
727
	 */
728
	public void set(String name, Double value) throws PersistenceException;
536
    /**
537
     * Sets a property of type {@link List} with an array of boolean. To be able
538
     * to store and load a property as an array, the type of the property
539
     * defined in the {@link DynStruct} must be List.
540
     *
541
     * @param name The name of the property to set
542
     * @param value the value to set
543
     * @throws PersistenceException if there is an error setting the property
544
     * value
545
     */
546
    public void set(String name, boolean[] value) throws PersistenceException;
729 547

  
730
	/**
731
	 * <p>
732
	 * Sets a property of type {@link List} (<i>like do
733
	 * {@link #set(String, List)} </i>) filled with the values provided by a
734
	 * {@link Iterator}
735
	 * </p>
736
	 * <p>
737
	 * The items of the iteration must be persistence supported types instance.
738
	 * </p>
739
	 *
740
	 * @param name
741
	 *            The name of the property to store <i>(must be a valid Java
742
	 *            identifier)</i>
743
	 * @param it
744
	 *            The iterator to get values to store in the list property.
745
	 *
746
	 * @throws PersistenceException
747
	 * @see {@link #set(String, List)}
748
	 */
749
	public void set(String name, Iterator it)
750
			throws PersistenceException;
548
    /**
549
     * <p>
550
     * Sets a property of type {@link Set}.
551
     * </p>
552
     * <p>
553
     * The items of the set must be persistence supported type instances.
554
     * </p>
555
     * <p>
556
     * <i>{@link #get(String)} return an read only {@link Set} instance after
557
     * {@link #load(Reader)}</i>
558
     * </p>
559
     *
560
     * @param name The name of the property to store <i>(must be a valid Java
561
     * identifier)</i>
562
     * @param value
563
     *
564
     * @throws PersistenceException
565
     */
566
    public void set(String name, Set value) throws PersistenceException;
751 567

  
568
    /**
569
     * <p>
570
     * Sets a property of type {@link Map}.
571
     * </p>
572
     * <p>
573
     * The values and keys of the map must be persistence supported type
574
     * instances.
575
     * </p>
576
     * <p><i>{@link #get(String)} return an read only {@link Map} instance after
577
     * {@link #load(Reader)}</i> </p>
578
     *
579
     * @param name The name of the property to store <i>(must be a valid Java
580
     * identifier)</i>
581
     * @param value
582
     *
583
     * @throws PersistenceException
584
     */
585
    public void set(String name, Map value) throws PersistenceException;
752 586

  
753
	/**
754
	 * <p>
755
	 * Sets a property.
756
	 * </p>
757
	 * <p>
758
	 * <code>value</value> must be a supported type or manager must have
759
	 *  a {@link PersistenceFactory} that know how persist it.
760
	 * </p>
761
	 * 
762
	 * @param name
763
	 *            The name of the property to store <i>(must be a valid Java
764
	 *            identifier)</i>
765
	 * @param it
766
	 *            The {@link Float} object to be stored in the state.
767
	 * 
768
	 * @throws PersistenceException
769
	 */
770
	public void set(String name, Object value) throws PersistenceException;
587
    /**
588
     * <p>
589
     * Sets a property of type {@link Boolean}.
590
     * </p>
591
     *
592
     * @param name The name of the property to store <i>(must be a valid Java
593
     * identifier)</i>
594
     * @param value
595
     *
596
     * @throws PersistenceException
597
     */
598
    public void set(String name, Boolean value) throws PersistenceException;
771 599

  
772
	public void setNull(String name) throws PersistenceException;
773
	
774
	/**
775
	 * <p>Gets an iterator over the names of the properties contained
776
	 * in this PersistentState.</p>
777
	 *
778
	 * @return An iterator which provides the name of all the
779
	 * properties contained in this state.
780
	 */
781
	public Iterator getNames();
600
    /**
601
     * <p>
602
     * Sets a property of type {@link Date}.
603
     * </p>
604
     *
605
     * @param name The name of the property to store <i>(must be a valid Java
606
     * identifier)</i>
607
     * @param value
608
     *
609
     * @throws PersistenceException
610
     */
611
    public void set(String name, Date value) throws PersistenceException;
782 612

  
613
    /**
614
     * <p>
615
     * Sets a property of type {@link Integer}.
616
     * </p>
617
     *
618
     * @param name The name of the property to store <i>(must be a valid Java
619
     * identifier)</i>
620
     * @param value
621
     *
622
     * @throws PersistenceException
623
     */
624
    public void set(String name, Integer value) throws PersistenceException;
783 625

  
784
	/**
785
	 * Informs that a property is set or not.
786
	 *
787
	 * @param name
788
	 * @return
789
	 */
790
	public boolean hasValue(String name);
791
	
792
	/**
793
	 * Make relatives all files, urls and uris that are in this state
794
	 * from the folder specified.
795
	 * 
796
	 * @param rootFolder
797
	 */
798
	public void relativizeFiles(File rootFolder);
626
    /**
627
     * <p>
628
     * Sets a property of type {@link Long}.
629
     * </p>
630
     *
631
     * @param name The name of the property to store <i>(must be a valid Java
632
     * identifier)</i>
633
     * @param value
634
     *
635
     * @throws PersistenceException
636
     */
637
    public void set(String name, Long value) throws PersistenceException;
799 638

  
800
	/**
801
	 * Make absolutes all files, urls and uris that are in this state
802
	 * from the folder specified.
803
	 * 
804
	 * @param rootFolder
805
	 */
806
	public void derelativizeFiles(File rootFolder);
639
    /**
640
     * <p>
641
     * Sets a property of type {@link Float}.
642
     * </p>
643
     *
644
     * @param name The name of the property to store <i>(must be a valid Java
645
     * identifier)</i>
646
     * @param value
647
     *
648
     * @throws PersistenceException
649
     */
650
    public void set(String name, Float value) throws PersistenceException;
807 651

  
808
}
652
    /**
653
     * <p>
654
     * Sets a property of type {@link Double}.
655
     * </p>
656
     *
657
     * @param name The name of the property to store <i>(must be a valid Java
658
     * identifier)</i>
659
     * @param value
660
     *
661
     * @throws PersistenceException
662
     */
663
    public void set(String name, Double value) throws PersistenceException;
664

  
665
    /**
666
     * <p>
667
     * Sets a property of type {@link List} (<i>like do
668
     * {@link #set(String, List)} </i>) filled with the values provided by a
669
     * {@link Iterator}
670
     * </p>
671
     * <p>
672
     * The items of the iteration must be persistence supported types instance.
673
     * </p>
674
     *
675
     * @param name The name of the property to store <i>(must be a valid Java
676
     * identifier)</i>
677
     * @param it The iterator to get values to store in the list property.
678
     *
679
     * @throws PersistenceException
680
     * @see {@link #set(String, List)}
681
     */
682
    public void set(String name, Iterator it)
683
            throws PersistenceException;
684

  
685
    /**
686
     * <p>
687
     * Sets a property.
688
     * </p>
689
     * <p>
690
     * <code>value</code> must be a supported type or manager must have a
691
     * {@link PersistenceFactory} that know how persist it.
692
     * </p>
693
     *
694
     * @param name The name of the property to store <i>(must be a valid Java
695
     * identifier)</i>
696
     * @param value
697
     *
698
     * @throws PersistenceException
699
     */
700
    public void set(String name, Object value) throws PersistenceException;
701

  
702
    public void setNull(String name) throws PersistenceException;
703

  
704
    /**
705
     * <p>
706
     * Gets an iterator over the names of the properties contained in this
707
     * PersistentState.</p>
708
     *
709
     * @return An iterator which provides the name of all the properties
710
     * contained in this state.
711
     */
712
    public Iterator getNames();
713

  
714
    /**
715
     * Informs that a property is set or not.
716
     *
717
     * @param name
718
     * @return
719
     */
720
    public boolean hasValue(String name);
721

  
722
    /**
723
     * Make relatives all files, urls and uris that are in this state from the
724
     * folder specified.
725
     *
726
     * @param rootFolder
727
     */
728
    public void relativizeFiles(File rootFolder);
729

  
730
    /**
731
     * Make absolutes all files, urls and uris that are in this state from the
732
     * folder specified.
733
     *
734
     * @param rootFolder
735
     */
736
    public void derelativizeFiles(File rootFolder);
737

  
738
}

Also available in: Unified diff