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 @ 44947

History | View | Annotate | Download (10.3 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

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

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

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

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

    
67
  public String getDataProfileName();
68

    
69
  public DataProfile getDataProfile();
70

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
281
  public Interval getInterval();
282

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

    
290
  public boolean allowIndexDuplicateds();
291

    
292
  public boolean isIndexAscending();
293

    
294
  public boolean isForeingKey();
295

    
296
  public ForeingKey getForeingKey();
297

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

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

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

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

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

    
337
  public FeatureType getFeatureType();
338

    
339
  public String[] getRequiredFieldNames();
340

    
341
  public void recentUsed();
342

    
343
  @Override
344
  public String getLocalizedShortLabel();
345

    
346
  @Override
347
  public String getLocalizedLabel();
348

    
349
  public String getLabelOfValue(Object value);
350

    
351
  public boolean hasOnlyMetadataChanges(FeatureAttributeDescriptor other);
352

    
353
  public boolean hasLabel();
354

    
355
  public boolean hasShortLabel();
356

    
357
  public boolean hasDescription();
358

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

    
367
  public boolean hasConstantAvailableValues();
368
}