teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5863: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5863: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.artifacts.datacage.templating; sascha@998: sascha@998: public class TypeConverter sascha@998: { sascha@998: private TypeConverter() { sascha@998: } sascha@998: sascha@998: public static Object convert(Object object, String type) { sascha@998: sascha@998: if (type == null) { sascha@998: return object; sascha@998: } sascha@998: sascha@998: if ("Integer".equals(type)) { sascha@998: return Integer.valueOf(object.toString()); sascha@998: } sascha@998: sascha@998: if ("Double".equals(type)) { sascha@998: return Double.valueOf(object.toString()); sascha@998: } sascha@998: sascha@998: if ("String".equals(type)) { sascha@998: return object.toString(); sascha@998: } sascha@998: sascha@998: // TODO: Add more types sascha@998: sascha@998: return object; sascha@998: } sascha@998: } sascha@998: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :