Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/TypeConverter.java @ 4737:718adea968e2
Add <dc:variable name="variable" expr="xpath"/> construct to datacage language.
Each time during traversal of the template this element is found a variable
called 'variable' is set to the result of the the evaluation of the
XPpath 'xpath'.
Example:
<dc:variable name="x" expr="$x + 1"/> <!-- Assign x+1 to x -->
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Wed, 02 Jan 2013 14:05:21 +0100 |
parents | b81626b10cb7 |
children |
line wrap: on
line source
package de.intevation.flys.artifacts.datacage.templating; public class TypeConverter { private TypeConverter() { } public static Object convert(Object object, String type) { if (type == null) { return object; } if ("Integer".equals(type)) { return Integer.valueOf(object.toString()); } if ("Double".equals(type)) { return Double.valueOf(object.toString()); } if ("String".equals(type)) { return object.toString(); } // TODO: Add more types return object; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :