make emulateCSV final, add a single common all-inclusive (private) constructor that all other constructors tree up to and invert the constructors

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1747163 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-06-07 07:39:40 +00:00
parent fb19f7c233
commit 84a5a27dc1
1 changed files with 15 additions and 8 deletions

View File

@ -201,7 +201,7 @@ public class DataFormatter implements Observer {
*/
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 Observer {
*/
public DataFormatter() {
this(false);
this.localeIsAdapting = true;
}
/**
@ -241,8 +240,14 @@ public class DataFormatter implements Observer {
* @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 Observer {
* @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;
}
/**