Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/common/ResultRow.java @ 8999:e3b3ce32c825
Work on uinfo
author | gernotbelger |
---|---|
date | Thu, 12 Apr 2018 19:15:42 +0200 |
parents | |
children | b4402594213b |
comparison
equal
deleted
inserted
replaced
8998:c38098b15427 | 8999:e3b3ce32c825 |
---|---|
1 /** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by | |
3 * Björnsen Beratende Ingenieure GmbH | |
4 * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt | |
5 * | |
6 * This file is Free Software under the GNU AGPL (>=v3) | |
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
8 * documentation coming with Dive4Elements River for details. | |
9 */ | |
10 package org.dive4elements.river.artifacts.common; | |
11 | |
12 import java.io.Serializable; | |
13 import java.util.HashMap; | |
14 import java.util.Map; | |
15 | |
16 import org.dive4elements.artifacts.CallContext; | |
17 import org.dive4elements.river.artifacts.common.IResultType; | |
18 | |
19 /** | |
20 * Generic container for results that come in rows. | |
21 * | |
22 * @author Gernot Belger | |
23 */ | |
24 public class ResultRow implements Serializable { | |
25 protected static final long serialVersionUID = 1L; //TODO: Make private (wenn SInfoResultRow gelöscht ist | |
26 | |
27 private final Map<IResultType, Object> values = new HashMap<IResultType, Object>(); | |
28 | |
29 public static ResultRow create() { | |
30 return new ResultRow(); | |
31 } | |
32 | |
33 protected ResultRow() { | |
34 } | |
35 | |
36 public ResultRow putValue(final IResultType type, final Object value) { | |
37 | |
38 this.values.put(type, value); | |
39 | |
40 /* chain me */ | |
41 return this; | |
42 } | |
43 | |
44 public String exportValue(final CallContext context, final IResultType type) { | |
45 final Object value = this.values.get(type); | |
46 return type.exportValue(context, value); | |
47 } | |
48 | |
49 public double getDoubleValue(final IResultType type) { | |
50 final Object value = this.values.get(type); | |
51 return type.asDouble(value); | |
52 } | |
53 | |
54 public Object getValue(final IResultType type) { | |
55 return this.values.get(type); | |
56 } | |
57 } |