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

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

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

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

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

    
66
  public String getDataProfileName();
67

    
68
  public DataProfile getDataProfile();
69

    
70
  /**
71
   * Returns a number that indicates the size of this attribute. See the
72
   * documentation for the various constants of {@link DataTypes} for how to
73
   * interpret this value. As an example, when the data type is
74
   * {@link DataTypes#STRING}, this value indicates the maximum length of the
75
   * string.
76
   *
77
   * @return an <code>int</code> indicating the size of the attribute.
78
   */
79
  public int getSize();
80

    
81
  /**
82
   * For attributes of type {@link DataTypes#DECIMAL}, this returns the maximum
83
   * number of digits. For other types, this must always return zero.
84
   *
85
   * @return
86
   */
87
  public int getPrecision();
88

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

    
98
  /**
99
   * For attributes of type {@link DataTypes#DECIMAL}, this returns the
100
   * MathContext associated to this. For other types return
101
   * {@link MathContext#UNLIMITED}.
102
   *
103
   * @return
104
   */
105
  public MathContext getMathContext();
106

    
107
  /**
108
   * Return a CoercionContext for this attribute.
109
   *
110
   * @return the CoercionContext
111
   */
112
  public CoercionContext getCoercionContext();
113

    
114
  /**
115
   * Return a Coercion to convert a value to the type of this attribute.
116
   *
117
   * @return the Coercion.
118
   */
119
  public Coercion getCoercion();
120

    
121
  /**
122
   * Returns the rounding mode to use when a value is converted to the
123
   * attribute's data type. It will only be used for Float, Double and Decimal
124
   * data types.
125
   *
126
   * @return
127
   */
128
  public int getRoundMode();
129

    
130
  /**
131
   * Returns the Locale associated with this attribute. It is usually used to
132
   * format and recognize dates and decimal numbers. The default Locale will be
133
   * <code>Locale. ENGLISH</code>
134
   *
135
   * @return
136
   */
137
  public Locale getLocale();
138

    
139
  /**
140
   * For attributes of type {@link DataTypes#OBJECT}, this returns the Java
141
   * {@link Class} object that class or interface that all values of this
142
   * attribute can be cast to.
143
   *
144
   * @return
145
   */
146
  public Class getObjectClass();
147

    
148
  /**
149
   * Returns the minimum number of occurrences of this attribute on a given
150
   * feature. The vast majority of data sources and data consumers will only
151
   * function with this value being zero or one. If the minimum number of
152
   * occurrences is zero, this is equivalent, in SQL terms, to the attribute
153
   * being nillable.
154
   *
155
   * @return
156
   */
157
  public int getMinimumOccurrences();
158

    
159
  /**
160
   * Returns the maximum number of occurrences of this attribute on a given
161
   * feature.The vast majority of data sources and data consumers will only
162
   * function with this value being one. A value of {@link Integer#MAX_VALUE}
163
   * indicates that the maximum number of occurrences is unbounded.
164
   *
165
   * @return
166
   */
167
  public int getMaximumOccurrences();
168

    
169
  /**
170
   * Returns {@code true} if this attribute forms all or part of the unique
171
   * identifying value for the feature it is contained by. The primary key
172
   * attributes uniquely identify this feature from other features of the same
173
   * type. This is different from the {@linkplain Feature#getReference()}, which
174
   * must uniquely identify the {@link Feature} among all feature types.
175
   *
176
   * @return
177
   */
178
  public boolean isPrimaryKey();
179

    
180
  /**
181
   * Indicates whether this attribute accepts null values.
182
   *
183
   * @return true if this attribute can be null, false if not.
184
   */
185
  public boolean allowNull();
186

    
187
  /**
188
   * Returns an evaluator that will be used to calculate the value of this
189
   * attribute
190
   * @return 
191
   */
192
  public Evaluator getEvaluator();
193

    
194
  /**
195
   * If this attribute is a {@link Geometry}, this method returns its Spatial
196
   * Reference System.
197
   *
198
   * @return the SRS if this attribute is a {@link Geometry}, otherwise this
199
   * method returns null.
200
   */
201
  public IProjection getSRS();
