Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/TypeConverter.java @ 998:b81626b10cb7
Datacage: Moved templating in a better suited package.
flys-artifacts/trunk@2434 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 01 Aug 2011 08:31:09 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
997:4c82609824c8 | 998:b81626b10cb7 |
---|---|
1 package de.intevation.flys.artifacts.datacage.templating; | |
2 | |
3 public class TypeConverter | |
4 { | |
5 private TypeConverter() { | |
6 } | |
7 | |
8 public static Object convert(Object object, String type) { | |
9 | |
10 if (type == null) { | |
11 return object; | |
12 } | |
13 | |
14 if ("Integer".equals(type)) { | |
15 return Integer.valueOf(object.toString()); | |
16 } | |
17 | |
18 if ("Double".equals(type)) { | |
19 return Double.valueOf(object.toString()); | |
20 } | |
21 | |
22 if ("String".equals(type)) { | |
23 return object.toString(); | |
24 } | |
25 | |
26 // TODO: Add more types | |
27 | |
28 return object; | |
29 } | |
30 } | |
31 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |