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

History | View | Annotate | Download (8.67 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.text.DateFormat;
27

    
28
import org.cresques.cts.IProjection;
29

    
30
import org.gvsig.fmap.dal.DataTypes;
31
import org.gvsig.fmap.geom.Geometry;
32
import org.gvsig.fmap.geom.type.GeometryType;
33
import org.gvsig.timesupport.Interval;
34
import org.gvsig.tools.dynobject.DynField_v2;
35
import org.gvsig.tools.evaluator.Evaluator;
36
import org.gvsig.tools.util.LabeledValue;
37

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

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

    
58
        /**
59
         * Returns the name of this attribute's data type.
60
         *
61
         * @return
62
         *                 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}
73
         * for how to interpret this value. As an example, when the data type is
74
         * {@link DataTypes#STRING}, this value indicates the maximum length of the string.
75
         *
76
         * @return
77
         *                 an <code>int</code> indicating the size of the attribute.
78
         */
79
        public int getSize();
80

    
81
        /**
82
         * For attributes of type {@link DataTypes#DOUBLE} and {@link DataTypes#FLOAT}
83
         * , this returns the maximum number of places after the decimal point. For
84
         * other types, this must always return zero.
85
         */
86
        public int getPrecision();
87

    
88
        /**
89
         * For attributes of type {@link DataTypes#OBJECT},
90
         * this returns the Java {@link Class} object that class or interface that
91
         * all values of this attribute can be cast to.
92
         */
93
        public Class getObjectClass();
94

    
95
        /**
96
         * Returns the minimum number of occurrences of this attribute on a given
97
         * feature.  The vast majority of data sources and data consumers will only
98
         * function with this value being zero or one.  If the minimum number of
99
         * occurrences is zero, this is equivalent, in SQL terms, to the attribute
100
         * being nillable.
101
         */
102
        public int getMinimumOccurrences();
103

    
104
        /**
105
         * Returns the maximum number of occurrences of this attribute on a given
106
         * feature.  The vast majority of data sources and data consumers will only
107
         * function with this value being one.  A value of {@link Integer#MAX_VALUE}
108
         * indicates that the maximum number of occurrences is unbounded.
109
         */
110
        public int getMaximumOccurrences();
111

    
112
        /**
113
         * Returns {@code true} if this attribute forms all or part of the unique identifying
114
         * value for the feature it is contained by.  The primary key attributes uniquely
115
         * identify this feature from other features of the same type.  This is different
116
         * from the {@linkplain Feature#getReference()}, which must uniquely identify
117
         * the {@link Feature} among all feature types.
118
         */
119
        public boolean isPrimaryKey();
120

    
121
        /**
122
         * Indicates whether this attribute accepts null values.
123
         *
124
         * @return
125
         *                 true if this attribute can be null, false if not.
126
         */
127
        public boolean allowNull();
128

    
129
        /**
130
         * Returns an evaluator that will be used to calculate
131
         * the value of this attribute
132
         */
133
        public Evaluator getEvaluator();
134

    
135
        /**
136
         * If this attribute is a {@link Geometry}, this method returns its
137
         * Spatial Reference System.
138
         *
139
         * @return
140
         *                 the SRS if this attribute is a {@link Geometry}, otherwise this method returns null.
141
         */
142
        public IProjection getSRS();
143

    
144
            /**
145
     * If this attribute is a {@link Geometry}, this method returns the specific
146
     * geometry type,
147
     * as defined in {@link Geometry.TYPES}.
148
     * 
149
     * @return
150
     *         One of {@link Geometry.TYPES}
151
     * @deprecated use {@link #getGeomType()} instead. To be removed in gvSIG
152
     *             2.1.
153
     */
154
        public int getGeometryType();
155

    
156
            /**
157
     * If this attribute is a {@link Geometry}, this method returns the specific
158
     * geometry subtype,
159
     * as defined in {@link Geometry.SUBTYPES}.
160
     * 
161
     * @return
162
     *         One of {@link Geometry.SUBTYPES}
163
     * @deprecated use {@link #getGeomType()} instead. To be removed in gvSIG
164
     *             2.1.
165
     */
166
        public int getGeometrySubType();
167

    
168
    /**
169
     * Returns the {@link GeometryType} of the attribute if it is a geometry.
170
     * 
171
     * @return the geometry type
172
     */
173
    public GeometryType getGeomType();
174

    
175
        /**
176
         * If this attribute is of type Date, then this method returns
177
         * the date format set by the data store.
178
         *
179
         * @return
180
         *                 a date format
181
         */
182
        public DateFormat getDateFormat();
183

    
184
        /**
185
         * Returns this attribute relative position within the {@link Feature}.
186
         *
187
         * @return
188
         *                 an index
189
         */
190
        public int getIndex();
191

    
192
        /**
193
         * Returns additional information of the attribute
194
         *
195
         * @return info
196
         *
197
         */
198
        public Object getAdditionalInfo(String infoName);
199

    
200
        /**
201
         * Returns if value is created automatically by the source
202
         */
203
        public boolean isAutomatic();
204

    
205
        /**
206
         * Gets if the attribute is a temporal attribute.
207
         * @return
208
         *         <code>true</code> if is a temporal attribute
209
         */
210
        public boolean isTime();  
211

    
212
        public Interval getInterval();
213
        
214
        /**
215
         * Return true if the attribute has and index in the table.
216
         * 
217
         * @return true if indexed.
218
         */
219
        public boolean isIndexed();
220
        public boolean allowIndexDuplicateds();
221
        public boolean isIndexAscending();
222
        
223
        public boolean isForeingKey();
224
            
225
        public ForeingKey getForeingKey();
226
        /**
227
         * Gets if the attribute has a {@link FeatureAttributeGetter}.
228
         * @return
229
         *             a FeatureAttributeGetter or null.
230
         * @deprecated use getFeatureAttributeGetterAndSetter
231
         */
232
        public FeatureAttributeGetter getFeatureAttributeGetter();
233
        
234
        /**
235
         * Sets the {@link FeatureAttributeGetter} that is used to update the 
236
         * presentation of a field.
237
         * @param featureAttributeGetter
238
         *             the {@link FeatureAttributeGetter} to set.
239
         * @deprecated use setFeatureAttributeGetterAndSetter
240
         */
241
        public void setFeatureAttributeGetter(FeatureAttributeGetter featureAttributeGetter);
242

    
243
             /**
244
         * Gets the attribute emulator associatted {@link FeatureAttributeEmulator} to this attribute.
245
         * @return
246
         *             a FeatureAttributeEmulator or null.
247
         */
248
        public FeatureAttributeEmulator getFeatureAttributeEmulator();
249
        
250
        /**
251
         * Return true if the attribute has an evaluator o an emulator.
252
         * @return 
253
         */
254
        public boolean isComputed();
255
        
256
        /**
257
         * Return the store associated to this attribute descriptor.
258
         * 
259
         * @return the FeatureStore of the attribute descriptor.
260
         */
261
        public FeatureStore getStore();   
262
        
263
        public FeatureType getFeatureType();
264
            
265
        public String[] getRequiredFieldNames();
266
        
267
        public void recentUsed();
268
        
269
        @Override
270
        public String getLocalizedShortLabel();
271

    
272
        @Override
273
        public String getLocalizedLabel();
274

    
275
        public String getLabelOfValue(Object value);
276
        
277
        public boolean hasOnlyMetadataChanges(FeatureAttributeDescriptor other);
278
        
279
        public boolean hasLabel();
280
        
281
        public boolean hasShortLabel();
282
        
283
        public boolean hasDescription();
284
        
285
}