poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1747163 - /poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
Date Tue, 07 Jun 2016 07:39:40 GMT
Author: onealj
Date: Tue Jun  7 07:39:40 2016
New Revision: 1747163

URL: http://svn.apache.org/viewvc?rev=1747163&view=rev
Log:
make emulateCSV final, add a single common all-inclusive (private) constructor that all other
constructors tree up to and invert the constructors

Modified:
    poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java?rev=1747163&r1=1747162&r2=1747163&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/DataFormatter.java Tue Jun  7 07:39:40
2016
@@ -201,7 +201,7 @@ public class DataFormatter implements Ob
      */
     private final Map<String,Format> formats = new HashMap<String,Format>();
 
-    private boolean emulateCSV = false;
+    private final boolean emulateCSV;
 
     /** stores the locale valid it the last formatting call */
     private Locale locale;
@@ -232,7 +232,6 @@ public class DataFormatter implements Ob
      */
     public DataFormatter() {
         this(false);
-        this.localeIsAdapting = true;
     }
 
     /**
@@ -241,8 +240,14 @@ public class DataFormatter implements Ob
      * @param  emulateCSV whether to emulate CSV output.
      */
     public DataFormatter(boolean emulateCSV) {
-        this(LocaleUtil.getUserLocale(), emulateCSV);
-        this.localeIsAdapting = true;
+        this(LocaleUtil.getUserLocale(), true, emulateCSV);
+    }
+
+    /**
+     * Creates a formatter using the given locale.
+     */
+    public DataFormatter(Locale locale) {
+        this(locale, false);
     }
 
     /**
@@ -251,17 +256,19 @@ public class DataFormatter implements Ob
      * @param  emulateCSV whether to emulate CSV output.
      */
     public DataFormatter(Locale locale, boolean emulateCSV) {
-        this(locale);
-        this.emulateCSV = emulateCSV;
+        this(locale, false, emulateCSV);
     }
 
     /**
      * Creates a formatter using the given locale.
+     * @param  localeIsAdapting (true only if locale is not user-specified)
+     * @param  emulateCSV whether to emulate CSV output.
      */
-    public DataFormatter(Locale locale) {
+    private DataFormatter(Locale locale, boolean localeIsAdapting, boolean emulateCSV) {
         localeChangedObservable.addObserver(this);
         localeChangedObservable.checkForLocaleChange(locale);
-        this.localeIsAdapting = false;
+        this.localeIsAdapting = localeIsAdapting;
+        this.emulateCSV = emulateCSV;
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message