202

    
203
  /**
204
   * If this attribute is a {@link Geometry}, this method returns the specific
205
   * geometry type, as defined in {@link Geometry.TYPES}.
206
   *
207
   * @return One of {@link Geometry.TYPES}
208
   * @deprecated use {@link #getGeomType()} instead. To be removed in gvSIG 2.1.
209
   */
210
  public int getGeometryType();
211

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

    
221
  /**
222
   * Returns the {@link GeometryType} of the attribute if it is a geometry.
223
   *
224
   * @return the geometry type
225
   */
226
  public GeometryType getGeomType();
227

    
228
  /**
229
   * If this attribute is of type Date, then this method returns the date format
230
   * set by the data store.
231
   *
232
   * @return a date format
233
   */
234
  public DateFormat getDateFormat();
235

    
236
  /**
237
   * Return the default value coerced to the data type of attribute. Return null
238
   * if can't coerce.
239
   *
240
   * @return default value or null.
241
   */
242
  public Object getDefaultValueCoerced();
243

    
244
  /**
245
   * Returns this attribute relative position within the {@link Feature}.
246
   *
247
   * @return an index
248
   */
249
  public int getIndex();
250

    
251
  /**
252
   * Returns additional information of the attribute
253
   *
254
   * @param infoName
255
   * @return info
256
   *
257
   */
258
  public Object getAdditionalInfo(String infoName);
259

    
260
  /**
261
   * Returns if value is created automatically by the source
262
   * @return 
263
   */
264
  public boolean isAutomatic();
265

    
266
  /**
267
   * Gets if the attribute is a temporal attribute.
268
   *
269
   * @return <code>true</code> if is a temporal attribute
270
   */
271
  public boolean isTime();
272

    
273
  public Interval getInterval();
274

    
275
  /**
276
   * Return true if the attribute has and index in the table.
277
   *
278
   * @return true if indexed.
279
   */
280
  public boolean isIndexed();
281

    
282
  public boolean allowIndexDuplicateds();
283

    
284
  public boolean isIndexAscending();
285

    
286
  public boolean isForeingKey();
287

    
288
  public ForeingKey getForeingKey();
289

    
290
  /**
291
   * Gets if the attribute has a {@link FeatureAttributeGetter}.
292
   *
293
   * @return a FeatureAttributeGetter or null.
294
   * @deprecated use getFeatureAttributeGetterAndSetter
295
   */
296
  public FeatureAttributeGetter getFeatureAttributeGetter();
297

    
298
  /**
299
   * Sets the {@link FeatureAttributeGetter} that is used to update the
300
   * presentation of a field.
301
   *
302
   * @param featureAttributeGetter the {@link FeatureAttributeGetter} to set.
303
   * @deprecated use setFeatureAttributeGetterAndSetter
304
   */
305
  public void setFeatureAttributeGetter(FeatureAttributeGetter featureAttributeGetter);
306

    
307
  /**
308
   * Gets the attribute emulator associatted {@link FeatureAttributeEmulator} to
309
   * this attribute.
310
   *
311
   * @return a FeatureAttributeEmulator or null.
312
   */
313
  public FeatureAttributeEmulator getFeatureAttributeEmulator();
314

    
315
  /**
316
   * Return true if the attribute has an evaluator o an emulator.
317
   *
318
   * @return
319
   */
320
  public boolean isComputed();
321

    
322
  /**
323
   * Return the store associated to this attribute descriptor.
324
   *
325
   * @return the FeatureStore of the attribute descriptor.
326
   */
327
  public FeatureStore getStore();
328

    
329
  public FeatureType getFeatureType();
330

    
331
  public String[] getRequiredFieldNames();
332

    
333
  public void recentUsed();
334

    
335
  @Override
336
  public String getLocalizedShortLabel();
337

    
338
  @Override
339
  public String getLocalizedLabel();
340

    
341
  public String getLabelOfValue(Object value);
342

    
343
  public boolean hasOnlyMetadataChanges(FeatureAttributeDescriptor other);
344

    
345
  public boolean hasLabel();
346

    
347
  public boolean hasShortLabel();
348

    
349
  public boolean hasDescription();
350

    
351
  /**
352
   * Retrieve the value of the attribute "name".
353
   * 
354
   * @param name
355
   * @return 
356
   */
357
  public Object get(String name);
358

    
359
  public boolean hasConstantAvailableValues();
360
}