Revision 43739 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java

View differences:

DefaultFeatureAttributeDescriptor.java
22 22
 */
23 23
package org.gvsig.fmap.dal.feature.impl;
24 24

  
25
import java.lang.ref.WeakReference;
25 26
import java.text.DateFormat;
26 27
import java.util.HashMap;
27 28
import java.util.Iterator;
......
34 35
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
35 36
import org.gvsig.fmap.dal.feature.FeatureAttributeEmulator;
36 37
import org.gvsig.fmap.dal.feature.FeatureAttributeGetter;
38
import org.gvsig.fmap.dal.feature.FeatureStore;
39
import org.gvsig.fmap.dal.feature.FeatureType;
37 40
import org.gvsig.fmap.geom.Geometry;
38 41
import org.gvsig.fmap.geom.GeometryException;
39 42
import org.gvsig.fmap.geom.GeometryLocator;
......
103 106
    protected Tags tags = new DefaultTags();
104 107
    private DynMethod availableValuesMethod;
105 108
    private DynMethod calculateMethod;
109
    private WeakReference typeRef;
106 110

  
107
    protected DefaultFeatureAttributeDescriptor() {
111
    protected DefaultFeatureAttributeDescriptor(FeatureType type) {
112
        if( type == null ) {
113
            this.typeRef = null;
114
        } else {
115
            this.typeRef = new WeakReference(type);
116
        }
108 117
        this.allowNull = true;
109 118
        this.dataType = null;
110 119
        this.dateFormat = null;
......
128 137
    }
129 138

  
130 139
    protected DefaultFeatureAttributeDescriptor(
131
            DefaultFeatureAttributeDescriptor other) {
140
            DefaultFeatureAttributeDescriptor other
141
        ) {
132 142
        copyFrom(other);
133 143
    }
134 144
    
......
138 148
            throw new IllegalArgumentException("Can't copy from a non DefaultFeatureAttributeDescriptor");
139 149
        }
140 150
        DefaultFeatureAttributeDescriptor other = (DefaultFeatureAttributeDescriptor) other1;
151
        this.typeRef = other.typeRef;
141 152
        this.allowNull = other.allowNull;
142 153
        this.dataType = other.dataType;
143 154
        this.dateFormat = other.dateFormat;
......
502 513
     *
503 514
     */
504 515

  
516
    @Override
505 517
    public Tags getTags() {
506 518
        return tags;
507 519
    }
......
963 975
        }
964 976
    }
965 977

  
978
    @Override
966 979
    public boolean isComputed() {
967 980
        return featureAttributeEmulator!=null || evaluator!=null;
968 981
    }
982

  
983
    @Override
984
    public FeatureStore getStore() {
985
        FeatureType ftype = this.getFeatureType();
986
        if( ftype == null ) {
987
            return null;
988
        }
989
        return ftype.getStore();
990
    }
991
    
992
    @Override
993
    public FeatureType getFeatureType() {
994
        if( this.typeRef==null ) {
995
            return null;
996
        }
997
        return (FeatureType) this.typeRef.get();
998
    }
969 999
}

Also available in: Unified diff