svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / feature / FeatureAttributeDescriptor.java @ 28782
History | View | Annotate | Download (5.62 KB)
1 |
package org.gvsig.fmap.dal.feature; |
---|---|
2 |
|
3 |
import java.text.DateFormat; |
4 |
|
5 |
import org.cresques.cts.IProjection; |
6 |
import org.gvsig.fmap.dal.DataTypes; |
7 |
import org.gvsig.fmap.geom.Geometry; |
8 |
import org.gvsig.tools.evaluator.Evaluator; |
9 |
|
10 |
|
11 |
|
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 |
*
|
19 |
*/
|
20 |
public interface FeatureAttributeDescriptor { |
21 |
|
22 |
/**
|
23 |
* Returns a clone of this attribute descriptor
|
24 |
*
|
25 |
* @return FeatureAttributeDescriptor
|
26 |
* A new copy of this
|
27 |
*/
|
28 |
public FeatureAttributeDescriptor getCopy();
|
29 |
|
30 |
|
31 |
/**
|
32 |
* Returns the name of this attribute. This is the name that can be used to
|
33 |
* retrieve the value of an attribute and usually maps to either an XML
|
34 |
* element name or a column name in a relational database.
|
35 |
*/
|
36 |
public String getName(); |
37 |
|
38 |
/**
|
39 |
* Returns a constant from {@link DataTypes}. The return
|
40 |
* value of this method indicates how the return values of {@link #getSize},
|
41 |
* {@link #getPrecision}, and {@link #getObjectClass} should be interpreted.
|
42 |
* For attributes whose maximum cardinality is greater than one, this should
|
43 |
* return the data type of the individual elements of the collection.
|
44 |
*
|
45 |
* @return
|
46 |
* an <code>int</code> indicating the data type as defined in {@link DataTypes}.
|
47 |
*/
|
48 |
public int getDataType(); |
49 |
|
50 |
/**
|
51 |
* Returns the name of this attribute's data type.
|
52 |
*
|
53 |
* @return
|
54 |
* a string containing the name of this attribute's data type.
|
55 |
*/
|
56 |
public String getDataTypeName(); |
57 |
|
58 |
/**
|
59 |
* Returns a number that indicates the size of this attribute. See the
|
60 |
* documentation for the various constants of {@link DataTypes}
|
61 |
* for how to interpret this value. As an example, when the data type is
|
62 |
* {@link DataTypes#STRING}, this value indicates the maximum length of the string.
|
63 |
*
|
64 |
* @return
|
65 |
* an <code>int</code> indicating the size of the attribute.
|
66 |
*/
|
67 |
public int getSize(); |
68 |
|
69 |
/**
|
70 |
* For attributes of type {@link DataTypes#DOUBLE} and {@link DataTypes#FLOAT}
|
71 |
* , this returns the maximum number of places after the decimal point. For
|
72 |
* other types, this must always return zero.
|
73 |
*/
|
74 |
public int getPrecision(); |
75 |
|
76 |
/**
|
77 |
* For attributes of type {@link DataTypes#OBJECT},
|
78 |
* this returns the Java {@link Class} object that class or interface that
|
79 |
* all values of this attribute can be cast to.
|
80 |
*/
|
81 |
public Class getObjectClass(); |
82 |
|
83 |
/**
|
84 |
* Returns the minimum number of occurrences of this attribute on a given
|
85 |
* feature. The vast majority of data sources and data consumers will only
|
86 |
* function with this value being zero or one. If the minimum number of
|
87 |
* occurrences is zero, this is equivalent, in SQL terms, to the attribute
|
88 |
* being nillable.
|
89 |
*/
|
90 |
public int getMinimumOccurrences(); |
91 |
|
92 |
/**
|
93 |
* Returns the maximum 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 one. A value of {@link Integer#MAX_VALUE}
|
96 |
* indicates that the maximum number of occurrences is unbounded.
|
97 |
*/
|
98 |
public int getMaximumOccurrences(); |
99 |
|
100 |
/**
|
101 |
* Returns {@code true} if this attribute forms all or part of the unique identifying
|
102 |
* value for the feature it is contained by. The primary key attributes uniquely
|
103 |
* identify this feature from other features of the same type. This is different
|
104 |
* from the {@linkplain Feature#getReference()}, which must uniquely identify
|
105 |
* the {@link Feature} among all feature types.
|
106 |
*/
|
107 |
public boolean isPrimaryKey(); |
108 |
|
109 |
/**
|
110 |
* Indicates whether this attribute accepts null values.
|
111 |
*
|
112 |
* @return
|
113 |
* true if this attribute can be null, false if not.
|
114 |
*/
|
115 |
public boolean allowNull(); |
116 |
|
117 |
/**
|
118 |
* Returns an evaluator that will be used to calculate
|
119 |
* the value of this attribute
|
120 |
*/
|
121 |
public Evaluator getEvaluator();
|
122 |
|
123 |
/**
|
124 |
* Indicates whether this attribute is read only or not.
|
125 |
*
|
126 |
* @return
|
127 |
* true if this attribute is read only, false if not.
|
128 |
*/
|
129 |
public boolean isReadOnly(); |
130 |
|
131 |
/**
|
132 |
* If this attribute is a {@link Geometry}, this method returns its
|
133 |
* Spatial Reference System.
|
134 |
*
|
135 |
* @return
|
136 |
* the SRS if this attribute is a {@link Geometry}, otherwise this method returns null.
|
137 |
*/
|
138 |
public IProjection getSRS();
|
139 |
|
140 |
/**
|
141 |
* If this attribute is a {@link Geometry}, this method returns the specific geometry type,
|
142 |
* as defined in {@link Geometry.TYPES}.
|
143 |
*
|
144 |
* @return
|
145 |
* One of {@link Geometry.TYPES}
|
146 |
*/
|
147 |
public int getGeometryType(); |
148 |
|
149 |
/**
|
150 |
* If this attribute is a {@link Geometry}, this method returns the specific geometry subtype,
|
151 |
* as defined in {@link Geometry.SUBTYPES}.
|
152 |
*
|
153 |
* @return
|
154 |
* One of {@link Geometry.SUBTYPES}
|
155 |
*/
|
156 |
public int getGeometrySubType(); |
157 |
|
158 |
/**
|
159 |
* Returns this attribute default value, or null if no
|
160 |
* default value has been defined.
|
161 |
*
|
162 |
* @return
|
163 |
* this attribute default value, or null if no default
|
164 |
* value has been defined.
|
165 |
*/
|
166 |
public Object getDefaultValue(); |
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 |
* Reaturns if value is created automaticaly by the source
|
195 |
*/
|
196 |
public boolean isAutomatic(); |
197 |
|
198 |
} |