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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
197
        /**
198
         * Returns if value is created automatically by the source
199
         */
200
        public boolean isAutomatic();
201

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

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

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

    
269
        @Override
270
        public String getLocalizedLabel();
271

    
272
        public String getLabelOfValue(Object value);
273
}