Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.api / src / main / java / org / gvsig / fmap / dal / feature / FeatureAttributeDescriptor.java @ 45739

History | View | Annotate | Download (10.9 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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 3
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.fmap.dal.feature;
25

    
26
import java.math.MathContext;
27
import java.text.DateFormat;
28
import java.util.Locale;
29

    
30
import org.cresques.cts.IProjection;
31
import org.gvsig.expressionevaluator.Expression;
32

    
33
import org.gvsig.fmap.dal.DataTypes;
34
import org.gvsig.fmap.geom.Geometry;
35
import org.gvsig.fmap.geom.type.GeometryType;
36
import org.gvsig.timesupport.Interval;
37
import org.gvsig.tools.dataTypes.Coercion;
38
import org.gvsig.tools.dynobject.DynField_v2;
39
import org.gvsig.tools.evaluator.Evaluator;
40
import org.gvsig.tools.util.LabeledValue;
41
import org.gvsig.tools.dataTypes.CoercionContext;
42
import org.gvsig.tools.persistence.Persistent;
43
import org.gvsig.json.SupportToJson;
44

    
45
/**
46
 * A feature attribute descriptor contains information about one of the
47
 * attributes in a feature, such as its name, data type or precision.
48
 *
49
 * @author gvSIG team
50
 * @version $Id$
51
 */
52
public interface FeatureAttributeDescriptor
53
        extends DynField_v2, LabeledValue<FeatureAttributeDescriptor>, Persistent, SupportToJson {
54

    
55
  /**
56
   * Returns a clone of this attribute descriptor
57
   *
58
   * @return FeatureAttributeDescriptor A new copy of this
59
   */
60
  public FeatureAttributeDescriptor getCopy();
61

    
62
  /**
63
   * Returns the name of this attribute's data type.
64
   *
65
   * @return a string containing the name of this attribute's data type.
66
   */
67
  public String getDataTypeName();
68

    
69
  public String getDataProfileName();
70

    
71
  public DataProfile getDataProfile();
72

    
73
  /**
74
   * Returns a number that indicates the size of this attribute. See the
75
   * documentation for the various constants of {@link DataTypes} for how to
76
   * interpret this value. As an example, when the data type is
77
   * {@link DataTypes#STRING}, this value indicates the maximum length of the
78
   * string.
79
   *
80
   * @return an <code>int</code> indicating the size of the attribute.
81
   */
82
  public int getSize();
83
  
84
  /**
85
   * Return the designated column normal maximum width in characters.
86
   * 
87
   * @return 
88
   */
89
  public int getDisplaySize();
90

    
91
  /**
92
   * For attributes of type {@link DataTypes#DECIMAL}, this returns the maximum
93
   * number of digits. For other types, this must always return zero.
94
   *
95
   * @return
96
   */
97
  public int getPrecision();
98

    
99
  /**
100
   * For attributes of type {@link DataTypes#DECIMAL}, this returns the maximum
101
   * number of digits after the decimal point. For other types, this must always
102
   * return zero.
103
   *
104
   * @return
105
   */
106
  public int getScale();
107

    
108
  /**
109
   * For attributes of type {@link DataTypes#DECIMAL}, this returns the
110
   * MathContext associated to this. For other types return
111
   * {@link MathContext#UNLIMITED}.
112
   *
113
   * @return
114
   */
115
  public MathContext getMathContext();
116

    
117
  /**
118
   * Return a CoercionContext for this attribute.
119
   *
120
   * @return the CoercionContext
121
   */
122
  public CoercionContext getCoercionContext();
123

    
124
  /**
125
   * Return a Coercion to convert a value to the type of this attribute.
126
   *
127
   * @return the Coercion.
128
   */
129
  public Coercion getCoercion();
130

    
131
  /**
132
   * Returns the rounding mode to use when a value is converted to the
133
   * attribute's data type. It will only be used for Float, Double and Decimal
134
   * data types.
135
   *
136
   * @return
137
   */
138
  public int getRoundMode();
139

    
140
  /**
141
   * Returns the Locale associated with this attribute. It is usually used to
142
   * format and recognize dates and decimal numbers. The default Locale will be
143
   * <code>Locale. ENGLISH</code>
144
   *
145
   * @return
146
   */
147
  public Locale getLocale();
148

    
149
  /**
150
   * For attributes of type {@link DataTypes#OBJECT}, this returns the Java
151
   * {@link Class} object that class or interface that all values of this
152
   * attribute can be cast to.
153
   *
154
   * @return
155
   */
156
  public Class getObjectClass();
157

    
158
  /**
159
   * Returns the minimum number of occurrences of this attribute on a given
160
   * feature. The vast majority of data sources and data consumers will only
161
   * function with this value being zero or one. If the minimum number of
162
   * occurrences is zero, this is equivalent, in SQL terms, to the attribute
163
   * being nillable.
164
   *
165
   * @return
166
   */
167
  public int getMinimumOccurrences();
168

    
169
  /**
170
   * Returns the maximum number of occurrences of this attribute on a given
171
   * feature.The vast majority of data sources and data consumers will only
172
   * function with this value being one. A value of {@link Integer#MAX_VALUE}
173
   * indicates that the maximum number of occurrences is unbounded.
174
   *
175
   * @return
176
   */
177
  public int getMaximumOccurrences();
178

    
179
  /**
180
   * Returns {@code true} if this attribute forms all or part of the unique
181
   * identifying value for the feature it is contained by. The primary key
182
   * attributes uniquely identify this feature from other features of the same
183
   * type. This is different from the {@linkplain Feature#getReference()}, which
184
   * must uniquely identify the {@link Feature} among all feature types.
185
   *
186
   * @return
187
   */
188
  public boolean isPrimaryKey();
189

    
190
  /**
191
   * Indicates whether this attribute accepts null values.
192
   *
193
   * @return true if this attribute can be null, false if not.
194
   */
195
  public boolean allowNull();
196

    
197
  /**
198
   * Returns an evaluator that will be used to calculate the value of this
199
   * attribute
200
   * @return 
201
   */
202
  public Evaluator getEvaluator();
203

    
204
  /**
205
   * If this attribute is a {@link Geometry}, this method returns its Spatial
206
   * Reference System.
207
   *
208
   * @return the SRS if this attribute is a {@link Geometry}, otherwise this
209
   * method returns null.
210
   */
211
  public IProjection getSRS();
212

    
213
  /**
214
   * If this attribute is a {@link Geometry}, this method returns the specific
215
   * geometry type, as defined in {@link Geometry.TYPES}.
216
   *
217
   * @return One of {@link Geometry.TYPES}
218
   * @deprecated use {@link #getGeomType()} instead. To be removed in gvSIG 2.1.
219
   */
220
  public int getGeometryType();
221

    
222
  /**
223
   * If this attribute is a {@link Geometry}, this method returns the specific
224
   * geometry subtype, as defined in {@link Geometry.SUBTYPES}.
225
   *
226
   * @return One of {@link Geometry.SUBTYPES}
227
   * @deprecated use {@link #getGeomType()} instead. To be removed in gvSIG 2.1.
228
   */
229
  public int getGeometrySubType();
230

    
231
  /**
232
   * Returns the {@link GeometryType} of the attribute if it is a geometry.
233
   *
234
   * @return the geometry type
235
   */
236
  public GeometryType getGeomType();
237

    
238
  /**
239
   * If this attribute is of type Date, then this method returns the date format
240
   * set by the data store.
241
   *
242
   * @return a date format
243
   */
244
  public DateFormat getDateFormat();
245

    
246
  /**
247
   * Return the default value coerced to the data type of attribute. Return null
248
   * if can't coerce.
249
   *
250
   * @return default value or null.
251
   */
252
  public Object getDefaultValueCoerced();
253

    
254
  /**
255
   * Returns this attribute relative position within the {@link Feature}.
256
   *
257
   * @return an index
258
   */
259
  public int getIndex();
260

    
261
  /**
262
   * Returns additional information of the attribute
263
   *
264
   * @param infoName
265
   * @return info
266
   *
267
   */
268
  public String getAdditionalInfo(String infoName);
269

    
270
  /**
271
   * Returns if value is created automatically by the source
272
   * @return 
273
   */
274
  public boolean isAutomatic();
275

    
276
  /**
277
   * Gets if the attribute is a temporal attribute.
278
   *
279
   * @return <code>true</code> if is a temporal attribute
280
   */
281
  public boolean isTime();
282

    
283
  public Interval getInterval();
284

    
285
  /**
286
   * Return true if the attribute has and index in the table.
287
   *
288
   * @return true if indexed.
289
   */
290
  public boolean isIndexed();
291

    
292
  public boolean allowIndexDuplicateds();
293

    
294
  public boolean isIndexAscending();
295

    
296
  public boolean isForeingKey();
297

    
298
  public ForeingKey getForeingKey();
299

    
300
  /**
301
   * Gets if the attribute has a {@link FeatureAttributeGetter}.
302
   *
303
   * @return a FeatureAttributeGetter or null.
304
   * @deprecated use getFeatureAttributeGetterAndSetter
305
   */
306
  public FeatureAttributeGetter getFeatureAttributeGetter();
307

    
308
  /**
309
   * Sets the {@link FeatureAttributeGetter} that is used to update the
310
   * presentation of a field.
311
   *
312
   * @param featureAttributeGetter the {@link FeatureAttributeGetter} to set.
313
   * @deprecated use setFeatureAttributeGetterAndSetter
314
   */
315
  public void setFeatureAttributeGetter(FeatureAttributeGetter featureAttributeGetter);
316

    
317
  /**
318
   * Gets the attribute emulator associatted {@link FeatureAttributeEmulator} to
319
   * this attribute.
320
   *
321
   * @return a FeatureAttributeEmulator or null.
322
   */
323
  public FeatureAttributeEmulator getFeatureAttributeEmulator();
324

    
325
  /**
326
   * Return true if the attribute has an evaluator o an emulator.
327
   *
328
   * @return
329
   */
330
  public boolean isComputed();
331

    
332
  /**
333
   * Return the store associated to this attribute descriptor.
334
   *
335
   * @return the FeatureStore of the attribute descriptor.
336
   */
337
  public FeatureStore getStore();
338

    
339
  public FeatureType getFeatureType();
340

    
341
  public String[] getRequiredFieldNames();
342

    
343
  public void recentUsed();
344

    
345
  @Override
346
  public String getLocalizedShortLabel();
347

    
348
  @Override
349
  public String getLocalizedLabel();
350

    
351
  public String getLabelOfValue(Object value);
352

    
353
  public boolean hasOnlyMetadataChanges(FeatureAttributeDescriptor other);
354

    
355
  public boolean hasLabel();
356

    
357
  public boolean hasShortLabel();
358

    
359
  public boolean hasDescription();
360

    
361
  /**
362
   * Retrieve the value of the attribute "name".
363
   * 
364
   * @param name
365
   * @return 
366
   */
367
  public Object get(String name);
368

    
369
  public boolean hasConstantAvailableValues();
370
  
371
  public boolean isAvoidCachingAvailableValues();
372
  
373
  public Expression getAvailableValuesExpression();
374
  
375
  public FeatureAttributeDescriptor setAvailableValuesExpression(String expression);
376

    
377
  public FeatureAttributeDescriptor setAvailableValuesExpression(Expression expression);
378

    
379
  public boolean isInAvailableValues(Object valueToCheck);
380
  
381
  public boolean hasAvailableValues();
382

    
383
  public Expression getAvailableValuesFilter();
384

    
385
}