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

History | View | Annotate | Download (10.2 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
   * For attributes of type {@link DataTypes#DECIMAL}, this returns the maximum
84
   * number of digits. For other types, this must always return zero.
85
   *
86
   * @return
87
   */
88
  public int getPrecision();
89

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
274
  public Interval getInterval();
275

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

    
283
  public boolean allowIndexDuplicateds();
284

    
285
  public boolean isIndexAscending();
286

    
287
  public boolean isForeingKey();
288

    
289
  public ForeingKey getForeingKey();
290

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

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

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

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

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

    
330
  public FeatureType getFeatureType();
331

    
332
  public String[] getRequiredFieldNames();
333

    
334
  public void recentUsed();
335

    
336
  @Override
337
  public String getLocalizedShortLabel();
338

    
339
  @Override
340
  public String getLocalizedLabel();
341

    
342
  public String getLabelOfValue(Object value);
343

    
344
  public boolean hasOnlyMetadataChanges(FeatureAttributeDescriptor other);
345

    
346
  public boolean hasLabel();
347

    
348
  public boolean hasShortLabel();
349

    
350
  public boolean hasDescription();
351

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

    
360
  public boolean hasConstantAvailableValues();
361
}