# HG changeset patch # User Felix Wolfsteller # Date 1361962232 -3600 # Node ID 4898376c680b91d947c575f8b7ac9f124bec2028 # Parent cf50783542a19260a26001f3d1e15f0c77bc5ee1 AbstractExporter: keep km-, w- and q-formatter instances. diff -r cf50783542a1 -r 4898376c680b flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Wed Feb 27 10:33:13 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Wed Feb 27 11:50:32 2013 +0100 @@ -74,6 +74,12 @@ /** The master artifact. */ protected Artifact master; + private NumberFormat kmFormat; + + private NumberFormat wFormat; + + private NumberFormat qFormat; + /** * Concrete subclasses need to use this method to write their special data @@ -301,7 +307,10 @@ * @return the number formatter for kilometer values. */ protected NumberFormat getKmFormatter() { - return Formatter.getWaterlevelKM(context); + if (kmFormat == null) { + kmFormat = Formatter.getWaterlevelKM(context); + } + return kmFormat; } @@ -311,7 +320,10 @@ * @return the number formatter for W values. */ protected NumberFormat getWFormatter() { - return Formatter.getWaterlevelW(context); + if (wFormat == null) { + wFormat = Formatter.getWaterlevelW(context); + } + return wFormat; } @@ -321,7 +333,10 @@ * @return the number formatter for Q values. */ protected NumberFormat getQFormatter() { - return Formatter.getWaterlevelQ(context); + if (qFormat == null) { + qFormat = Formatter.getWaterlevelQ(context); + } + return qFormat; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :