Mercurial > dive4elements > gnv-client
diff geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java @ 270:1fe93e3c80c0
DefaultResult now directly inherits from HashMap.
geo-backend/trunk@241 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 19 Oct 2009 10:27:24 +0000 |
parents | b02310d7ffee |
children | 8aad9d098b08 |
line wrap: on
line diff
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java Wed Oct 14 10:58:49 2009 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java Mon Oct 19 10:27:24 2009 +0000 @@ -15,8 +15,10 @@ * @author Tim Englich <tim.englich@intevation.de> * */ -public class DefaultResult implements Result { - +public class DefaultResult +extends HashMap<String, Object> +implements Result +{ /** * THE UID of this Classe */ @@ -26,8 +28,6 @@ /** * HashMap which stores the Columnvalues identified by the unique Columnname */ - private HashMap<String, Object> columnValues = new HashMap<String, Object>(); - /** * The ResultDescriptor which describes the ColumnValues @@ -46,7 +46,7 @@ * @see de.intevation.gnv.geobackend.base.Result#getDate(java.lang.String) */ public Date getDate(String columnName) { - Object o = this.columnValues.get(columnName); + Object o = get(columnName); Date d = null; if(o instanceof Date){ d = (Date)o; @@ -60,21 +60,21 @@ * @see de.intevation.gnv.geobackend.base.Result#getDouble(java.lang.String) */ public Double getDouble(String columnName) { - return (Double)this.columnValues.get(columnName); + return (Double)get(columnName); } /** * @see de.intevation.gnv.geobackend.base.Result#getFloat(java.lang.String) */ public Float getFloat(String columnName) { - return (Float)this.columnValues.get(columnName); + return (Float)get(columnName); } /** * @see de.intevation.gnv.geobackend.base.Result#getInteger(java.lang.String) */ public Integer getInteger(String columnName) { - return (Integer)this.columnValues.get(columnName); + return (Integer)get(columnName); } /** @@ -88,29 +88,31 @@ * @see de.intevation.gnv.geobackend.base.Result#getString(java.lang.String) */ public String getString(String columnName) { - Object o = this.columnValues.get(columnName); - if(o instanceof Date){ + Object o = get(columnName); + if (o instanceof Date){ return DateUtils.getPatternedDateAmer((Date)o); - }else if (o instanceof GregorianCalendar){ + } + + if (o instanceof GregorianCalendar){ Date d = ((GregorianCalendar)o).getTime(); return DateUtils.getPatternedDateAmer(d); - }else{ - return this.columnValues.get(columnName).toString(); } + + return o != null ? o.toString() : ""; } /** * @see de.intevation.gnv.geobackend.base.Result#addColumnValue(java.lang.String, java.lang.Object) */ public void addColumnValue(String columnName, Object value) { - this.columnValues.put(columnName, value); + put(columnName, value); } /** * @see de.intevation.gnv.geobackend.base.Result#getObject(java.lang.String) */ public Object getObject(String columnName) { - return this.columnValues.get(columnName); + return get(columnName); } }