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

History | View | Annotate | Download (5.69 KB)

1
package org.gvsig.fmap.dal.feature;
2

    
3
import java.text.DateFormat;
4

    
5
import org.cresques.cts.IProjection;
6

    
7
import org.gvsig.fmap.dal.DataTypes;
8
import org.gvsig.fmap.geom.Geometry;
9
import org.gvsig.fmap.geom.type.GeometryType;
10
import org.gvsig.tools.dynobject.DynField;
11
import org.gvsig.tools.evaluator.Evaluator;
12

    
13
/**
14
 * A feature attribute descriptor contains information about
15
 * one of the attributes in a feature, such as its name, data type
16
 * or precision.
17
 * 
18
 * @author gvSIG team
19
 * @version $Id$
20
 */
21
public interface FeatureAttributeDescriptor extends DynField {
22

    
23
        /**
24
         * Returns a clone of this attribute descriptor
25
         *
26
         * @return FeatureAttributeDescriptor
27
         *                                                 A new copy of this
28
         */
29
        public FeatureAttributeDescriptor getCopy();
30

    
31
        /**
32
         * Returns the name of this attribute's data type.
33
         *
34
         * @return
35
         *                 a string containing the name of this attribute's data type.
36
         */
37
        public String getDataTypeName();
38

    
39
        /**
40
         * Returns a number that indicates the size of this attribute. See the
41
         * documentation for the various constants of {@link DataTypes}
42
         * for how to interpret this value. As an example, when the data type is
43
         * {@link DataTypes#STRING}, this value indicates the maximum length of the string.
44
         *
45
         * @return
46
         *                 an <code>int</code> indicating the size of the attribute.
47
         */
48
        public int getSize();
49

    
50
        /**
51
         * For attributes of type {@link DataTypes#DOUBLE} and {@link DataTypes#FLOAT}
52
         * , this returns the maximum number of places after the decimal point. For
53
         * other types, this must always return zero.
54
         */
55
        public int getPrecision();
56

    
57
        /**
58
         * For attributes of type {@link DataTypes#OBJECT},
59
         * this returns the Java {@link Class} object that class or interface that
60
         * all values of this attribute can be cast to.
61
         */
62
        public Class getObjectClass();
63

    
64
        /**
65
         * Returns the minimum number of occurrences of this attribute on a given
66
         * feature.  The vast majority of data sources and data consumers will only
67
         * function with this value being zero or one.  If the minimum number of
68
         * occurrences is zero, this is equivalent, in SQL terms, to the attribute
69
         * being nillable.
70
         */
71
        public int getMinimumOccurrences();
72

    
73
        /**
74
         * Returns the maximum number of occurrences of this attribute on a given
75
         * feature.  The vast majority of data sources and data consumers will only
76
         * function with this value being one.  A value of {@link Integer#MAX_VALUE}
77
         * indicates that the maximum number of occurrences is unbounded.
78
         */
79
        public int getMaximumOccurrences();
80

    
81
        /**
82
         * Returns {@code true} if this attribute forms all or part of the unique identifying
83
         * value for the feature it is contained by.  The primary key attributes uniquely
84
         * identify this feature from other features of the same type.  This is different
85
         * from the {@linkplain Feature#getReference()}, which must uniquely identify
86
         * the {@link Feature} among all feature types.
87
         */
88
        public boolean isPrimaryKey();
89

    
90
        /**
91
         * Indicates whether this attribute accepts null values.
92
         *
93
         * @return
94
         *                 true if this attribute can be null, false if not.
95
         */
96
        public boolean allowNull();
97

    
98
        /**
99
         * Returns an evaluator that will be used to calculate
100
         * the value of this attribute
101
         */
102
        public Evaluator getEvaluator();
103

    
104
        /**
105
         * If this attribute is a {@link Geometry}, this method returns its
106
         * Spatial Reference System.
107
         *
108
         * @return
109
         *                 the SRS if this attribute is a {@link Geometry}, otherwise this method returns null.
110
         */
111
        public IProjection getSRS();
112

    
113
            /**
114
     * If this attribute is a {@link Geometry}, this method returns the specific
115
     * geometry type,
116
     * as defined in {@link Geometry.TYPES}.
117
     * 
118
     * @return
119
     *         One of {@link Geometry.TYPES}
120
     * @deprecated use {@link #getGeomType()} instead. To be removed in gvSIG
121
     *             2.1.
122
     */
123
        public int getGeometryType();
124

    
125
            /**
126
     * If this attribute is a {@link Geometry}, this method returns the specific
127
     * geometry subtype,
128
     * as defined in {@link Geometry.SUBTYPES}.
129
     * 
130
     * @return
131
     *         One of {@link Geometry.SUBTYPES}
132
     * @deprecated use {@link #getGeomType()} instead. To be removed in gvSIG
133
     *             2.1.
134
     */
135
        public int getGeometrySubType();
136

    
137
    /**
138
     * Returns the {@link GeometryType} of the attribute if it is a geometry.
139
     * 
140
     * @return the geometry type
141
     */
142
    public GeometryType getGeomType();
143

    
144
        /**
145
         * If this attribute is of type Date, then this method returns
146
         * the date format set by the data store.
147
         *
148
         * @return
149
         *                 a date format
150
         */
151
        public DateFormat getDateFormat();
152

    
153
        /**
154
         * Returns this attribute relative position within the {@link Feature}.
155
         *
156
         * @return
157
         *                 an index
158
         */
159
        public int getIndex();
160

    
161
        /**
162
         * Returns additional information of the attribute
163
         *
164
         * @return info
165
         *
166
         */
167
        public Object getAdditionalInfo(String infoName);
168

    
169
        /**
170
         * Returns if value is created automatically by the source
171
         */
172
        public boolean isAutomatic();
173

    
174
        /**
175
         * Gets if the attribute is a temporal attribute.
176
         * @return
177
         *         <code>true</code> if is a temporal attribute
178
         */
179
        public boolean isTime();  
180

    
181
        /**
182
         * Gets if the attribute has a {@link FeatureAttributeGetter}.
183
         * @return
184
         *             a FeatureAttributeGetter or null.
185
         */
186
        public FeatureAttributeGetter getFeatureAttributeGetter();
187
        
188
        /**
189
         * Sets the {@link FeatureAttributeGetter} that is used to update the 
190
         * presentation of a field.
191
         * @param featureAttributeGetter
192
         *             the {@link FeatureAttributeGetter} to set.
193
         */
194
        public void setFeatureAttributeGetter(FeatureAttributeGetter featureAttributeGetter);
195
}