Revision 45539
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/Feature.java | ||
---|---|---|
210 | 210 |
* @return value of the specified attribute |
211 | 211 |
*/ |
212 | 212 |
public boolean getBoolean(String name); |
213 |
public boolean getBooleanOrDefault(String name, boolean defaultValue); |
|
213 | 214 |
|
214 | 215 |
/** |
215 | 216 |
* Returns the Boolean value of an attribute given its position. |
... | ... | |
218 | 219 |
* @return value of the specified attribute |
219 | 220 |
*/ |
220 | 221 |
public boolean getBoolean(int index); |
222 |
public boolean getBooleanOrDefault(int index, boolean defaultValue); |
|
221 | 223 |
|
222 | 224 |
/** |
223 | 225 |
* Returns the long value of an attribute given its name. |
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/DefaultFeature.java | ||
---|---|---|
881 | 881 |
} |
882 | 882 |
|
883 | 883 |
@Override |
884 |
public double getDoubleOrDefault(String name, double defaultValue) { |
|
885 |
int index = this.data.getType().getIndex(name); |
|
886 |
if( index < 0 ) { |
|
887 |
return defaultValue; |
|
888 |
} |
|
889 |
try { |
|
890 |
return (double) this.get(index); |
|
891 |
} catch(Throwable th) { |
|
892 |
return defaultValue; |
|
893 |
} |
|
894 |
} |
|
895 |
|
|
896 |
@Override |
|
884 | 897 |
public byte getByte(String name) { |
885 | 898 |
return this.getByte(this.data.getType().getIndex(name)); |
886 | 899 |
} |
Also available in: Unified diff