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

History | View | Annotate | Download (7.83 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;
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 {
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
        /**
64
         * Returns a number that indicates the size of this attribute. See the
65
         * documentation for the various constants of {@link DataTypes}
66
         * for how to interpret this value. As an example, when the data type is
67
         * {@link DataTypes#STRING}, this value indicates the maximum length of the string.
68
         *
69
         * @return
70
         *                 an <code>int</code> indicating the size of the attribute.
71
         */
72
        public int getSize();
73

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

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

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

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

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

    
114
        /**
115
         * Indicates whether this attribute accepts null values.
116
         *
117
         * @return
118
         *                 true if this attribute can be null, false if not.
119
         */
120
        public boolean allowNull();
121

    
122
        /**
123
         * Returns an evaluator that will be used to calculate
124
         * the value of this attribute
125
         */
126
        public Evaluator getEvaluator();
127

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

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

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

    
161
    /**
162
     * Returns the {@link GeometryType} of the attribute if it is a geometry.
163
     * 
164
     * @return the geometry type
165
     */
166
    public GeometryType getGeomType();
167

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

    
177
        /**
178
         * Returns this attribute relative position within the {@link Feature}.
179
         *
180
         * @return
181
         *                 an index
182
         */
183
        public int getIndex();
184

    
185
        /**
186
         * Returns additional information of the attribute
187
         *
188
         * @return info
189
         *
190
         */
191
        public Object getAdditionalInfo(String infoName);
192

    
193
        /**
194
         * Returns if value is created automatically by the source
195
         */
196
        public boolean isAutomatic();
197

    
198
        /**
199
         * Gets if the attribute is a temporal attribute.
200
         * @return
201
         *         <code>true</code> if is a temporal attribute
202
         */
203
        public boolean isTime();  
204

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

    
233
             /**
234
         * Gets the attribute emulator associatted {@link FeatureAttributeEmulator} to this attribute.
235
         * @return
236
         *             a FeatureAttributeEmulator or null.
237
         */
238
        public FeatureAttributeEmulator getFeatureAttributeEmulator();
239
        
240
        /**
241
         * Return true if the attribute has an evaluator o an emulator.
242
         * @return 
243
         */
244
        public boolean isComputed();
245
        
246
        /**
247
         * Return the store associated to this attribute descriptor.
248
         * 
249
         * @return the FeatureStore of the attribute descriptor.
250
         */
251
        public FeatureStore getStore();   
252
        
253
        public FeatureType getFeatureType();
254
            
255
}