mirror of https://github.com/apache/poi.git
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:
parent
fb19f7c233
commit
84a5a27dc1
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue