diff geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java @ 132:5a583cff97ea

Implementation of the Datainfrastructure for fetching Data from different DataStores. geo-backend/trunk@12 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 04 Sep 2009 08:11:30 +0000
parents
children d43ff60acda4
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java	Fri Sep 04 08:11:30 2009 +0000
@@ -0,0 +1,92 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base;
+
+import java.util.Date;
+import java.util.HashMap;
+
+/**
+ * Defaultimplementation of the Interface Result.
+ * This Class stores the Attributevalues of one Result.
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class DefaultResult implements Result {
+
+    /**
+     * 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
+     */
+    private ResultDescriptor resultDescriptor = null;
+    
+    /**
+     * Constructor
+     */
+    public DefaultResult(ResultDescriptor resultDescriptor) {
+        super();
+        this.resultDescriptor = resultDescriptor;
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getDate(java.lang.String)
+     */
+    public Date getDate(String columnName) {
+        return (Date)this.columnValues.get(columnName);
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getDouble(java.lang.String)
+     */
+    public Double getDouble(String columnName) {
+        return (Double)this.columnValues.get(columnName);
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getFloat(java.lang.String)
+     */
+    public Float getFloat(String columnName) {
+        return (Float)this.columnValues.get(columnName);
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getInteger(java.lang.String)
+     */
+    public Integer getInteger(String columnName) {
+        return (Integer)this.columnValues.get(columnName);
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getResultDescriptor()
+     */
+    public ResultDescriptor getResultDescriptor() {
+        return this.resultDescriptor;
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getString(java.lang.String)
+     */
+    public String getString(String columnName) {
+        return this.columnValues.get(columnName).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);
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getObject(java.lang.String)
+     */
+    public Object getObject(String columnName) {
+        return this.columnValues.get(columnName);
+    }
+
+}

http://dive4elements.wald.intevation.org