Commit 0acf9213 authored by mey's avatar mey
Browse files

Processes XStream annotations for parameters class and register converters

ParamsUtil.java
    loads AmountUtil if possible to trigger its static initializer
AmountUtil.java
    converters are registered via static initializer
Launcher.java
    processes annotations automatically for simulation parameter class
parent 14c1247c
......@@ -30,12 +30,21 @@ import javolution.text.TypeFormat;
* @author mey
*
*/
public abstract class AmountUtil {
public class AmountUtil {
@SuppressWarnings("unused")
private static final Logger logger = Logger.getLogger(AmountUtil.class.getName());
public static final AmountFormat FORMAT = new SimpleAmountFormat();
private static final UnitFormat UNIT_FORMAT = new FixedDefaultUnitFormat();
private AmountUtil() {
}
static {
registerConverters(ParamsUtil.getXStreamInstance());
}
/**
*
* @param unit
......@@ -202,7 +211,7 @@ public abstract class AmountUtil {
* @param xStream
* the {@link XStream} instance to be used
*/
public static void registerConverters(XStream xStream) {
private static void registerConverters(XStream xStream) {
xStream.alias("Amount", Amount.class);
xStream.registerConverter(new XmlAmountConverter());
xStream.aliasType("Unit", Unit.class);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment