Commit 97420200 authored by Vincent Calame's avatar Vincent Calame

Modification de la gestion des monnaies dans les utilitaires

parent b67f4812
/* OdLib_Io - Copyright (c) 2013-2016 Vincent Calame - Exemole
/* OdLib_Io - Copyright (c) 2013-2018 Vincent Calame - Exemole
* Logiciel libre donné sous triple licence :
* 1) selon les termes de la CeCILL V2
* 2) selon les termes de l’EUPL V.1.1
......@@ -11,9 +11,7 @@ package net.mapeadores.opendocument.io;
import java.io.IOException;
import net.mapeadores.util.money.Amount;
import net.mapeadores.util.primitives.CurrencyInteger;
import net.mapeadores.util.primitives.FuzzyDate;
import net.mapeadores.util.money.MoneyLong;
import net.mapeadores.util.text.StringUtils;
import net.mapeadores.util.xml.XMLWriter;
......@@ -267,24 +265,6 @@ public final class OdXML {
completeColSpan(xmlWriter, colSpan);
}
public static void addCurrencyTableCell(XMLWriter xmlWriter, long montant, int currencyInteger) throws IOException {
addCurrencyTableCell(xmlWriter, montant, currencyInteger, null, 1);
}
public static void addCurrencyTableCell(XMLWriter xmlWriter, long montant, int currencyInteger, String cellStyleName, int colSpan) throws IOException {
int fractionDigits = CurrencyInteger.getSubunitLength(currencyInteger);
xmlWriter.startOpenTag("table:table-cell");
xmlWriter.addAttribute("office:value-type", "currency");
xmlWriter.addAttribute("office:currency", CurrencyInteger.toString(currencyInteger));
xmlWriter.addAttribute("office:value", MoneyLong.toDecimal(montant, fractionDigits, false).toString());
xmlWriter.addAttribute("table:style-name", cellStyleName);
if (colSpan > 1) {
xmlWriter.addAttribute("table:number-columns-spanned", colSpan);
}
xmlWriter.closeEmptyTag();
completeColSpan(xmlWriter, colSpan);
}
public static void addLinkStringTableCell(XMLWriter xmlWriter, String linkString) throws IOException {
xmlWriter.startOpenTag("table:table-cell");
xmlWriter.addAttribute("office:value-type", "string");
......
/* OdLib_Io - Copyright (c) 2013-2016 Vincent Calame - Exemole
/* OdLib_Io - Copyright (c) 2013-2018 Vincent Calame - Exemole
* Logiciel libre donné sous triple licence :
* 1) selon les termes de la CeCILL V2
* 2) selon les termes de l’EUPL V.1.1
......@@ -16,7 +16,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.mapeadores.opendocument.io.OdXML;
import net.mapeadores.util.primitives.CurrencyInteger;
import net.mapeadores.util.money.ExtendedCurrency;
import net.mapeadores.util.xml.XMLWriter;
......@@ -35,7 +35,7 @@ public class CellStyleEngine {
private final List<String> columnStyleNameList = new ArrayList<String>();
private final Map<String, TableInfo> tableInfoMap = new HashMap<String, TableInfo>();
private final Map<OdCellKey, CellStyle> cellStyleNameMap = new LinkedHashMap<OdCellKey, CellStyle>();
private final Map<Integer, Integer> currencyNumberMap = new LinkedHashMap<Integer, Integer>();
private final Map<ExtendedCurrency, Integer> currencyNumberMap = new LinkedHashMap<ExtendedCurrency, Integer>();
private final CellStyleProvider cellStyleProvider = new InternalCellStyleProvider();
private boolean withISODate = false;
private int columnStyleNumber = 1;
......@@ -112,14 +112,13 @@ public class CellStyleEngine {
xmlWriter.closeEmptyTag();
xmlWriter.closeTag("number:date-style");
}
for (Map.Entry<Integer, Integer> entry : currencyNumberMap.entrySet()) {
int currencyInteger = entry.getKey();
for (Map.Entry<ExtendedCurrency, Integer> entry : currencyNumberMap.entrySet()) {
ExtendedCurrency currency = entry.getKey();
int number = entry.getValue();
String dataStyleName = DATASTYLE_PREFIX + number;
int subunitLength = CurrencyInteger.getSubunitLength(currencyInteger);
String symbol = getSymbol(currencyInteger);
boolean before = ((currencyInteger == CurrencyInteger.USDOLLAR) || (currencyInteger == CurrencyInteger.POUND));
int fractionDigits = currency.getDefaultFractionDigits();
String symbol = currency.getSymbol();
boolean before = currency.isSymbolBefore();
xmlWriter.startOpenTag("number:currency-style");
xmlWriter.addAttribute("style:name", dataStyleName + "P0");
xmlWriter.addAttribute("style:volatile", "true");
......@@ -128,7 +127,7 @@ public class CellStyleEngine {
xmlWriter.addSimpleElement("number:currency-symbol", symbol);
}
xmlWriter.startOpenTag("number:number");
xmlWriter.addAttribute("number:decimal-places", subunitLength);
xmlWriter.addAttribute("number:decimal-places", fractionDigits);
xmlWriter.addAttribute("number:min-integer-digits", "1");
xmlWriter.addAttribute("number:grouping", "true");
xmlWriter.closeEmptyTag();
......@@ -149,7 +148,7 @@ public class CellStyleEngine {
xmlWriter.addSimpleElement("number:currency-symbol", symbol);
}
xmlWriter.startOpenTag("number:number");
xmlWriter.addAttribute("number:decimal-places", subunitLength);
xmlWriter.addAttribute("number:decimal-places", fractionDigits);
xmlWriter.addAttribute("number:min-integer-digits", "1");
xmlWriter.addAttribute("number:grouping", "true");
xmlWriter.closeEmptyTag();
......@@ -195,14 +194,14 @@ public class CellStyleEngine {
dataStyleName = ISODATE_DATASTYLE_NAME;
break;
case OdColumnDef.CURRENCY_STYLE_FAMILY:
int currencyInteger = odCellKey.getCurrencyInteger();
ExtendedCurrency currency = odCellKey.getCurrency();
int number;
if (currencyNumberMap.containsKey(currencyInteger)) {
number = currencyNumberMap.get(currencyInteger);
if (currencyNumberMap.containsKey(currency)) {
number = currencyNumberMap.get(currency);
} else {
number = currencyStyleNumber;
currencyStyleNumber++;
currencyNumberMap.put(currencyInteger, number);
currencyNumberMap.put(currency, number);
}
dataStyleName = DATASTYLE_PREFIX + number;
break;
......@@ -212,19 +211,6 @@ public class CellStyleEngine {
return cellStyle;
}
private static String getSymbol(int currencyInteger) {
if (currencyInteger == CurrencyInteger.EURO) {
return "€";
}
if (currencyInteger == CurrencyInteger.USDOLLAR) {
return "$";
}
if (currencyInteger == CurrencyInteger.POUND) {
return "£";
}
return CurrencyInteger.toString(currencyInteger);
}
private class InternalCellStyleProvider implements CellStyleProvider {
......@@ -242,8 +228,8 @@ public class CellStyleEngine {
}
@Override
public String getCurrencyStyleName(String tableName, int columnNumber, String parentStyleName, int currencyInteger) {
OdCellKey odCellKey = OdCellKey.newInstance(OdColumnDef.CURRENCY_STYLE_FAMILY, currencyInteger, parentStyleName);
public String getCurrencyStyleName(String tableName, int columnNumber, String parentStyleName, ExtendedCurrency currency) {
OdCellKey odCellKey = OdCellKey.newInstance(OdColumnDef.CURRENCY_STYLE_FAMILY, currency, parentStyleName);
return getCellStyleName(tableName, columnNumber, odCellKey);
}
......@@ -272,13 +258,11 @@ public class CellStyleEngine {
private final List<OdColumn> odColumnList = new ArrayList<OdColumn>();
private TableInfo(OdTableDef odTableDef) {
int count = odTableDef.getOdColumnDefCount();
for (int i = 0; i < count; i++) {
OdColumnDef columnDef = odTableDef.getOdColumnDef(i);
for (OdColumnDef columnDef : odTableDef.getOdColumnDefList()) {
short type = columnDef.getColumnStyleFamily();
int currencyInteger = columnDef.getCurrencyInteger();
ExtendedCurrency currency = columnDef.getCurrency();
String columnStyleName = getNewColumnStyleName();
OdCellKey defaultOdCellKey = OdCellKey.newInstance(type, currencyInteger, null);
OdCellKey defaultOdCellKey = OdCellKey.newInstance(type, currency, null);
CellStyle defaultCellStyle = initCellStyle(defaultOdCellKey);
odColumnList.add(new OdColumn(columnStyleName, defaultOdCellKey, defaultCellStyle));
}
......
/* OdLib_Io - Copyright (c) 2013-2016 Vincent Calame - Exemole
/* OdLib_Io - Copyright (c) 2013-2018 Vincent Calame - Exemole
* Logiciel libre donné sous triple licence :
* 1) selon les termes de la CeCILL V2
* 2) selon les termes de l’EUPL V.1.1
......@@ -9,6 +9,8 @@
package net.mapeadores.opendocument.io.odtable;
import net.mapeadores.util.money.ExtendedCurrency;
/**
*
......@@ -24,7 +26,7 @@ public interface CellStyleProvider {
*/
public String getCellStyleName(String tableName, int columnNumber, short styleFamily, String parentStyleName);
public String getCurrencyStyleName(String tableName, int columnNumber, String parentStyleName, int currencyInteger);
public String getCurrencyStyleName(String tableName, int columnNumber, String parentStyleName, ExtendedCurrency currency);
public String createColumnStyleName();
......
/* OdLib_Io - Copyright (c) 2013 Vincent Calame - Exemole
/* OdLib_Io - Copyright (c) 2013-2018 Vincent Calame - Exemole
* Logiciel libre donné sous triple licence :
* 1) selon les termes de la CeCILL V2
* 2) selon les termes de l’EUPL V.1.1
......@@ -9,6 +9,9 @@
package net.mapeadores.opendocument.io.odtable;
import net.mapeadores.util.annotation.Nullable;
import net.mapeadores.util.money.ExtendedCurrency;
/**
*
......@@ -17,12 +20,12 @@ package net.mapeadores.opendocument.io.odtable;
public final class OdCellKey {
private final short styleFamily;
private final int currencyInteger;
private final ExtendedCurrency currency;
private final String styleName;
private OdCellKey(short styleFamily, int currencyInteger, String styleName) {
private OdCellKey(short styleFamily, ExtendedCurrency currency, String styleName) {
this.styleFamily = styleFamily;
this.currencyInteger = currencyInteger;
this.currency = currency;
this.styleName = styleName;
}
......@@ -30,19 +33,24 @@ public final class OdCellKey {
return styleFamily;
}
public int getCurrencyInteger() {
return currencyInteger;
@Nullable
public ExtendedCurrency getCurrency() {
return currency;
}
@Nullable
public String getStyleName() {
return styleName;
}
@Override
public int hashCode() {
int code = styleFamily + currencyInteger;
int code = styleFamily;
if (currency != null) {
code += currency.hashCode();
}
if (styleName != null) {
code = styleName.hashCode();
code += styleName.hashCode();
}
return code;
}
......@@ -62,7 +70,13 @@ public final class OdCellKey {
if (odCellKey.styleFamily != this.styleFamily) {
return false;
}
if (odCellKey.currencyInteger != this.currencyInteger) {
if (odCellKey.currency == null) {
if (this.currency != null) {
return false;
}
} else if (this.currency == null) {
return false;
} else if (!odCellKey.currency.equals(this.currency)) {
return false;
}
if (odCellKey.styleName == null) {
......@@ -82,26 +96,26 @@ public final class OdCellKey {
if (styleFamily == OdColumnDef.CURRENCY_STYLE_FAMILY) {
throw new IllegalArgumentException("Not use with styleFamily = OdColumnDef.CURRENCY_STYLE_FAMILY");
}
return new OdCellKey(styleFamily, 0, styleName);
return new OdCellKey(styleFamily, null, styleName);
}
public static OdCellKey newInstance(short styleFamily, int currencyInteger, String styleName) {
public static OdCellKey newInstance(short styleFamily, ExtendedCurrency currency, String styleName) {
if (styleFamily != OdColumnDef.CURRENCY_STYLE_FAMILY) {
currencyInteger = 0;
currency = null;
}
return new OdCellKey(styleFamily, currencyInteger, styleName);
return new OdCellKey(styleFamily, currency, styleName);
}
public static OdCellKey newStandardInstance(String styleName) {
return new OdCellKey(OdColumnDef.STANDARD_STYLE_FAMILY, 0, styleName);
return new OdCellKey(OdColumnDef.STANDARD_STYLE_FAMILY, null, styleName);
}
public static OdCellKey newDateInstance(String styleName) {
return new OdCellKey(OdColumnDef.DATE_STYLE_FAMILY, 0, styleName);
return new OdCellKey(OdColumnDef.DATE_STYLE_FAMILY, null, styleName);
}
public static OdCellKey newCurrencyInstance(int currencyInteger, String styleName) {
return new OdCellKey(OdColumnDef.CURRENCY_STYLE_FAMILY, currencyInteger, styleName);
public static OdCellKey newCurrencyInstance(ExtendedCurrency currency, String styleName) {
return new OdCellKey(OdColumnDef.CURRENCY_STYLE_FAMILY, currency, styleName);
}
}
/* OdLib_Io - Copyright (c) 2013 Vincent Calame - Exemole
/* OdLib_Io - Copyright (c) 2013-2018 Vincent Calame - Exemole
* Logiciel libre donné sous triple licence :
* 1) selon les termes de la CeCILL V2
* 2) selon les termes de l’EUPL V.1.1
......@@ -9,6 +9,9 @@
package net.mapeadores.opendocument.io.odtable;
import net.mapeadores.util.annotation.Nullable;
import net.mapeadores.util.money.ExtendedCurrency;
/**
*
......@@ -22,7 +25,8 @@ public interface OdColumnDef {
public short getColumnStyleFamily();
public int getCurrencyInteger();
@Nullable
public ExtendedCurrency getCurrency();
public String getCategory();
......
/* OdLib_Io - Copyright (c) 2013 Vincent Calame - Exemole
/* OdLib_Io - Copyright (c) 2013-2018 Vincent Calame - Exemole
* Logiciel libre donné sous triple licence :
* 1) selon les termes de la CeCILL V2
* 2) selon les termes de l’EUPL V.1.1
......@@ -9,6 +9,8 @@
package net.mapeadores.opendocument.io.odtable;
import java.util.List;
/**
*
......@@ -16,8 +18,6 @@ package net.mapeadores.opendocument.io.odtable;
*/
public interface OdTableDef {
public int getOdColumnDefCount();
public OdColumnDef getOdColumnDef(int i);
public List<OdColumnDef> getOdColumnDefList();
}
/* OdLib_Io - Copyright (c) 2013 Vincent Calame - Exemole
/* OdLib_Io - Copyright (c) 2013-2018 Vincent Calame - Exemole
* Logiciel libre donné sous triple licence :
* 1) selon les termes de la CeCILL V2
* 2) selon les termes de l’EUPL V.1.1
......@@ -9,8 +9,11 @@
package net.mapeadores.opendocument.io.odtable;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;
import java.util.RandomAccess;
import net.mapeadores.util.money.ExtendedCurrency;
/**
......@@ -24,40 +27,42 @@ public class OdTableDefBuilder {
public OdTableDefBuilder() {
}
public void addDefaultColumns(String category) {
odColumnList.add(new InternalOdColumnDef(OdColumnDef.STANDARD_STYLE_FAMILY, 0, category));
public OdTableDefBuilder addDefaultColumns(String category) {
odColumnList.add(new InternalOdColumnDef(OdColumnDef.STANDARD_STYLE_FAMILY, null, category));
return this;
}
public void addISODateColumn(String category) {
odColumnList.add(new InternalOdColumnDef(OdColumnDef.DATE_STYLE_FAMILY, 0, category));
public OdTableDefBuilder addISODateColumn(String category) {
odColumnList.add(new InternalOdColumnDef(OdColumnDef.DATE_STYLE_FAMILY, null, category));
return this;
}
public void addCurrencyColumn(int currencyInteger, String category) {
odColumnList.add(new InternalOdColumnDef(OdColumnDef.CURRENCY_STYLE_FAMILY, currencyInteger, category));
public OdTableDefBuilder addCurrencyColumn(ExtendedCurrency currency, String category) {
odColumnList.add(new InternalOdColumnDef(OdColumnDef.CURRENCY_STYLE_FAMILY, currency, category));
return this;
}
public OdTableDef toOdTableDef() {
OdColumnDef[] odColumnArray = odColumnList.toArray(new OdColumnDef[odColumnList.size()]);
return new InternalOdTableDef(odColumnArray);
return new InternalOdTableDef(wrap(odColumnArray));
}
public static OdTableDefBuilder init() {
return new OdTableDefBuilder();
}
private static class InternalOdTableDef implements OdTableDef {
private final OdColumnDef[] odColumnArray;
private static class InternalOdTableDef implements OdTableDef {
private InternalOdTableDef(OdColumnDef[] odColumnArray) {
this.odColumnArray = odColumnArray;
}
private final List<OdColumnDef> odColumnList;
@Override
public int getOdColumnDefCount() {
return odColumnArray.length;
private InternalOdTableDef(List<OdColumnDef> odColumnList) {
this.odColumnList = odColumnList;
}
@Override
public OdColumnDef getOdColumnDef(int i) {
return odColumnArray[i];
public List<OdColumnDef> getOdColumnDefList() {
return odColumnList;
}
}
......@@ -66,12 +71,12 @@ public class OdTableDefBuilder {
private static class InternalOdColumnDef implements OdColumnDef {
private final short type;
private final int currencyInteger;
private final ExtendedCurrency currency;
private final String category;
private InternalOdColumnDef(short type, int currencyInteger, String category) {
private InternalOdColumnDef(short type, ExtendedCurrency currency, String category) {
this.type = type;
this.currencyInteger = currencyInteger;
this.currency = currency;
this.category = category;
}
......@@ -81,14 +86,40 @@ public class OdTableDefBuilder {
}
@Override
public int getCurrencyInteger() {
return currencyInteger;
public ExtendedCurrency getCurrency() {
return currency;
}
@Override
public String getCategory() {
return category;
}
}
public static List<OdColumnDef> wrap(OdColumnDef[] array) {
return new OdColumnDefList(array);
}
private static class OdColumnDefList extends AbstractList<OdColumnDef> implements RandomAccess {
private final OdColumnDef[] array;
private OdColumnDefList(OdColumnDef[] array) {
this.array = array;
}
@Override
public int size() {
return array.length;
}
@Override
public OdColumnDef get(int index) {
return array[index];
}
}
}
/* UtilLib - Copyright (c) 2015-2016 Vincent Calame - Exemole
/* UtilLib - Copyright (c) 2015-2018 Vincent Calame - Exemole
* Logiciel libre donné sous triple licence :
* 1) selon les termes de la CeCILL V2
* 2) selon les termes de l’EUPL V.1.1
......@@ -10,10 +10,10 @@
package net.mapeadores.util.format;
import java.math.BigDecimal;
import net.mapeadores.util.primitives.CurrencyInteger;
import net.mapeadores.util.primitives.CurrencyIntegerException;
import net.mapeadores.util.primitives.Decimal;
import java.text.ParseException;
import net.mapeadores.util.money.ExtendedCurrency;
import net.mapeadores.util.money.MoneyUtils;
import net.mapeadores.util.primitives.Decimal;
import net.mapeadores.util.text.StringUtils;
......@@ -69,25 +69,23 @@ public class SumEngine {
if (length == 0) {
return "";
}
int currencyInteger = 0;
ExtendedCurrency currency = null;
BigDecimal result = new BigDecimal(0);
for (int i = 0; i < length; i++) {
String token = tokens[i];
for (String token : tokens) {
String[] money = MoneyUtils.splitMoney(token);
if (money == null) {
return "#Not money: " + token;
}
int currentCurrencyInteger;
ExtendedCurrency currentCurrency;
try {
currentCurrencyInteger = CurrencyInteger.parse(money[1]);
} catch (CurrencyIntegerException cie) {
currentCurrency = ExtendedCurrency.parse(money[1]);
} catch (ParseException pe) {
return "#Invalid currency: " + money[1];
}
String currentCurrency = money[1];
if (currencyInteger == 0) {
currencyInteger = currentCurrencyInteger;
} else if (currentCurrencyInteger != currencyInteger) {
return "#Different currencies: " + CurrencyInteger.toString(currencyInteger) + " / " + CurrencyInteger.toString(currentCurrencyInteger);
if (currency == null) {
currency = currentCurrency;
} else if (!(currentCurrency.equals(currency))) {
return "#Different currencies: " + currency.getCurrencyCode() + " / " + currentCurrency.getCurrencyCode();
}
SignedToken signedToken = checkToken(money[0]);
try {
......@@ -97,10 +95,10 @@ public class SumEngine {
}
result = result.add(bigDecimal);
} catch (NumberFormatException nfe) {
return "#ERROR: " + tokens[i];
return "#ERROR: " + token;
}
}
return result.toString() + " " + CurrencyInteger.toString(currencyInteger);
return result.toString() + " " + currency.getCurrencyCode();
}
private static String computeInteger(String s) {
......
......@@ -70,7 +70,7 @@ public final class LangsUtils {
return new ArrayLangs(array);
}
public static boolean isEqual(Langs langs, Lang[] array) {
public static boolean areEquals(Langs langs, Lang[] array) {
int length = array.length;
if (length != langs.size()) {
return false;
......@@ -86,7 +86,7 @@ public final class LangsUtils {
return true;
}
public static boolean isEqual(Langs langs, Collection<Lang> collection) {
public static boolean areEquals(Langs langs, Collection<Lang> collection) {
int length = collection.size();
if (length != langs.size()) {
return false;
......
......@@ -9,12 +9,8 @@
package net.mapeadores.util.money;
import net.mapeadores.util.money.MoneyUtils;
import net.mapeadores.util.money.MoneyLong;
import java.text.DecimalFormatSymbols;
import java.text.ParseException;
import net.mapeadores.util.primitives.CurrencyInteger;
import net.mapeadores.util.primitives.CurrencyIntegerException;
import net.mapeadores.util.primitives.Decimal;
import net.mapeadores.util.text.StringUtils;
......@@ -26,49 +22,36 @@ import net.mapeadores.util.text.StringUtils;
public final class Amount {
private final long moneyLong;
private final int currencyInteger;
private final int fractionDigits;
private final ExtendedCurrency currency;
public Amount(long moneyLong, int currencyInteger) {
public Amount(long moneyLong, ExtendedCurrency currency) {
this.moneyLong = moneyLong;
this.currencyInteger = currencyInteger;
this.fractionDigits = CurrencyInteger.getSubunitLength(currencyInteger);
}
private Amount(long moneyLong, int currencyInteger, int fractionDigits) {
this.moneyLong = moneyLong;
this.currencyInteger = currencyInteger;
this.fractionDigits = fractionDigits;
this.currency = currency;
}
public long getMoneyLong() {
return moneyLong;
}
public int getCurrencyInteger() {
return currencyInteger;
public ExtendedCurrency getCurrency() {
return currency;
}
public String getCurrencyCode() {
return CurrencyInteger.toString(currencyInteger);
return currency.getCurrencyCode();
}
public Decimal toDecimal(boolean avoidDecimal) {
return MoneyLong.toDecimal(moneyLong, fractionDigits, avoidDecimal);
return MoneyLong.toDecimal(moneyLong, currency.getDefaultFractionDigits(), avoidDecimal);
}
@Override
public String toString() {
return MoneyLong.toString(moneyLong, fractionDigits);
return MoneyLong.toString(moneyLong, currency.getDefaultFractionDigits());
}
public String toLitteralString(DecimalFormatSymbols symbols, boolean avoidDecimal) {
return MoneyLong.toLitteralString(moneyLong, currencyInteger, symbols, avoidDecimal);
}
public static Amount fromDecimal(Decimal decimal, int currencyInteger) {
int fractionDigits = CurrencyInteger.getSubunitLength(currencyInteger);
return new Amount(MoneyLong.toMoneyLong(decimal, fractionDigits), currencyInteger, fractionDigits);
return MoneyUtils.toLitteralString(moneyLong, currency, symbols, avoidDecimal);
}
public static Amount parse(String s) throws ParseException {
......@@ -82,13 +65,13 @@ public final class Amount {
} catch (NumberFormatException nfe) {
throw new ParseException(result[0], 0);
}
int currencyInteger;
ExtendedCurrency currency;
try {
currencyInteger = CurrencyInteger.parse(result[1]);
} catch (CurrencyIntegerException cie) {
currency = ExtendedCurrency.parse(result[1]);
} catch (ParseException pe) {
throw new ParseException(result[1], 0);
}
return fromDecimal(decimal, currencyInteger);
return new Amount(MoneyLong.toMoneyLong(decimal, currency.getDefaultFractionDigits()), currency);
}
}
/* UtilLib - Copyright (c) 2008 Vincent Calame - Exemole
/* UtilLib - Copyright (c) 2018 Vincent Calame - Exemole
* Logiciel libre donné sous triple licence :
* 1) selon les termes de la CeCILL V2
* 2) selon les termes de l’EUPL V.1.1
......@@ -7,16 +7,16 @@
*/
package net.mapeadores.util.primitives;
package net.mapeadores.util.money;
import java.util.List;
import java.util.RandomAccess;
/**
*
* @author Vincent Calame
*/
public class CurrencyIntegerException extends Exception {
public CurrencyIntegerException() {
}
public interface Currencies extends List<ExtendedCurrency>, RandomAccess {