예제 #1
0
        //-------------------------------------------------------------------------
        public override FraConvention lookup(string name)
        {
            FraConvention value = BY_NAME.get(name);

            if (value == null)
            {
                FraConvention created = createByName(name);
                if (created != null)
                {
                    string correctName = created.Name;
                    value = BY_NAME.computeIfAbsent(correctName, k => created);
                    BY_NAME.putIfAbsent(correctName.ToUpper(Locale.ENGLISH), value);
                }
            }
            return(value);
        }
예제 #2
0
 // add code
 private static Currency addCode(string currencyCode)
 {
     ArgChecker.matches(CODE_MATCHER, 3, 3, currencyCode, "currencyCode", "[A-Z][A-Z][A-Z]");
     return(DYNAMIC.computeIfAbsent(currencyCode, code => new Currency(code, 0, "USD")));
 }
예제 #3
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Obtains an instance from the specified ISO-3166-1 alpha-2
        /// two letter country code dynamically creating a country if necessary.
        /// <para>
        /// A country is uniquely identified by ISO-3166-1 alpha-2 two letter code.
        /// This method creates the country if it is not known.
        ///
        /// </para>
        /// </summary>
        /// <param name="countryCode">  the two letter country code, ASCII and upper case </param>
        /// <returns> the singleton instance </returns>
        /// <exception cref="IllegalArgumentException"> if the country code is invalid </exception>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @FromString public static Country of(String countryCode)
        public static Country of(string countryCode)
        {
            ArgChecker.notNull(countryCode, "countryCode");
            return(CACHE.computeIfAbsent(countryCode, c => addCode(c)));
        }