From 9f804a701e6f4543701ce36d6b376048d5508348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Graczyk?= Date: Thu, 2 Nov 2023 13:46:30 +0100 Subject: [PATCH] Checkstyle added (#145) * checkstyle added * checkstyle filled with rules, files properly formatted --------- Co-authored-by: Julia Glaszka <85160468+jglaszka@users.noreply.github.com> --- build.gradle.kts | 1 + config/checkstyle/checkstyle.xml | 236 ++++++++++++++++++ .../finance/tradukisto/ValueConverters.java | 4 +- .../internal/BigDecimalToStringConverter.java | 1 + .../tradukisto/internal/Container.java | 163 +++++++----- .../tradukisto/internal/NumberProcessor.java | 12 +- .../BigDecimalToBankingMoneyConverter.java | 6 +- .../converters/NumberToWordsConverter.java | 12 +- .../internal/languages/PluralForms.java | 1 + .../BulgarianIntegerToWordsConverter.java | 6 +- .../languages/bulgarian/BulgarianValues.java | 9 +- .../languages/croatian/CroatianValues.java | 15 +- .../czech/CzechIntegerToWordsConverter.java | 8 +- .../internal/languages/czech/CzechValues.java | 7 +- .../dutch/DutchIntegerToWordsConverter.java | 8 +- .../dutch/DutchThousandToWordsConverter.java | 1 + .../internal/languages/dutch/DutchValues.java | 5 +- .../languages/english/EnglishValues.java | 15 +- .../french/FrenchNumberToWordsConverter.java | 7 +- .../languages/french/FrenchValues.java | 8 +- .../german/GermanIntegerToWordsConverter.java | 8 +- .../languages/german/GermanValues.java | 5 +- ...indiBigDecimalToBankingMoneyConverter.java | 6 +- .../internal/languages/hindi/HindiValues.java | 195 ++++++++------- .../ItalianIntegerToWordsConverter.java | 8 +- .../languages/italian/ItalianValues.java | 5 +- .../languages/kazakh/KazakhValues.java | 8 +- .../languages/latvian/LatvianValues.java | 9 +- .../languages/polish/PolishValues.java | 15 +- .../portuguese/BrazilianPortugueseValues.java | 5 +- .../PortugueseIntegerToWordsConverter.java | 8 +- ...rtugueseNumberToWordsConverterAdapter.java | 8 +- .../PortugueseThousandToWordsConverter.java | 6 +- .../languages/russian/RussianValues.java | 9 +- .../serbian/SerbianCyrillicValues.java | 9 +- .../languages/serbian/SerbianValues.java | 9 +- .../languages/slovak/SlovakValues.java | 7 +- .../SpanishIntegerToWordsConverter.java | 8 +- ...SpanishIntegerToWordsConverterAdapter.java | 6 +- .../languages/spanish/SpanishValues.java | 4 +- .../languages/swedish/SwedishValues.java | 15 +- ...kishBigDecimalToBankingMoneyConverter.java | 6 +- .../TurkishIntegerToWordsConverter.java | 6 +- .../languages/turkish/TurkishValues.java | 5 +- .../languages/ukrainian/UkrainianValues.java | 9 +- 45 files changed, 609 insertions(+), 295 deletions(-) create mode 100644 config/checkstyle/checkstyle.xml diff --git a/build.gradle.kts b/build.gradle.kts index ce7592ef..8b09abdb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,6 +11,7 @@ plugins { id("java") id("groovy") id("jacoco") + id("checkstyle") id("maven-publish") id("signing") id("pl.allegro.tech.build.axion-release") version "1.13.3" diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 00000000..ec90f18d --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/pl/allegro/finance/tradukisto/ValueConverters.java b/src/main/java/pl/allegro/finance/tradukisto/ValueConverters.java index bcd4d3cc..5f84482a 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/ValueConverters.java +++ b/src/main/java/pl/allegro/finance/tradukisto/ValueConverters.java @@ -51,8 +51,8 @@ public static ValueConverters getByLocaleOrDefault(Locale locale, ValueConverter Objects.requireNonNull(locale); String languageCode = hasSpecifiedScript(locale) - ? getLanguageCodeFor(locale.getLanguage(), locale.getScript()) - : locale.getLanguage(); + ? getLanguageCodeFor(locale.getLanguage(), locale.getScript()) + : locale.getLanguage(); return getByLanguageCodeOrDefault(languageCode, defaultConverter); } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/BigDecimalToStringConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/BigDecimalToStringConverter.java index e5d17a31..c989be61 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/BigDecimalToStringConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/BigDecimalToStringConverter.java @@ -4,5 +4,6 @@ public interface BigDecimalToStringConverter { String asWords(BigDecimal value); + String asWords(BigDecimal value, String currencySymbol); } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/Container.java b/src/main/java/pl/allegro/finance/tradukisto/internal/Container.java index 7a0527ce..efbe4403 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/Container.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/Container.java @@ -72,17 +72,17 @@ public static Container serbianCyrillicContainer() { public static Container bulgarianContainer() { BulgarianValues bulgarianValues = new BulgarianValues(); - HundredsToWordsConverter hundredsToStringConverter = new HundredsToWordsConverter(bulgarianValues.baseNumbers(), - bulgarianValues.twoDigitsNumberSeparator()); + HundredsToWordsConverter hundredsToStringConverter = + new HundredsToWordsConverter(bulgarianValues.baseNumbers(), bulgarianValues.twoDigitsNumberSeparator()); IntegerToStringConverter integerToStringConverter = new BulgarianIntegerToWordsConverter( - hundredsToStringConverter, - bulgarianValues.pluralForms(), - bulgarianValues.oneThousandException()); + hundredsToStringConverter, + bulgarianValues.pluralForms(), + bulgarianValues.oneThousandException() + ); - BigDecimalToStringConverter bigDecimalConverter = new BigDecimalToBankingMoneyConverter( - integerToStringConverter, - bulgarianValues.currency()); + BigDecimalToStringConverter bigDecimalConverter = + new BigDecimalToBankingMoneyConverter(integerToStringConverter, bulgarianValues.currency()); return new Container(integerToStringConverter, null, bigDecimalConverter); } @@ -115,12 +115,12 @@ public static Container czechContainer() { Container containerForSmallNumbers = new Container(new CzechValuesForSmallNumbers()); IntegerToStringConverter integerConverter = new CzechIntegerToWordsConverter( - containerForBigNumbers.getIntegerConverter(), containerForSmallNumbers.getIntegerConverter(), - czechValues.exceptions() + containerForBigNumbers.getIntegerConverter(), + containerForSmallNumbers.getIntegerConverter(), + czechValues.exceptions() ); - BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = new BigDecimalToBankingMoneyConverter( - integerConverter, - czechValues.currency()); + BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = + new BigDecimalToBankingMoneyConverter(integerConverter, czechValues.currency()); return new Container(integerConverter, null, bigDecimalBankingMoneyValueConverter); } @@ -130,10 +130,13 @@ public static Container slovakContainer() { Container containerForBigNumbers = new Container(slovakValues); Container containerForSmallNumbers = new Container(new SlovakValuesForSmallNumbers()); - IntegerToStringConverter integerConverter = new CzechIntegerToWordsConverter(containerForBigNumbers.getIntegerConverter(), - containerForSmallNumbers.getIntegerConverter(), slovakValues.exceptions()); - BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = new BigDecimalToBankingMoneyConverter(integerConverter, - slovakValues.currency()); + IntegerToStringConverter integerConverter = new CzechIntegerToWordsConverter( + containerForBigNumbers.getIntegerConverter(), + containerForSmallNumbers.getIntegerConverter(), + slovakValues.exceptions() + ); + BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = + new BigDecimalToBankingMoneyConverter(integerConverter, slovakValues.currency()); return new Container(integerConverter, null, bigDecimalBankingMoneyValueConverter); } @@ -151,14 +154,14 @@ public static Container frenchContainer() { FrenchValues values = new FrenchValues(); HundredsToWordsConverter hundredsToWordsConverter = - new HundredsToWordsConverter(values.baseNumbers(), values.twoDigitsNumberSeparator()); + new HundredsToWordsConverter(values.baseNumbers(), values.twoDigitsNumberSeparator()); NumberToWordsConverter frenchNumberToWordsConverter = - new NumberToWordsConverter(hundredsToWordsConverter, values.pluralForms()); + new NumberToWordsConverter(hundredsToWordsConverter, values.pluralForms()); IntegerToStringConverter converter = - new FrenchNumberToWordsConverter(frenchNumberToWordsConverter, values.exceptions(), values.pluralForms()); + new FrenchNumberToWordsConverter(frenchNumberToWordsConverter, values.exceptions(), values.pluralForms()); BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = - new BigDecimalToBankingMoneyConverter(converter, values.currency()); + new BigDecimalToBankingMoneyConverter(converter, values.currency()); return new Container(converter, null, bigDecimalBankingMoneyValueConverter); } @@ -167,15 +170,16 @@ public static Container germanContainer() { GermanValues values = new GermanValues(); - GermanThousandToWordsConverter germanThousandToWordsConverter = new GermanThousandToWordsConverter( - values.baseNumbers()); + GermanThousandToWordsConverter germanThousandToWordsConverter = + new GermanThousandToWordsConverter(values.baseNumbers()); IntegerToStringConverter converter = new GermanIntegerToWordsConverter( - new NumberToWordsConverter(germanThousandToWordsConverter, values.pluralForms()), values.exceptions(), - germanThousandToWordsConverter); + new NumberToWordsConverter(germanThousandToWordsConverter, values.pluralForms()), values.exceptions(), + germanThousandToWordsConverter + ); - BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = new BigDecimalToBankingMoneyConverter( - converter, values.currency()); + BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = + new BigDecimalToBankingMoneyConverter(converter, values.currency()); return new Container(converter, null, bigDecimalBankingMoneyValueConverter); } @@ -184,15 +188,16 @@ public static Container dutchContainer() { DutchValues values = new DutchValues(); - DutchThousandToWordsConverter dutchThousandToWordsConverter = new DutchThousandToWordsConverter( - values.baseNumbers()); + DutchThousandToWordsConverter dutchThousandToWordsConverter = + new DutchThousandToWordsConverter(values.baseNumbers()); IntegerToStringConverter converter = new DutchIntegerToWordsConverter( - new NumberToWordsConverter(dutchThousandToWordsConverter, values.pluralForms()), values.exceptions(), - dutchThousandToWordsConverter); + new NumberToWordsConverter(dutchThousandToWordsConverter, values.pluralForms()), values.exceptions(), + dutchThousandToWordsConverter + ); - BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = new BigDecimalToBankingMoneyConverter( - converter, values.currency()); + BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = + new BigDecimalToBankingMoneyConverter(converter, values.currency()); return new Container(converter, null, bigDecimalBankingMoneyValueConverter); } @@ -200,15 +205,16 @@ public static Container dutchContainer() { public static Container italianContainer() { ItalianValues values = new ItalianValues(); - ItalianThousandToWordsConverter italianThousandToWordsConverter = new ItalianThousandToWordsConverter( - values.baseNumbers()); + ItalianThousandToWordsConverter italianThousandToWordsConverter = + new ItalianThousandToWordsConverter(values.baseNumbers()); IntegerToStringConverter converter = new ItalianIntegerToWordsConverter( - new NumberToWordsConverter(italianThousandToWordsConverter, values.pluralForms()), values.exceptions(), - italianThousandToWordsConverter); + new NumberToWordsConverter(italianThousandToWordsConverter, values.pluralForms()), values.exceptions(), + italianThousandToWordsConverter + ); - BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = new BigDecimalToBankingMoneyConverter( - converter, values.currency()); + BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = + new BigDecimalToBankingMoneyConverter(converter, values.currency()); return new Container(converter, null, bigDecimalBankingMoneyValueConverter); } @@ -221,14 +227,17 @@ public static Container brazilianPortugueseContainer() { BrazilianPortugueseValues values = new BrazilianPortugueseValues(); PortugueseThousandToWordsConverter portugueseThousandToWordsConverter = new PortugueseThousandToWordsConverter( - values.baseNumbers(), values.exceptions()); + values.baseNumbers(), + values.exceptions() + ); IntegerToStringConverter converter = new PortugueseIntegerToWordsConverter( - new PortugueseNumberToWordsConverterAdapter(portugueseThousandToWordsConverter, values.pluralForms()), values.exceptions(), - portugueseThousandToWordsConverter); + new PortugueseNumberToWordsConverterAdapter(portugueseThousandToWordsConverter, values.pluralForms()), values.exceptions(), + portugueseThousandToWordsConverter + ); - BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = new BigDecimalToBankingMoneyConverter( - converter, values.currency()); + BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = + new BigDecimalToBankingMoneyConverter(converter, values.currency()); return new Container(converter, null, bigDecimalBankingMoneyValueConverter); } @@ -239,9 +248,9 @@ public static Container turkishContainer() { TurkishSmallNumbersToWordsConverter smallNumbersConverter = new TurkishSmallNumbersToWordsConverter(values); NumberToWordsConverter bigNumbersConverter = new NumberToWordsConverter(smallNumbersConverter, values.pluralForms()); IntegerToStringConverter converter = - new TurkishIntegerToWordsConverter(bigNumbersConverter, smallNumbersConverter); + new TurkishIntegerToWordsConverter(bigNumbersConverter, smallNumbersConverter); BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = - new TurkishBigDecimalToBankingMoneyConverter(converter, values); + new TurkishBigDecimalToBankingMoneyConverter(converter, values); return new Container(converter, null, bigDecimalBankingMoneyValueConverter); } @@ -254,14 +263,18 @@ public static Container kazakhContainer() { public static Container hindiContainer() { HindiValues hindiValues = new HindiValues(); - HundredsToWordsConverter hundredsToStringConverter = new HundredsToWordsConverter(hindiValues.baseNumbers(), - hindiValues.twoDigitsNumberSeparator()); + HundredsToWordsConverter hundredsToStringConverter = new HundredsToWordsConverter( + hindiValues.baseNumbers(), + hindiValues.twoDigitsNumberSeparator() + ); - IntegerToStringConverter integerToStringConverter = new IndianNumberToWordsConverter(hundredsToStringConverter, hindiValues.pluralForms()); + IntegerToStringConverter integerToStringConverter = new IndianNumberToWordsConverter( + hundredsToStringConverter, + hindiValues.pluralForms() + ); - BigDecimalToStringConverter bigDecimalConverter = new HindiBigDecimalToBankingMoneyConverter( - integerToStringConverter, - hindiValues); + BigDecimalToStringConverter bigDecimalConverter = + new HindiBigDecimalToBankingMoneyConverter(integerToStringConverter, hindiValues); LongToStringConverter longValueConverters = new IndianNumberToWordsConverter(hundredsToStringConverter, hindiValues.pluralForms()); return new Container(integerToStringConverter, longValueConverters, bigDecimalConverter); @@ -271,14 +284,20 @@ public static Container spanishContainer() { SpanishValues values = new SpanishValues(); SpanishThousandToWordsConverter spanishThousandToWordsConverter = new SpanishThousandToWordsConverter( - values.baseNumbers(), values.exceptions()); + values.baseNumbers(), + values.exceptions() + ); IntegerToStringConverter converter = new SpanishIntegerToWordsConverter( - new SpanishIntegerToWordsConverterAdapter(spanishThousandToWordsConverter, values.pluralForms()), - values.exceptions(), spanishThousandToWordsConverter); + new SpanishIntegerToWordsConverterAdapter(spanishThousandToWordsConverter, values.pluralForms()), + values.exceptions(), + spanishThousandToWordsConverter + ); BigDecimalToStringConverter bigDecimalBankingMoneyValueConverter = new BigDecimalToBankingMoneyConverter( - converter, values.currency()); + converter, + values.currency() + ); return new Container(converter, null, bigDecimalBankingMoneyValueConverter); } @@ -287,15 +306,15 @@ public static Container swedishContainer() { SwedishValues swedishBaseValues = new SwedishValues(); SwedishHundredToWordsConverter swedishHundredsToStringConverter = - new SwedishHundredToWordsConverter(swedishBaseValues.baseNumbers()); + new SwedishHundredToWordsConverter(swedishBaseValues.baseNumbers()); NumberToWordsConverter swedishNumberToWordsConverter = new NumberToWordsConverter( - swedishHundredsToStringConverter, - swedishBaseValues.pluralForms()); + swedishHundredsToStringConverter, + swedishBaseValues.pluralForms()); BigDecimalToStringConverter swedishBigDecimalConverter = new BigDecimalToBankingMoneyConverter( - swedishNumberToWordsConverter, - swedishBaseValues.currency()); + swedishNumberToWordsConverter, + swedishBaseValues.currency()); return new Container(swedishNumberToWordsConverter, swedishNumberToWordsConverter, swedishBigDecimalConverter); } @@ -305,21 +324,27 @@ public static Container swedishContainer() { private final BigDecimalToStringConverter bigDecimalConverter; private Container(BaseValues baseValues) { - HundredsToWordsConverter hundredsToStringConverter = new HundredsToWordsConverter(baseValues.baseNumbers(), - baseValues.twoDigitsNumberSeparator()); + HundredsToWordsConverter hundredsToStringConverter = new HundredsToWordsConverter( + baseValues.baseNumbers(), + baseValues.twoDigitsNumberSeparator() + ); NumberToWordsConverter numberToWordsConverter = new NumberToWordsConverter( - hundredsToStringConverter, - baseValues.pluralForms()); + hundredsToStringConverter, + baseValues.pluralForms() + ); integerConverter = numberToWordsConverter; longConverter = numberToWordsConverter; bigDecimalConverter = new BigDecimalToBankingMoneyConverter( - integerConverter, - baseValues.currency()); + integerConverter, + baseValues.currency()); } - private Container(IntegerToStringConverter integerConverter, - LongToStringConverter longConverter, BigDecimalToStringConverter bigDecimalConverter) { + private Container( + IntegerToStringConverter integerConverter, + LongToStringConverter longConverter, + BigDecimalToStringConverter bigDecimalConverter + ) { this.integerConverter = integerConverter; this.longConverter = longConverter; this.bigDecimalConverter = bigDecimalConverter; diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/NumberProcessor.java b/src/main/java/pl/allegro/finance/tradukisto/internal/NumberProcessor.java index 982da801..b1e598f1 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/NumberProcessor.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/NumberProcessor.java @@ -10,14 +10,18 @@ public class NumberProcessor { private final IntegerToStringConverter bigNumbersConverter; private final GenderAwareIntegerToStringConverter smallNumbersConverter; - public NumberProcessor(IntegerToStringConverter bigNumbersConverter, - IntegerToStringConverter smallNumbersConverter) { + public NumberProcessor( + IntegerToStringConverter bigNumbersConverter, + IntegerToStringConverter smallNumbersConverter + ) { this.bigNumbersConverter = bigNumbersConverter; this.smallNumbersConverter = ToStringConverter.toGenderAwareInteger(smallNumbersConverter); } - public NumberProcessor(IntegerToStringConverter bigNumbersConverter, - GenderAwareIntegerToStringConverter smallNumbersConverter) { + public NumberProcessor( + IntegerToStringConverter bigNumbersConverter, + GenderAwareIntegerToStringConverter smallNumbersConverter + ) { this.bigNumbersConverter = bigNumbersConverter; this.smallNumbersConverter = smallNumbersConverter; } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/converters/BigDecimalToBankingMoneyConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/converters/BigDecimalToBankingMoneyConverter.java index 3b2cc397..9556cd05 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/converters/BigDecimalToBankingMoneyConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/converters/BigDecimalToBankingMoneyConverter.java @@ -38,13 +38,13 @@ public String asWords(BigDecimal value, String currencySymbol) { private void validate(BigDecimal value) { Assert.isTrue(value.scale() <= MAXIMAL_DECIMAL_PLACES_COUNT, - () -> String.format("can't transform more than %s decimal places for value %s", MAXIMAL_DECIMAL_PLACES_COUNT, value)); + () -> String.format("can't transform more than %s decimal places for value %s", MAXIMAL_DECIMAL_PLACES_COUNT, value)); Assert.isTrue(valueLessThatIntMax(value), - () -> String.format("can't transform numbers greater than Integer.MAX_VALUE for value %s", value)); + () -> String.format("can't transform numbers greater than Integer.MAX_VALUE for value %s", value)); Assert.isTrue(valueGreaterThanOrEqualToZero(value), - () -> String.format("can't transform negative numbers for value %s", value)); + () -> String.format("can't transform negative numbers for value %s", value)); } private boolean valueLessThatIntMax(BigDecimal value) { diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/converters/NumberToWordsConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/converters/NumberToWordsConverter.java index e051554e..ae2f9301 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/converters/NumberToWordsConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/converters/NumberToWordsConverter.java @@ -21,14 +21,18 @@ public class NumberToWordsConverter implements IntegerToStringConverter, LongToS protected final GenderAwareIntegerToStringConverter hundredsToWordsConverter; private final List pluralForms; - public NumberToWordsConverter(GenderAwareIntegerToStringConverter hundredsToWordsConverter, - List pluralForms) { + public NumberToWordsConverter( + GenderAwareIntegerToStringConverter hundredsToWordsConverter, + List pluralForms + ) { this.hundredsToWordsConverter = hundredsToWordsConverter; this.pluralForms = pluralForms; } - public NumberToWordsConverter(final IntegerToStringConverter hundredsToWordsConverter, - List pluralForms) { + public NumberToWordsConverter( + final IntegerToStringConverter hundredsToWordsConverter, + List pluralForms + ) { this.hundredsToWordsConverter = ToStringConverter.toGenderAwareInteger(hundredsToWordsConverter); this.pluralForms = pluralForms; } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/PluralForms.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/PluralForms.java index 2e49adcf..05f0b810 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/PluralForms.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/PluralForms.java @@ -3,5 +3,6 @@ public interface PluralForms { String formFor(Integer value); + GenderType genderType(); } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/bulgarian/BulgarianIntegerToWordsConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/bulgarian/BulgarianIntegerToWordsConverter.java index ced38720..2a9e2f6b 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/bulgarian/BulgarianIntegerToWordsConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/bulgarian/BulgarianIntegerToWordsConverter.java @@ -16,7 +16,11 @@ public class BulgarianIntegerToWordsConverter extends NumberToWordsConverter { private static final int ONE_THOUSAND = 1000; private static final int TWO_THOUSAND = 2000; - public BulgarianIntegerToWordsConverter(HundredsToWordsConverter hundredsToStringConverter, List pluralForms, String oneThousand) { + public BulgarianIntegerToWordsConverter( + HundredsToWordsConverter hundredsToStringConverter, + List pluralForms, + String oneThousand + ) { super(hundredsToStringConverter, pluralForms); this.oneThousand = oneThousand; } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/bulgarian/BulgarianValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/bulgarian/BulgarianValues.java index e21249fc..abe759d0 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/bulgarian/BulgarianValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/bulgarian/BulgarianValues.java @@ -60,10 +60,11 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new SlavicPluralForms("", "", "", GenderType.MASCULINE), - new SlavicPluralForms("хиляди", "хиляди", "хиляди", GenderType.FEMININE), - new SlavicPluralForms("милион", "милиона", "милиона", GenderType.MASCULINE), - new SlavicPluralForms("милиард", "милиарда", "милиарда", GenderType.MASCULINE)); + new SlavicPluralForms("", "", "", GenderType.MASCULINE), + new SlavicPluralForms("хиляди", "хиляди", "хиляди", GenderType.FEMININE), + new SlavicPluralForms("милион", "милиона", "милиона", GenderType.MASCULINE), + new SlavicPluralForms("милиард", "милиарда", "милиарда", GenderType.MASCULINE) + ); } @Override diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/croatian/CroatianValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/croatian/CroatianValues.java index b545e307..dc5fd9cb 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/croatian/CroatianValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/croatian/CroatianValues.java @@ -60,13 +60,14 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new SlavicPluralForms("", "", "", GenderType.MASCULINE), - new SlavicPluralForms("tisuća", "tisuće", "tisuća", GenderType.FEMININE), - new SlavicPluralForms("milijun", "milijuna", "milijuna", GenderType.MASCULINE), - new SlavicPluralForms("milijarda", "milijarde", "milijardi", GenderType.FEMININE), - new SlavicPluralForms("bilijun", "bilijuna", "bilijuna", GenderType.MASCULINE), - new SlavicPluralForms("bilijarda", "bilijarde", "bilijardi", GenderType.FEMININE), - new SlavicPluralForms("trilijun", "trilijuna", "trilijuna", GenderType.MASCULINE)); + new SlavicPluralForms("", "", "", GenderType.MASCULINE), + new SlavicPluralForms("tisuća", "tisuće", "tisuća", GenderType.FEMININE), + new SlavicPluralForms("milijun", "milijuna", "milijuna", GenderType.MASCULINE), + new SlavicPluralForms("milijarda", "milijarde", "milijardi", GenderType.FEMININE), + new SlavicPluralForms("bilijun", "bilijuna", "bilijuna", GenderType.MASCULINE), + new SlavicPluralForms("bilijarda", "bilijarde", "bilijardi", GenderType.FEMININE), + new SlavicPluralForms("trilijun", "trilijuna", "trilijuna", GenderType.MASCULINE) + ); } @Override diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/czech/CzechIntegerToWordsConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/czech/CzechIntegerToWordsConverter.java index 97239ac1..f61c42bc 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/czech/CzechIntegerToWordsConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/czech/CzechIntegerToWordsConverter.java @@ -11,9 +11,11 @@ public class CzechIntegerToWordsConverter implements IntegerToStringConverter { private final IntegerToStringConverter smallNumbersConverter; private final Map exceptions; - public CzechIntegerToWordsConverter(IntegerToStringConverter bigNumbersConverter, - IntegerToStringConverter smallNumbersConverter, - Map exceptions) { + public CzechIntegerToWordsConverter( + IntegerToStringConverter bigNumbersConverter, + IntegerToStringConverter smallNumbersConverter, + Map exceptions + ) { this.bigNumbersConverter = bigNumbersConverter; this.smallNumbersConverter = smallNumbersConverter; this.exceptions = exceptions; diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/czech/CzechValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/czech/CzechValues.java index 99e44c33..84da7100 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/czech/CzechValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/czech/CzechValues.java @@ -61,9 +61,10 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new CzechPluralForms("tisíc", "tisíce", "tisíc", GenderType.MASCULINE), - new CzechPluralForms("milion", "miliony", "milionů", GenderType.MASCULINE), - new CzechPluralForms("miliarda", "miliardy", "miliard", GenderType.FEMININE)); + new CzechPluralForms("tisíc", "tisíce", "tisíc", GenderType.MASCULINE), + new CzechPluralForms("milion", "miliony", "milionů", GenderType.MASCULINE), + new CzechPluralForms("miliarda", "miliardy", "miliard", GenderType.FEMININE) + ); } @Override diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/dutch/DutchIntegerToWordsConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/dutch/DutchIntegerToWordsConverter.java index 97260421..fc7b46b1 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/dutch/DutchIntegerToWordsConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/dutch/DutchIntegerToWordsConverter.java @@ -12,9 +12,11 @@ public class DutchIntegerToWordsConverter implements IntegerToStringConverter { private final Map exceptions; private final GenderAwareIntegerToStringConverter smallNumbersConverter; - public DutchIntegerToWordsConverter(IntegerToStringConverter bigNumbersConverter, - Map exceptions, - GenderAwareIntegerToStringConverter smallNumbersConverter) { + public DutchIntegerToWordsConverter( + IntegerToStringConverter bigNumbersConverter, + Map exceptions, + GenderAwareIntegerToStringConverter smallNumbersConverter + ) { this.bigNumbersConverter = bigNumbersConverter; this.exceptions = exceptions; this.smallNumbersConverter = smallNumbersConverter; diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/dutch/DutchThousandToWordsConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/dutch/DutchThousandToWordsConverter.java index c112f5dd..36941d9f 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/dutch/DutchThousandToWordsConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/dutch/DutchThousandToWordsConverter.java @@ -8,6 +8,7 @@ import java.util.Map; import static java.lang.String.format; + public class DutchThousandToWordsConverter implements GenderAwareIntegerToStringConverter { private final Map baseValues; diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/dutch/DutchValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/dutch/DutchValues.java index 8b96e423..3e5a7c7d 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/dutch/DutchValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/dutch/DutchValues.java @@ -62,8 +62,9 @@ public Map exceptions() { public List pluralForms() { return Arrays.asList( - new DutchPluralForms("miljoen"), - new DutchPluralForms("miljard")); + new DutchPluralForms("miljoen"), + new DutchPluralForms("miljard") + ); } public String currency() { diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/english/EnglishValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/english/EnglishValues.java index 5dc9182e..9c1932ac 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/english/EnglishValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/english/EnglishValues.java @@ -58,13 +58,14 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new EnglishPluralForms(""), - new EnglishPluralForms("thousand"), - new EnglishPluralForms("million"), - new EnglishPluralForms("billion"), - new EnglishPluralForms("trillion"), - new EnglishPluralForms("quadrillion"), - new EnglishPluralForms("quintillion")); + new EnglishPluralForms(""), + new EnglishPluralForms("thousand"), + new EnglishPluralForms("million"), + new EnglishPluralForms("billion"), + new EnglishPluralForms("trillion"), + new EnglishPluralForms("quadrillion"), + new EnglishPluralForms("quintillion") + ); } @Override diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/french/FrenchNumberToWordsConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/french/FrenchNumberToWordsConverter.java index c2e54141..f71096eb 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/french/FrenchNumberToWordsConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/french/FrenchNumberToWordsConverter.java @@ -15,11 +15,10 @@ public class FrenchNumberToWordsConverter extends NumberToWordsConverter { private final Map exceptions; public FrenchNumberToWordsConverter( - IntegerToStringConverter integerToStringConverter, - Map exceptions, - List pluralForms + IntegerToStringConverter integerToStringConverter, + Map exceptions, + List pluralForms ) { - super(integerToStringConverter, pluralForms); this.exceptions = exceptions; } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/french/FrenchValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/french/FrenchValues.java index 1940c54c..496257b5 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/french/FrenchValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/french/FrenchValues.java @@ -95,10 +95,10 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new RegularPluralForms("", "", GenderType.MASCULINE), - new RegularPluralForms("mille", "mille" , GenderType.MASCULINE), - new RegularPluralForms("million", "millions", GenderType.MASCULINE), - new RegularPluralForms("milliard", "milliards", GenderType.MASCULINE) + new RegularPluralForms("", "", GenderType.MASCULINE), + new RegularPluralForms("mille", "mille", GenderType.MASCULINE), + new RegularPluralForms("million", "millions", GenderType.MASCULINE), + new RegularPluralForms("milliard", "milliards", GenderType.MASCULINE) ); } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/german/GermanIntegerToWordsConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/german/GermanIntegerToWordsConverter.java index 15bc9874..d058d52d 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/german/GermanIntegerToWordsConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/german/GermanIntegerToWordsConverter.java @@ -12,9 +12,11 @@ public class GermanIntegerToWordsConverter implements IntegerToStringConverter { private final Map exceptions; private final GenderAwareIntegerToStringConverter smallNumbersConverter; - public GermanIntegerToWordsConverter(IntegerToStringConverter bigNumbersConverter, - Map exceptions, - GenderAwareIntegerToStringConverter smallNumbersConverter) { + public GermanIntegerToWordsConverter( + IntegerToStringConverter bigNumbersConverter, + Map exceptions, + GenderAwareIntegerToStringConverter smallNumbersConverter + ) { this.bigNumbersConverter = bigNumbersConverter; this.exceptions = exceptions; this.smallNumbersConverter = smallNumbersConverter; diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/german/GermanValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/german/GermanValues.java index 03c6f0b8..e0106181 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/german/GermanValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/german/GermanValues.java @@ -63,8 +63,9 @@ public Map exceptions() { public List pluralForms() { return Arrays.asList( - new RegularPluralForms("Million", "Millionen", GenderType.FEMININE), - new RegularPluralForms("Milliarde", "Milliarden", GenderType.FEMININE)); + new RegularPluralForms("Million", "Millionen", GenderType.FEMININE), + new RegularPluralForms("Milliarde", "Milliarden", GenderType.FEMININE) + ); } public String currency() { diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/hindi/HindiBigDecimalToBankingMoneyConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/hindi/HindiBigDecimalToBankingMoneyConverter.java index 6e2a05db..e93b9300 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/hindi/HindiBigDecimalToBankingMoneyConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/hindi/HindiBigDecimalToBankingMoneyConverter.java @@ -49,13 +49,13 @@ public String asWords(BigDecimal value, String currencySymbol) { private void validate(BigDecimal value) { Assert.isTrue(value.scale() <= MAXIMAL_DECIMAL_PLACES_COUNT, - () -> String.format("can't transform more than %s decimal places for value %s", MAXIMAL_DECIMAL_PLACES_COUNT, value)); + () -> String.format("can't transform more than %s decimal places for value %s", MAXIMAL_DECIMAL_PLACES_COUNT, value)); Assert.isTrue(valueLessThanIntMax(value), - () -> String.format("can't transform numbers greater than Integer.MAX_VALUE for value %s", value)); + () -> String.format("can't transform numbers greater than Integer.MAX_VALUE for value %s", value)); Assert.isTrue(valueGreaterThanOrEqualToZero(value), - () -> String.format("can't transform negative numbers for value %s", value)); + () -> String.format("can't transform negative numbers for value %s", value)); } private boolean valueLessThanIntMax(BigDecimal value) { diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/hindi/HindiValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/hindi/HindiValues.java index 9e634174..3d87fd61 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/hindi/HindiValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/hindi/HindiValues.java @@ -38,92 +38,92 @@ public Map baseNumbers() { .put(19, "उन्नीस") .put(20, "बीस") - .put(21,"इक्कीस") - .put(22,"बाईस") - .put(23,"तेईस") - .put(24,"चौबीस") - .put(25,"पच्चीस") - .put(26,"छब्बीस") - .put(27,"सत्ताईस") - .put(28,"अट्ठाईस") - .put(29,"उनतीस") - .put(30,"तीस") - - .put(31,"इकत्तीस") - .put(32,"बत्तीस") - .put(33,"तेंतीस") - .put(34,"चौंतीस") - .put(35,"पैंतीस") - .put(36,"छत्तीस") - .put(37,"सैंतीस") - .put(38,"अड़तीस") - .put(39,"उनतालीस") - .put(40,"चालीस") - - .put(41,"एकतालीस") - .put(42,"बायलीस") - .put(43,"तैंतालीस") - .put(44,"चौवालीस") - .put(45,"पैंतालिस") - .put(46,"छियालीस") - .put(47,"सैंतालीस") - .put(48,"अड़तालीस") - .put(49,"उनचास") - .put(50,"पचास") - - .put(51,"इक्यबन") - .put(52,"बावन") - .put(53,"तिरपन") - .put(54,"चौवन") - .put(55,"पचपन") - .put(56,"छप्पन") - .put(57,"सत्तावन") - .put(58,"अट्ठावन") - .put(59,"उनसठ") - .put(60,"साठ") - - .put(61,"इकसठ") - .put(62,"बासठ") - .put(63,"तिरसठ") - .put(64,"चौंसठ") - .put(65,"पैंसठ") - .put(66,"छियासठ") - .put(67,"सड़सठ") - .put(68,"सड़सठ") - .put(69,"उनहत्तर") - .put(70,"सत्तर") - - .put(71,"इकहत्तर") - .put(72,"बहत्तर") - .put(73,"तिहत्तर") - .put(74,"चौहत्तर") - .put(75,"पचहत्तर") - .put(76,"छीहत्तर") - .put(77,"सतहत्तर") - .put(78,"अठहत्तर") - .put(79,"उनासी") - .put(80,"असी") - - .put(81,"इक्यासी") - .put(82,"बयासी") - .put(83,"तिरासी") - .put(84,"चौरासी") - .put(85,"पचासी") - .put(86,"छियासी") - .put(87,"सतासी") - .put(88,"अट्ठासी") - .put(89,"नवासी") - .put(90,"नब्बे") - - .put(91,"इक्यानवे") - .put(92,"बानवे") - .put(93,"तिरानवे") - .put(94,"चौरानवे") - .put(95,"पचानवे") - .put(96,"छियानवे") - .put(97,"सतानवे") - .put(98,"अट्ठानवे") - .put(99,"निन्यानवे") + .put(21, "इक्कीस") + .put(22, "बाईस") + .put(23, "तेईस") + .put(24, "चौबीस") + .put(25, "पच्चीस") + .put(26, "छब्बीस") + .put(27, "सत्ताईस") + .put(28, "अट्ठाईस") + .put(29, "उनतीस") + .put(30, "तीस") + + .put(31, "इकत्तीस") + .put(32, "बत्तीस") + .put(33, "तेंतीस") + .put(34, "चौंतीस") + .put(35, "पैंतीस") + .put(36, "छत्तीस") + .put(37, "सैंतीस") + .put(38, "अड़तीस") + .put(39, "उनतालीस") + .put(40, "चालीस") + + .put(41, "एकतालीस") + .put(42, "बायलीस") + .put(43, "तैंतालीस") + .put(44, "चौवालीस") + .put(45, "पैंतालिस") + .put(46, "छियालीस") + .put(47, "सैंतालीस") + .put(48, "अड़तालीस") + .put(49, "उनचास") + .put(50, "पचास") + + .put(51, "इक्यबन") + .put(52, "बावन") + .put(53, "तिरपन") + .put(54, "चौवन") + .put(55, "पचपन") + .put(56, "छप्पन") + .put(57, "सत्तावन") + .put(58, "अट्ठावन") + .put(59, "उनसठ") + .put(60, "साठ") + + .put(61, "इकसठ") + .put(62, "बासठ") + .put(63, "तिरसठ") + .put(64, "चौंसठ") + .put(65, "पैंसठ") + .put(66, "छियासठ") + .put(67, "सड़सठ") + .put(68, "सड़सठ") + .put(69, "उनहत्तर") + .put(70, "सत्तर") + + .put(71, "इकहत्तर") + .put(72, "बहत्तर") + .put(73, "तिहत्तर") + .put(74, "चौहत्तर") + .put(75, "पचहत्तर") + .put(76, "छीहत्तर") + .put(77, "सतहत्तर") + .put(78, "अठहत्तर") + .put(79, "उनासी") + .put(80, "असी") + + .put(81, "इक्यासी") + .put(82, "बयासी") + .put(83, "तिरासी") + .put(84, "चौरासी") + .put(85, "पचासी") + .put(86, "छियासी") + .put(87, "सतासी") + .put(88, "अट्ठासी") + .put(89, "नवासी") + .put(90, "नब्बे") + + .put(91, "इक्यानवे") + .put(92, "बानवे") + .put(93, "तिरानवे") + .put(94, "चौरानवे") + .put(95, "पचानवे") + .put(96, "छियानवे") + .put(97, "सतानवे") + .put(98, "अट्ठानवे") + .put(99, "निन्यानवे") .put(100, "एक सौ") .put(200, "दो सौ") @@ -140,16 +140,17 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new EnglishPluralForms(""), - new EnglishPluralForms("हजार"), - new EnglishPluralForms("लाख"), - new EnglishPluralForms("करोड़"), - new EnglishPluralForms("अरब"), - new EnglishPluralForms("खरब"), - new EnglishPluralForms("नील"), - new EnglishPluralForms("पद्म"), - new EnglishPluralForms("शंख"), - new EnglishPluralForms("महाशंख")); + new EnglishPluralForms(""), + new EnglishPluralForms("हजार"), + new EnglishPluralForms("लाख"), + new EnglishPluralForms("करोड़"), + new EnglishPluralForms("अरब"), + new EnglishPluralForms("खरब"), + new EnglishPluralForms("नील"), + new EnglishPluralForms("पद्म"), + new EnglishPluralForms("शंख"), + new EnglishPluralForms("महाशंख") + ); } @Override @@ -162,7 +163,7 @@ public char twoDigitsNumberSeparator() { return '\0'; } - public String paiseSymbol(){ + public String paiseSymbol() { return "p"; } } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/italian/ItalianIntegerToWordsConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/italian/ItalianIntegerToWordsConverter.java index d259a4c0..49d206a6 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/italian/ItalianIntegerToWordsConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/italian/ItalianIntegerToWordsConverter.java @@ -12,9 +12,11 @@ public class ItalianIntegerToWordsConverter implements IntegerToStringConverter private final Map exceptions; private final GenderAwareIntegerToStringConverter smallNumbersConverter; - public ItalianIntegerToWordsConverter(IntegerToStringConverter bigNumbersConverter, - Map exceptions, - GenderAwareIntegerToStringConverter smallNumbersConverter) { + public ItalianIntegerToWordsConverter( + IntegerToStringConverter bigNumbersConverter, + Map exceptions, + GenderAwareIntegerToStringConverter smallNumbersConverter + ) { this.bigNumbersConverter = bigNumbersConverter; this.exceptions = exceptions; this.smallNumbersConverter = smallNumbersConverter; diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/italian/ItalianValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/italian/ItalianValues.java index 97a754bb..3a05715a 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/italian/ItalianValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/italian/ItalianValues.java @@ -75,8 +75,9 @@ public Map baseNumbers() { public List pluralForms() { return Arrays.asList( - new RegularPluralForms("milione", "milioni", GenderType.MASCULINE), - new RegularPluralForms("miliardo", "miliardi", GenderType.MASCULINE)); + new RegularPluralForms("milione", "milioni", GenderType.MASCULINE), + new RegularPluralForms("miliardo", "miliardi", GenderType.MASCULINE) + ); } public String currency() { diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/kazakh/KazakhValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/kazakh/KazakhValues.java index 3c24179d..bfad9ec9 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/kazakh/KazakhValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/kazakh/KazakhValues.java @@ -58,10 +58,10 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new KazakhPluralForms(""), - new KazakhPluralForms("мың"), - new KazakhPluralForms("миллион"), - new KazakhPluralForms("миллиард") + new KazakhPluralForms(""), + new KazakhPluralForms("мың"), + new KazakhPluralForms("миллион"), + new KazakhPluralForms("миллиард") ); } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/latvian/LatvianValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/latvian/LatvianValues.java index c725c4ed..bcf97062 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/latvian/LatvianValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/latvian/LatvianValues.java @@ -60,10 +60,11 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new LatvianPluralForms("", "", GenderType.MASCULINE), - new LatvianPluralForms("tūkstotis", "tūkstoši", GenderType.MASCULINE), - new LatvianPluralForms("miljons", "miljoni", GenderType.MASCULINE), - new LatvianPluralForms("miljards", "miljardi", GenderType.MASCULINE)); + new LatvianPluralForms("", "", GenderType.MASCULINE), + new LatvianPluralForms("tūkstotis", "tūkstoši", GenderType.MASCULINE), + new LatvianPluralForms("miljons", "miljoni", GenderType.MASCULINE), + new LatvianPluralForms("miljards", "miljardi", GenderType.MASCULINE) + ); } @Override diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/polish/PolishValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/polish/PolishValues.java index 8f42a2e7..e78ea51b 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/polish/PolishValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/polish/PolishValues.java @@ -58,13 +58,14 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new PolishPluralForms("", "", ""), - new PolishPluralForms("tysiąc", "tysiące", "tysięcy"), - new PolishPluralForms("milion", "miliony", "milionów"), - new PolishPluralForms("miliard", "miliardy", "miliardów"), - new PolishPluralForms("bilion", "biliony", "bilionów"), - new PolishPluralForms("biliard", "biliardy", "biliardów"), - new PolishPluralForms("trylion", "tryliony", "trylionów")); + new PolishPluralForms("", "", ""), + new PolishPluralForms("tysiąc", "tysiące", "tysięcy"), + new PolishPluralForms("milion", "miliony", "milionów"), + new PolishPluralForms("miliard", "miliardy", "miliardów"), + new PolishPluralForms("bilion", "biliony", "bilionów"), + new PolishPluralForms("biliard", "biliardy", "biliardów"), + new PolishPluralForms("trylion", "tryliony", "trylionów") + ); } @Override diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/BrazilianPortugueseValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/BrazilianPortugueseValues.java index 6e522a8c..4da50914 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/BrazilianPortugueseValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/BrazilianPortugueseValues.java @@ -61,8 +61,9 @@ public Map exceptions() { public List pluralForms() { return Arrays.asList( - new RegularPluralForms("milhão", "milhões"), - new RegularPluralForms("bilhão", "bilhões")); + new RegularPluralForms("milhão", "milhões"), + new RegularPluralForms("bilhão", "bilhões") + ); } public String currency() { diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/PortugueseIntegerToWordsConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/PortugueseIntegerToWordsConverter.java index fe1473cc..cedc6580 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/PortugueseIntegerToWordsConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/PortugueseIntegerToWordsConverter.java @@ -12,9 +12,11 @@ public class PortugueseIntegerToWordsConverter implements IntegerToStringConvert private final Map exceptions; private final IntegerToStringConverter smallNumbersConverter; - public PortugueseIntegerToWordsConverter(IntegerToStringConverter bigNumbersConverter, - Map exceptions, - IntegerToStringConverter smallNumbersConverter) { + public PortugueseIntegerToWordsConverter( + IntegerToStringConverter bigNumbersConverter, + Map exceptions, + IntegerToStringConverter smallNumbersConverter + ) { this.bigNumbersConverter = bigNumbersConverter; this.exceptions = exceptions; this.smallNumbersConverter = smallNumbersConverter; diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/PortugueseNumberToWordsConverterAdapter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/PortugueseNumberToWordsConverterAdapter.java index 486dddd0..49e4e865 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/PortugueseNumberToWordsConverterAdapter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/PortugueseNumberToWordsConverterAdapter.java @@ -11,9 +11,11 @@ public class PortugueseNumberToWordsConverterAdapter extends NumberToWordsConverter { - public PortugueseNumberToWordsConverterAdapter(IntegerToStringConverter hundredsToWordsConverter, - List pluralForms) { - super(hundredsToWordsConverter, pluralForms); + public PortugueseNumberToWordsConverterAdapter( + IntegerToStringConverter hundredsToWordsConverter, + List pluralForms + ) { + super(hundredsToWordsConverter, pluralForms); } @Override diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/PortugueseThousandToWordsConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/PortugueseThousandToWordsConverter.java index 3bc2ae81..1b90e2f7 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/PortugueseThousandToWordsConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/portuguese/PortugueseThousandToWordsConverter.java @@ -20,8 +20,10 @@ public class PortugueseThousandToWordsConverter implements IntegerToStringConver private final Map exceptions; private final GenderType genderType = GenderType.NON_APPLICABLE; - public PortugueseThousandToWordsConverter(Map baseValues, - Map exceptions) { + public PortugueseThousandToWordsConverter( + Map baseValues, + Map exceptions + ) { this.baseValues = baseValues; this.exceptions = exceptions; } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/russian/RussianValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/russian/RussianValues.java index e9096e89..378472ae 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/russian/RussianValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/russian/RussianValues.java @@ -61,10 +61,11 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new SlavicPluralForms("", "", "", GenderType.MASCULINE), - new SlavicPluralForms("тысяча", "тысячи", "тысяч", GenderType.FEMININE), - new SlavicPluralForms("миллион", "миллиона", "миллионов", GenderType.MASCULINE), - new SlavicPluralForms("миллиард", "миллиарда", "миллиардов", GenderType.MASCULINE)); + new SlavicPluralForms("", "", "", GenderType.MASCULINE), + new SlavicPluralForms("тысяча", "тысячи", "тысяч", GenderType.FEMININE), + new SlavicPluralForms("миллион", "миллиона", "миллионов", GenderType.MASCULINE), + new SlavicPluralForms("миллиард", "миллиарда", "миллиардов", GenderType.MASCULINE) + ); } @Override diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/serbian/SerbianCyrillicValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/serbian/SerbianCyrillicValues.java index a46633d5..6815753b 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/serbian/SerbianCyrillicValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/serbian/SerbianCyrillicValues.java @@ -60,10 +60,11 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new SlavicPluralForms("", "", "", GenderType.MASCULINE), - new SlavicPluralForms("хиљада", "хиљаде", "хиљада", GenderType.FEMININE), - new SlavicPluralForms("милион", "милиона", "милиона", GenderType.MASCULINE), - new SlavicPluralForms("милијарда", "милијарде", "милијарди", GenderType.FEMININE)); + new SlavicPluralForms("", "", "", GenderType.MASCULINE), + new SlavicPluralForms("хиљада", "хиљаде", "хиљада", GenderType.FEMININE), + new SlavicPluralForms("милион", "милиона", "милиона", GenderType.MASCULINE), + new SlavicPluralForms("милијарда", "милијарде", "милијарди", GenderType.FEMININE) + ); } @Override diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/serbian/SerbianValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/serbian/SerbianValues.java index e6d9a250..66479978 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/serbian/SerbianValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/serbian/SerbianValues.java @@ -60,10 +60,11 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new SlavicPluralForms("", "", "", GenderType.MASCULINE), - new SlavicPluralForms("hiljada", "hiljade", "hiljada", GenderType.FEMININE), - new SlavicPluralForms("milion", "miliona", "miliona", GenderType.MASCULINE), - new SlavicPluralForms("milijarda", "milijarde", "milijardi", GenderType.FEMININE)); + new SlavicPluralForms("", "", "", GenderType.MASCULINE), + new SlavicPluralForms("hiljada", "hiljade", "hiljada", GenderType.FEMININE), + new SlavicPluralForms("milion", "miliona", "miliona", GenderType.MASCULINE), + new SlavicPluralForms("milijarda", "milijarde", "milijardi", GenderType.FEMININE) + ); } @Override diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/slovak/SlovakValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/slovak/SlovakValues.java index a879c7ed..e1365e98 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/slovak/SlovakValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/slovak/SlovakValues.java @@ -62,9 +62,10 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new CzechPluralForms("tisíc", "tisíce", "tisíc", GenderType.MASCULINE), - new CzechPluralForms("milión", "milióny", "miliónov", GenderType.MASCULINE), - new CzechPluralForms("miliarda", "miliardy", "miliard", GenderType.FEMININE)); + new CzechPluralForms("tisíc", "tisíce", "tisíc", GenderType.MASCULINE), + new CzechPluralForms("milión", "milióny", "miliónov", GenderType.MASCULINE), + new CzechPluralForms("miliarda", "miliardy", "miliard", GenderType.FEMININE) + ); } @Override diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/spanish/SpanishIntegerToWordsConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/spanish/SpanishIntegerToWordsConverter.java index 8fe74117..26582a56 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/spanish/SpanishIntegerToWordsConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/spanish/SpanishIntegerToWordsConverter.java @@ -12,9 +12,11 @@ public class SpanishIntegerToWordsConverter implements IntegerToStringConverter private final Map exceptions; private final IntegerToStringConverter smallNumbersConverter; - public SpanishIntegerToWordsConverter(IntegerToStringConverter bigNumbersConverter, - Map exceptions, - IntegerToStringConverter smallNumbersConverter) { + public SpanishIntegerToWordsConverter( + IntegerToStringConverter bigNumbersConverter, + Map exceptions, + IntegerToStringConverter smallNumbersConverter + ) { this.bigNumbersConverter = bigNumbersConverter; this.exceptions = exceptions; this.smallNumbersConverter = smallNumbersConverter; diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/spanish/SpanishIntegerToWordsConverterAdapter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/spanish/SpanishIntegerToWordsConverterAdapter.java index 19fb54aa..cd20d169 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/spanish/SpanishIntegerToWordsConverterAdapter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/spanish/SpanishIntegerToWordsConverterAdapter.java @@ -12,8 +12,10 @@ public class SpanishIntegerToWordsConverterAdapter extends NumberToWordsConverter { - public SpanishIntegerToWordsConverterAdapter(IntegerToStringConverter hundredsToWordsConverter, - List pluralForms) { + public SpanishIntegerToWordsConverterAdapter( + IntegerToStringConverter hundredsToWordsConverter, + List pluralForms + ) { super(hundredsToWordsConverter, pluralForms); } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/spanish/SpanishValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/spanish/SpanishValues.java index dd8687ec..18bd5450 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/spanish/SpanishValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/spanish/SpanishValues.java @@ -71,8 +71,8 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new RegularPluralForms("millón", "millones"), - new RegularPluralForms("mil millones", "mil millones") + new RegularPluralForms("millón", "millones"), + new RegularPluralForms("mil millones", "mil millones") ); } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/swedish/SwedishValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/swedish/SwedishValues.java index a06986c9..8baed63f 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/swedish/SwedishValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/swedish/SwedishValues.java @@ -62,13 +62,14 @@ public Map baseNumbers() { public List pluralForms() { // Note: in Swedish there are common and neuter gender types. In this case, common is equivalent to feminine return Arrays.asList( - new RegularPluralForms("", "", GenderType.NON_APPLICABLE), - new RegularPluralForms("tusen", "tusen", GenderType.NEUTER), // thousand - new RegularPluralForms("miljon", "miljoner", GenderType.FEMININE), // million - new RegularPluralForms("miljard", "miljarder", GenderType.FEMININE), // billion - new RegularPluralForms("biljon", "biljoner", GenderType.FEMININE), // trillion - new RegularPluralForms("biljard", "biljarder", GenderType.FEMININE), // quadrillion - new RegularPluralForms("triljon", "triljoner", GenderType.FEMININE)); // quintillion + new RegularPluralForms("", "", GenderType.NON_APPLICABLE), + new RegularPluralForms("tusen", "tusen", GenderType.NEUTER), // thousand + new RegularPluralForms("miljon", "miljoner", GenderType.FEMININE), // million + new RegularPluralForms("miljard", "miljarder", GenderType.FEMININE), // billion + new RegularPluralForms("biljon", "biljoner", GenderType.FEMININE), // trillion + new RegularPluralForms("biljard", "biljarder", GenderType.FEMININE), // quadrillion + new RegularPluralForms("triljon", "triljoner", GenderType.FEMININE) // quintillion + ); } public String currency() { diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/turkish/TurkishBigDecimalToBankingMoneyConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/turkish/TurkishBigDecimalToBankingMoneyConverter.java index d5fba7ea..6b6e8e6c 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/turkish/TurkishBigDecimalToBankingMoneyConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/turkish/TurkishBigDecimalToBankingMoneyConverter.java @@ -49,13 +49,13 @@ public String asWords(BigDecimal value, String currencySymbol) { private void validate(BigDecimal value) { Assert.isTrue(value.scale() <= MAXIMAL_DECIMAL_PLACES_COUNT, - () -> String.format("can't transform more than %s decimal places for value %s", MAXIMAL_DECIMAL_PLACES_COUNT, value)); + () -> String.format("can't transform more than %s decimal places for value %s", MAXIMAL_DECIMAL_PLACES_COUNT, value)); Assert.isTrue(valueLessThanIntMax(value), - () -> String.format("can't transform numbers greater than Integer.MAX_VALUE for value %s", value)); + () -> String.format("can't transform numbers greater than Integer.MAX_VALUE for value %s", value)); Assert.isTrue(valueGreaterThanOrEqualToZero(value), - () -> String.format("can't transform negative numbers for value %s", value)); + () -> String.format("can't transform negative numbers for value %s", value)); } private boolean valueLessThanIntMax(BigDecimal value) { diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/turkish/TurkishIntegerToWordsConverter.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/turkish/TurkishIntegerToWordsConverter.java index 4468d3a8..b33d8b10 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/turkish/TurkishIntegerToWordsConverter.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/turkish/TurkishIntegerToWordsConverter.java @@ -11,8 +11,10 @@ public class TurkishIntegerToWordsConverter implements IntegerToStringConverter private final IntegerToStringConverter bigNumbersConverter; private final TurkishSmallNumbersToWordsConverter smallNumbersConverter; - public TurkishIntegerToWordsConverter(IntegerToStringConverter bigNumbersConverter, - TurkishSmallNumbersToWordsConverter smallNumbersConverter) { + public TurkishIntegerToWordsConverter( + IntegerToStringConverter bigNumbersConverter, + TurkishSmallNumbersToWordsConverter smallNumbersConverter + ) { this.bigNumbersConverter = bigNumbersConverter; this.smallNumbersConverter = smallNumbersConverter; } diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/turkish/TurkishValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/turkish/TurkishValues.java index f693943f..9c2b530e 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/turkish/TurkishValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/turkish/TurkishValues.java @@ -56,8 +56,9 @@ public Map baseNumbers() { public List pluralForms() { return Arrays.asList( - new TurkishPluralForms("Milyon"), - new TurkishPluralForms("Milyar")); + new TurkishPluralForms("Milyon"), + new TurkishPluralForms("Milyar") + ); } public String currency() { diff --git a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/ukrainian/UkrainianValues.java b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/ukrainian/UkrainianValues.java index b16c17cb..b98af7ec 100644 --- a/src/main/java/pl/allegro/finance/tradukisto/internal/languages/ukrainian/UkrainianValues.java +++ b/src/main/java/pl/allegro/finance/tradukisto/internal/languages/ukrainian/UkrainianValues.java @@ -61,10 +61,11 @@ public Map baseNumbers() { @Override public List pluralForms() { return Arrays.asList( - new SlavicPluralForms("", "", "", GenderType.MASCULINE), - new SlavicPluralForms("тисяча", "тисячі", "тисяч", GenderType.FEMININE), - new SlavicPluralForms("мільйон", "мільйони", "мільйонів", GenderType.MASCULINE), - new SlavicPluralForms("мільярд", "мільярди", "мільярдів", GenderType.MASCULINE)); + new SlavicPluralForms("", "", "", GenderType.MASCULINE), + new SlavicPluralForms("тисяча", "тисячі", "тисяч", GenderType.FEMININE), + new SlavicPluralForms("мільйон", "мільйони", "мільйонів", GenderType.MASCULINE), + new SlavicPluralForms("мільярд", "мільярди", "мільярдів", GenderType.MASCULINE) + ); } @Override