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

History | View | Annotate | Download (6.65 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.tools.dynobject.DynField;
34
import org.gvsig.tools.evaluator.Evaluator;
35

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
204
        /**
205
         * Gets if the attribute has a {@link FeatureAttributeGetter}.
206
         * @return
207
         *             a FeatureAttributeGetter or null.
208
         */
209
        public FeatureAttributeGetter getFeatureAttributeGetter();
210
        
211
        /**
212
         * Sets the {@link FeatureAttributeGetter} that is used to update the 
213
         * presentation of a field.
214
         * @param featureAttributeGetter
215
         *             the {@link FeatureAttributeGetter} to set.
216
         */
217
        public void setFeatureAttributeGetter(FeatureAttributeGetter featureAttributeGetter);
218
}