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 40559 jjdelcerro
/**
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 40435 jjdelcerro
package org.gvsig.fmap.dal.feature;
25
26 44669 jjdelcerro
import java.math.MathContext;
27 40435 jjdelcerro
import java.text.DateFormat;
28 44673 jjdelcerro
import java.util.Locale;
29 40435 jjdelcerro
30
import org.cresques.cts.IProjection;
31 45014 jjdelcerro
import org.gvsig.expressionevaluator.Expression;
32 40435 jjdelcerro
33
import org.gvsig.fmap.dal.DataTypes;
34
import org.gvsig.fmap.geom.Geometry;
35
import org.gvsig.fmap.geom.type.GeometryType;
36 44077 jjdelcerro
import org.gvsig.timesupport.Interval;
37 44669 jjdelcerro
import org.gvsig.tools.dataTypes.Coercion;
38 44202 jjdelcerro
import org.gvsig.tools.dynobject.DynField_v2;
39 40435 jjdelcerro
import org.gvsig.tools.evaluator.Evaluator;
40 44644 jjdelcerro
import org.gvsig.tools.util.LabeledValue;
41 44669 jjdelcerro
import org.gvsig.tools.dataTypes.CoercionContext;
42 44829 omartinez
import org.gvsig.tools.persistence.Persistent;
43 45425 jjdelcerro
import org.gvsig.json.SupportToJson;
44 40435 jjdelcerro
45
/**
46 44673 jjdelcerro
 * 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 40435 jjdelcerro
 * @author gvSIG team
50
 * @version $Id$
51
 */
52 44673 jjdelcerro
public interface FeatureAttributeDescriptor
53 45425 jjdelcerro
        extends DynField_v2, LabeledValue<FeatureAttributeDescriptor>, Persistent, SupportToJson {
54 40435 jjdelcerro
55 44673 jjdelcerro
  /**
56
   * Returns a clone of this attribute descriptor
57
   *
58
   * @return FeatureAttributeDescriptor A new copy of this
59
   */
60
  public FeatureAttributeDescriptor getCopy();
61 44669 jjdelcerro
62 44673 jjdelcerro
  /**
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 44669 jjdelcerro
69 44673 jjdelcerro
  public String getDataProfileName();
70 44669 jjdelcerro
71 44673 jjdelcerro
  public DataProfile getDataProfile();
72 44669 jjdelcerro
73 44673 jjdelcerro
  /**
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 44844 jjdelcerro
84
  /**
85 44947 jjdelcerro
   * Return the designated column normal maximum width in characters.
86 44844 jjdelcerro
   *
87
   * @return
88
   */
89 44947 jjdelcerro
  public int getDisplaySize();
90 40435 jjdelcerro
91 44673 jjdelcerro
  /**
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 40435 jjdelcerro
99 44673 jjdelcerro
  /**
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 44669 jjdelcerro
108
  /**
109 44673 jjdelcerro
   * 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 44669 jjdelcerro
  public MathContext getMathContext();
116 44673 jjdelcerro
117
  /**
118
   * Return a CoercionContext for this attribute.
119
   *
120 44669 jjdelcerro
   * @return the CoercionContext
121 44673 jjdelcerro
   */
122 44669 jjdelcerro
  public CoercionContext getCoercionContext();
123 44673 jjdelcerro
124 44669 jjdelcerro
  /**
125
   * Return a Coercion to convert a value to the type of this attribute.
126 44673 jjdelcerro
   *
127 44669 jjdelcerro
   * @return the Coercion.
128
   */
129
  public Coercion getCoercion();
130 40435 jjdelcerro
131 44673 jjdelcerro
  /**
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 40435 jjdelcerro
140 44673 jjdelcerro
  /**
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 40435 jjdelcerro
149 44673 jjdelcerro
  /**
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 40435 jjdelcerro
158 44673 jjdelcerro
  /**
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 40435 jjdelcerro
169 44673 jjdelcerro
  /**
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 40435 jjdelcerro
179 44673 jjdelcerro
  /**
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 40435 jjdelcerro
190 44673 jjdelcerro
  /**
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 40435 jjdelcerro
197 44673 jjdelcerro
  /**
198
   * Returns an evaluator that will be used to calculate the value of this
199
   * attribute
200 44740 jjdelcerro
   * @return
201 44673 jjdelcerro
   */
202
  public Evaluator getEvaluator();
203 40435 jjdelcerro
204 44673 jjdelcerro
  /**
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 40435 jjdelcerro
213 44673 jjdelcerro
  /**
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 40435 jjdelcerro
222 44673 jjdelcerro
  /**
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 44669 jjdelcerro
231 44673 jjdelcerro
  /**
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 40435 jjdelcerro
238 44673 jjdelcerro
  /**
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 40435 jjdelcerro
246 44673 jjdelcerro
  /**
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 40435 jjdelcerro
254 44673 jjdelcerro
  /**
255
   * Returns this attribute relative position within the {@link Feature}.
256
   *
257
   * @return an index
258
   */
259
  public int getIndex();
260 40435 jjdelcerro
261 44673 jjdelcerro
  /**
262
   * Returns additional information of the attribute
263
   *
264 44740 jjdelcerro
   * @param infoName
265 44673 jjdelcerro
   * @return info
266
   *
267
   */
268 45154 jjdelcerro
  public String getAdditionalInfo(String infoName);
269 41335 jjdelcerro
270 44673 jjdelcerro
  /**
271
   * Returns if value is created automatically by the source
272 44740 jjdelcerro
   * @return
273 44673 jjdelcerro
   */
274
  public boolean isAutomatic();
275 44338 jjdelcerro
276 44673 jjdelcerro
  /**
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 44346 jjdelcerro
283 44673 jjdelcerro
  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 44719 jjdelcerro
369
  public boolean hasConstantAvailableValues();
370 45014 jjdelcerro
371 45135 jjdelcerro
  public boolean isAvoidCachingAvailableValues();
372
373 45014 jjdelcerro
  public Expression getAvailableValuesExpression();
374
375
  public FeatureAttributeDescriptor setAvailableValuesExpression(String expression);
376
377
  public FeatureAttributeDescriptor setAvailableValuesExpression(Expression expression);
378
379 45258 omartinez
  public boolean isInAvailableValues(Object valueToCheck);
380
381 45260 omartinez
  public boolean hasAvailableValues();
382
383 45739 jjdelcerro
  public Expression getAvailableValuesFilter();
384
385 40435 jjdelcerro
}