Class DefaultCurrencyUnitDataProvider


  • class DefaultCurrencyUnitDataProvider
    extends CurrencyUnitDataProvider
    Provider for available currencies using a file.

    This reads currencies from various files. Firstly it reads the mandatory resource named /org/joda/money/CurencyData.csv. Then it reads the mandatory resource named /org/joda/money/CountryData.csv. These files are located in the joda-money jar file.

    Then it reads optional resources named META-INF/org/joda/money/CurencyDataExtension.csv. Then it reads optional resources named META-INF/org/joda/money/CountryDataExtension.csv. These will be read using ClassLoader.getResources(String). These files may augment or replace data from the first two files.

    • Field Detail

      • CURRENCY_REGEX_LINE

        private static final java.util.regex.Pattern CURRENCY_REGEX_LINE
        Regex format for the money csv line.
      • COUNTRY_REGEX_LINE

        private static final java.util.regex.Pattern COUNTRY_REGEX_LINE
        Regex format for the country csv line.
    • Constructor Detail

      • DefaultCurrencyUnitDataProvider

        DefaultCurrencyUnitDataProvider()
    • Method Detail

      • registerCurrencies

        protected void registerCurrencies()
                                   throws java.lang.Exception
        Registers all the currencies known by this provider.
        Specified by:
        registerCurrencies in class CurrencyUnitDataProvider
        Throws:
        java.lang.Exception - if an error occurs
      • loadFromFile

        private java.util.List<java.lang.String> loadFromFile​(java.lang.String fileName)
                                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • loadFromFiles

        private java.util.List<java.lang.String> loadFromFiles​(java.lang.String fileName)
                                                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • parseCurrencies

        private void parseCurrencies​(java.util.List<java.lang.String> content)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • parseCountries

        private void parseCountries​(java.util.List<java.lang.String> content)
                             throws java.lang.Exception
        Throws:
        java.lang.Exception