root / org.gvsig.toolbox / trunk / org.gvsig.toolbox / org.gvsig.toolbox.core / src / main / java / es / unex / sextante / dataObjects / AbstractTable.java @ 341
History | View | Annotate | Download (1.22 KB)
1 |
package es.unex.sextante.dataObjects; |
---|---|
2 |
|
3 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
4 |
|
5 |
/**
|
6 |
* A convenience class which implements some of the methods of the ITable interface. Extending this class is recommended instead
|
7 |
* of implementing the interface directly
|
8 |
*
|
9 |
* @author volaya
|
10 |
*
|
11 |
*/
|
12 |
public abstract class AbstractTable |
13 |
implements
|
14 |
ITable { |
15 |
|
16 |
|
17 |
public String[] getFieldNames() { |
18 |
|
19 |
final String[] names = new String[getFieldCount()]; |
20 |
|
21 |
for (int i = 0; i < names.length; i++) { |
22 |
names[i] = getFieldName(i); |
23 |
} |
24 |
|
25 |
return names;
|
26 |
|
27 |
} |
28 |
|
29 |
|
30 |
public Class[] getFieldTypes() { |
31 |
|
32 |
final Class[] types = new Class[getFieldCount()]; |
33 |
|
34 |
for (int i = 0; i < types.length; i++) { |
35 |
types[i] = getFieldType(i); |
36 |
} |
37 |
|
38 |
return types;
|
39 |
|
40 |
} |
41 |
|
42 |
|
43 |
public int getFieldIndexByName(final String sFieldName) { |
44 |
|
45 |
for (int i = 0; i < this.getFieldCount(); i++) { |
46 |
final String sName = getFieldName(i); |
47 |
if (sName.equals(sFieldName)) {
|
48 |
return i;
|
49 |
} |
50 |
} |
51 |
|
52 |
return -1; |
53 |
|
54 |
} |
55 |
|
56 |
|
57 |
@Override
|
58 |
public String toString() { |
59 |
|
60 |
return this.getName(); |
61 |
|
62 |
} |
63 |
|
64 |
@Override
|
65 |
public FeatureStore getFeatureStore() {
|
66 |
return null; |
67 |
} |
68 |
|
69 |
} |