Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_dataFile / src / org / gvsig / fmap / data / store / dbf / DBFFeatureData.java @ 24432

History | View | Annotate | Download (1.11 KB)

1
package org.gvsig.fmap.data.store.dbf;
2

    
3
import org.gvsig.fmap.data.exceptions.DataException;
4
import org.gvsig.fmap.data.exceptions.ReadRuntimeException;
5
import org.gvsig.fmap.data.feature.impl.DefaultFeatureType;
6
import org.gvsig.fmap.data.feature.spi.DefaultFeatureData;
7

    
8
public class DBFFeatureData extends DefaultFeatureData {
9
        protected DBFStoreProvider store;
10
        protected boolean loading;
11

    
12
        public DBFFeatureData(DBFStoreProvider store, DefaultFeatureType type) {
13
                super(type);
14
                this.store = store;
15
                loading = false;
16
        }
17

    
18
        protected void load() {
19
                if (loading) {
20
                        return;
21
                }
22
                loading = true;
23
                try {
24
                        this.store.loadFeatureDataByIndex(this);
25
                } catch (DataException e) {
26
                        throw new ReadRuntimeException("DBFFeatureData.load", e);
27
                } finally {
28
                        loading = false;
29
                }
30
        }
31

    
32
        public void set(int i, Object value) {
33
                this.load();
34
                super.set(i, value);
35
        }
36

    
37
        public void set(String name, Object value) {
38
                this.load();
39
                super.set(featureType.getIndex(name), value);
40
        }
41

    
42
        public Object get(int i) {
43
                this.load();
44
                return super.get(i);
45
        }
46

    
47
        public Object get(String name) {
48
                this.load();
49
                return super.get(name);
50
        }
51

    
52
}