Revision 212 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/dynobject/DynField.java

View differences:

DynField.java
19 19
public interface DynField {
20 20

  
21 21
	/**
22
	 * If the field value can be any possible value, for its type.
22
	 * Return the name of the field.
23 23
	 * 
24
	 * @deprecated now autodetect the mode of use
24
	 * @return name of the field
25 25
	 */
26
	static final int ANY = 1;
26
	public String getName();
27 27

  
28 28
	/**
29
	 * If the field value must be one of a list of posible values.
29
	 * Return the type used in this field. 
30
	 * The values of type is the same of {@link DataTypes}
30 31
	 * 
31
	 * @deprecated usado automaticamente al asignar AvailableValues 
32
	 * @return
32 33
	 */
33
    static final int CHOICE = 2;
34
	public int getType();
34 35

  
35 36
	/**
36
	 * If the field value must pertain to a range of possible values.
37
	 * Return the subtype associated to this field.
38
	 * The subtype is a string used for the cliente of the
39
	 * field.
37 40
	 * 
38
	 * @deprecated usado automaticamente al asignar minValue/maxValue
41
	 * When the field is of type #{@link DataTypes#DYNOBJECT},
42
	 * the subtype are the fullname of the DynClass.
43
	 *  
44
	 * @return the subtype of the field.
39 45
	 */
40
    static final int RANGE = 3;
41

  
42
	String getName();
43

  
44
	int getType();
45

  
46
	String getSubtype();
46
	public String getSubtype();
47 47
	
48
	String getDescription();
48
	/**
49
	 * Return the descripcion associated to this field.
50
	 * 
51
	 * @return the description of the field.
52
	 */
53
	public String getDescription();
49 54

  
50
	Object getDefaultValue();
55
	/**
56
	 * Return the default value used in creation of new objects
57
	 * with this field.
58
	 * 
59
	 * @return defaulr value to use for this field.
60
	 */
61
	public Object getDefaultValue();
51 62

  
52
	boolean isMandatory();
63
	/**
64
	 * Return a string that identify a group for this field.
65
	 * The groups are defined by the client of the field.
66
	 * 
67
	 * @return the group of the field
68
	 */
69
	public String getGroup();
53 70
	
54
	String getGroup();
55
	int getOder();
71
	/**
72
	 * Return the ordinal that identify the order of this field
73
	 * in the {@link DynObject}.
74
	 * 
75
	 * @return the order of field in the {@link DynObject} 
76
	 */
77
	public int getOder();
56 78

  
57 79
	/**
80
	 * Return true if this field is mandatory.
81
	 * 
82
	 */
83
	public boolean isMandatory();
84
	
85
	/**
58 86
	 * Returns if the field is persistent or volatile. The meaning of being
59 87
	 * persistent depends on how is persisted, but any persistence mechanism
60 88
	 * must avoid persisting this field value.
89
	 * 
61 90
	 * @return if the field is to be persisted or not
62 91
	 */
63 92
	boolean isPersistent();
64 93

  
94
	/**
95
	 * Inform if this field can be visible or not for the user.
96
	 * This value don't affect the access through the API.
97
	 *  
98
	 * @return true if the field is hidden for the user.
99
	 */
65 100
	boolean isHidden();
66 101

  
67 102
	/**
68
	 * @deprecated don't use, check minValue/maxValue and getAvailableValues instead 
103
	 * Returns if the field is readOnly or not. The meaning of being
104
	 * readOnly allows to know if the user input to any graphic component associated
105
	 * to this field should be allowed or not.
106
	 * 
107
	 * @return if the graphic component associated to this field should be readOnly or not
69 108
	 */
70
	int getTheTypeOfAvailableValues(); // SINGLE, CHOICE o RANGE
109
	public boolean isReadOnly();
110
	
111
	/**
112
	 * Return true if the value of this field is a container.
113
	 * This method uses the same criteria of the {@link DataType}
114
	 *  
115
	 * @return true if the field type is a container
116
	 */
117
	public boolean isContainer();
71 118

  
72
	DynObjectValueItem[] getAvailableValues();
119
	/**
120
	 * Return the available values for this field.
121
	 * When assign a value to the field, this value need that
122
	 * exists in this list.
123
	 * 
124
	 * @return an array of the available values for the field.
125
	 */
126
	public DynObjectValueItem[] getAvailableValues();
73 127

  
74
	Object getMinValue();
128
	public Object getMinValue();
75 129

  
76
	Object getMaxValue();
130
	public Object getMaxValue();
77 131

  
132
	/**
133
	 * Return the java class of the value of the field.
134
	 * 
135
	 * @return the class of the value
136
	 */
78 137
	Class getClassOfValue();
79 138

  
139
	/**
140
	 * If the field is a container (List, Map or Set) return
141
	 * the java class of its items.
142
	 * 
143
	 * @return the class of the items
144
	 */
145
	Class getClassOfItems();
146

  
147
	
148
	
149
	
150
	
151
	
152
	
153
	
154
	
155
	/**
156
	 * Sets the description asociated to this field.
157
	 * 
158
	 * @param description
159
	 * 
160
	 * @return this same {@link DynField} object
161
	 */
80 162
	DynField setDescription(String description);
81 163

  
164
	/**
165
	 * Sets the type of the field.
166
	 * The values used are the specified in {@link DataTypes}.
167
	 * 
168
	 * This method assign the default values of the type for
169
	 * "ClassOfValue" and "subType". 
170
	 * 
171
	 * @param type
172
	 * 
173
	 * @return this same {@link DynField} object
174
	 */
82 175
	DynField setType(int type);
83 176

  
84 177
	/**
85
	 * Cuando el tipo sea  #{@link DataTypes#DYNOBJECT}, el
86
	 * subtype sera el fullname de la DynStruct.
178
	 * Strings used as subtype for this field.
179
	 * This value is used by the client of the object.
180
	 * 
181
	 * When the field is a #{@link DataTypes#DYNOBJECT},
182
	 * the subtype is the fullname of the DynStruct.
87 183
	 *  
88 184
	 * @param subtype
89
	 * @return
185
	 * 
186
	 * @return this same {@link DynField} object
90 187
	 */
91 188
	DynField setSubtype(String subtype);
92
	
93
	DynField setDefaultDynValue(Object defaultValue);
94 189

  
95
	DynField setMandatory(boolean mandatory);
190
	/**
191
	 * Set the default value used for this field when a new
192
	 * object with this field is created.
193
	 *  
194
	 * @param defaultValue
195
	 * 
196
	 * @return this same {@link DynField} object
197
	 */
198
	DynField setDefaultValue(Object defaultValue);
96 199

  
97 200
	DynField setGroup(String groupName);
98 201

  
202
	DynField setOrder(int order);
203

  
204
	DynField setMandatory(boolean mandatory);
205

  
99 206
	DynField setHidden(boolean hidden);
100 207

  
101
	DynField setOrder(int order);
102 208
	/**
103 209
	 * Sets if the field must be persisted or not.
104 210
	 * @see #isPersistent()
......
107 213
	 */
108 214
	DynField setPersistent(boolean persistent);
109 215

  
110
	/**
111
	 * @deprecated don't use, set minValue/maxValue and availableValues instead 
112
	 */
113
	DynField setTheTypeOfAvailableValues(int type);
114

  
115 216
	DynField setAvailableValues(DynObjectValueItem[] values);
116 217

  
117 218
	DynField setAvailableValues(List values);
......
121 222
	DynField setMaxValue(Object maxValue);
122 223
	
123 224
	/**
124
	 * When a field is type object, this is the class of the object.
125
	 * If field type is List, Set or Map, this class is the class of items.
225
	 * Sets the class used for the values of the field.
226
	 *  
227
	 * @param theClass
126 228
	 * 
127
	 * @param theClass
128 229
	 * @return this same {@link DynField} object
230
	 * 
129 231
	 * @throws DynFieldIsNotAContainerException
130 232
	 */
131 233
	DynField setClassOfValue(Class theClass) throws DynFieldIsNotAContainerException;
132 234
	
133 235
	/**
134
	 * Validate that the value match the properties of the field.
236
	 * If field type is List, Set or Map, this class is the class of items.
135 237
	 * 
136
	 * @param value
137
	 * @throws DynFieldValidateException
238
	 * @param theClass
239
	 * 
240
	 * @return this same {@link DynField} object
241
	 * 
242
	 * @throws DynFieldIsNotAContainerException
138 243
	 */
139
	void validate(Object value) throws DynFieldValidateException;
140

  
244
	DynField setClassOfItems(Class theClass) throws DynFieldIsNotAContainerException;
245
	
141 246
	/**
142
	 * Force the type of value to the type of the field.
143
	 * 
144
	 * @param value
145
	 * @return new value
146
	 * @throws CoercionException 
247
	 * Sets if the field is readOnly or not. The meaning of being
248
	 * readOnly allows to know if the user input to any graphic component associated
249
	 * to this field should be allowed or not.
250
	 * @param isReadOnly
251
	 *    if the graphic component associated to this field should be readOnly or not
252
	 *    
253
	 * @return DynField that define the type of elements.
147 254
	 */
148
	Object coerce(Object value) throws CoercionException;
255
	public DynField setReadOnly(boolean isReadOnly);	
256

  
257

  
149 258
	
259
	
260
	
261
	
262
	
150 263
	/**
151 264
	 * When a field is of type container, this method return a DynClass
152 265
	 * that define the type of elements. 
......
184 297
	 */
185 298
	public DynField setElementsType(DynStruct type) throws DynFieldIsNotAContainerException ;
186 299

  
300
	
301
	
187 302
	/**
188
	 * Returns if the field is readOnly or not. The meaning of being
189
	 * readOnly allows to know if the user input to any graphic component associated
190
	 * to this field should be allowed or not.
191
	 * @return if the graphic component associated to this field should be readOnly or not
303
	 * Validate that the value match the properties of the field.
304
	 * 
305
	 * @param value
306
	 * @throws DynFieldValidateException
192 307
	 */
193
	public boolean isReadOnly();
194
	
308
	void validate(Object value) throws DynFieldValidateException;
309

  
195 310
	/**
196
	 * Sets if the field is readOnly or not. The meaning of being
197
	 * readOnly allows to know if the user input to any graphic component associated
198
	 * to this field should be allowed or not.
199
	 * @param isReadOnly
200
	 *    if the graphic component associated to this field should be readOnly or not
201
	 *    
202
	 * @return DynField that define the type of elements.
311
	 * Force the type of value to the type of the field.
312
	 * 
313
	 * @param value
314
	 * @return new value
315
	 * @throws CoercionException 
203 316
	 */
204
	public DynField setReadOnly(boolean isReadOnly);	
205
	
206
	
207
	public boolean isContainer();
317
	Object coerce(Object value) throws CoercionException;
318
		
319
	/**
320
	 * If the field value can be any possible value, for its type.
321
	 * 
322
	 * @deprecated now autodetect the mode of use
323
	 */
324
	static final int ANY = 1;
325

  
326
	/**
327
	 * If the field value must be one of a list of posible values.
328
	 * 
329
	 * @deprecated usado automaticamente al asignar AvailableValues 
330
	 */
331
    static final int CHOICE = 2;
332

  
333
	/**
334
	 * If the field value must pertain to a range of possible values.
335
	 * 
336
	 * @deprecated usado automaticamente al asignar minValue/maxValue
337
	 */
338
    static final int RANGE = 3;
339

  
340
	/**
341
	 * @deprecated don't use, check minValue/maxValue and getAvailableValues instead 
342
	 */
343
	int getTheTypeOfAvailableValues(); // SINGLE, CHOICE o RANGE
344

  
345
	/**
346
	 * @deprecated use instead {@link #setDefaultValue(Object)} 
347
	 */
348
	DynField setDefaultDynValue(Object defaultValue);
349

  
350
	/**
351
	 * @deprecated don't use, set minValue/maxValue and availableValues instead 
352
	 */
353
	DynField setTheTypeOfAvailableValues(int type);
354

  
208 355
}

Also available in: Unified diff