Registers a bew currency unit under its currency code.

@param currencyUnit the new currency to be registered, not null.
@return any unit instance registered previously by this instance, or null.
513704
public static CurrencyUnit registerCurrencyUnit(CurrencyUnit currencyUnit) {
        Objects.requireNonNull(currencyUnit);
        return ConfigurableCurrencyUnitProvider.currencyUnits.put(currencyUnit.getCurrencyCode(), currencyUnit);
    }
64479
public static CurrencyFunction currency(String fieldName) {

		Assert.hasText(fieldName, "FieldName must not be empty!");
		return currency(fieldName, null);
	}
304201
public static MonetaryAmountDecimalFormatBuilder of(Locale locale) {
        MonetaryAmountDecimalFormatBuilder builder = new MonetaryAmountDecimalFormatBuilder();
        builder.decimalFormat = (DecimalFormat) NumberFormat.getCurrencyInstance(locale);
        builder.locale = locale;
        return builder;
    }
403387
public MonetaryFormat codeSeparator(char codeSeparator) {
        checkArgument(!Character.isDigit(codeSeparator));
        checkArgument(codeSeparator > 0);
        if (codeSeparator == this.codeSeparator)
            return this;
        else
            return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
                    shift, roundingMode, codes, codeSeparator, codePrefixed);
    }
1150690
public void setCostPerUnit(com.google.api.ads.admanager.axis.v201805.Money costPerUnit) {
        this.costPerUnit = costPerUnit;
    }
752638
public static MonetaryAmountDecimalFormatBuilder newInstance() {
        MonetaryAmountDecimalFormatBuilder builder = new MonetaryAmountDecimalFormatBuilder();
        builder.decimalFormat = (DecimalFormat) NumberFormat.getCurrencyInstance();
        return builder;
    }
469626
public static RoundedMoney of(Number number, CurrencyUnit currency, MonetaryContext monetaryContext) {
        return new RoundedMoney(number, currency,
                DEFAULT_MONETARY_CONTEXT.toBuilder().importContext(monetaryContext).build(), null);
    }
333157
public MonetaryFormat noCode() {
        if (codes == null)
            return this;
        else
            return new MonetaryFormat(negativeSign, positiveSign, zeroDigit, decimalMark, minDecimals, decimalGroups,
                    shift, roundingMode, null, codeSeparator, codePrefixed);
    }
455011
public TypeSpec createCurrencyUtil(String className, Map<String, CurrencyData> currencies) {
    TypeSpec.Builder type = TypeSpec.classBuilder(className)
        .addModifiers(Modifier.PUBLIC);
    
    CurrencyData defaultData = currencies.get("DEFAULT");
    currencies.remove("DEFAULT");
    
    MethodSpec.Builder code = MethodSpec.methodBuilder("getCurrencyDigits")
        .addModifiers(PUBLIC, STATIC)
        .addParameter(Types.CLDR_CURRENCY_ENUM, "code")
        .returns(int.class);
    
    code.beginControlFlow("switch (code)");
    for (Map.Entry<String, CurrencyData> entry : currencies.entrySet()) {
      CurrencyData data = entry.getValue();
      code.addStatement("case $L: return $L", entry.getKey(), data.digits);
    }
    code.addStatement("default: return $L", defaultData.digits);
    code.endControlFlow();
    
    type.addMethod(code.build());
    return type.build();
  }
675034
@Override
    public GeldbetragFactory getFactory() {
        return new GeldbetragFactory().setCurrency(currency).setNumber(betrag).setContext(context);
    }
1119312
public RoundingContextBuilder setCurrency(CurrencyUnit currencyUnit) {
        Objects.requireNonNull(currencyUnit);
        return set(CurrencyUnit.class, currencyUnit);
    }
1238187
protected function registerCurrency()
    {
        $this->app->singleton(Currency::class, function ($app) {
            $repository = new Currency;

            return $repository->setLocale($app['config']['app.locale'])->setFallbackLocale($app['config']['app.fallback_locale']);
        });

        $this->app->alias(Currency::class, 'intl.currency');
    }
652737
public static BitfinexInstrument build(final String symbolString) {
		
		if(symbolString.startsWith("t")) {
			return BitfinexCurrencyPair.fromSymbolString(symbolString);
		} else if(symbolString.startsWith("f")) {
			return BitfinexFundingCurrency.fromSymbolString(symbolString);
		} else {
			throw new IllegalArgumentException("Unable to build currency for symbol string: " + symbolString);
		}
	}
738725
public static Currency getInstance(ULocale locale) {
        String currency = locale.getKeywordValue("currency");
        if (currency != null) {
            return getInstance(currency);
        }

        if (shim == null) {
            return createCurrency(locale);
        }

        return shim.createInstance(locale);
    }
105536
public static void registerDefaults() throws BitfinexClientException {

		try {
			final URL url = new URL(SYMBOL_URL);
			final String symbolJson = Resources.toString(url, Charsets.UTF_8);
			final JSONArray jsonArray = new JSONArray(symbolJson);

			for(int i = 0; i < jsonArray.length(); i++) {
				final JSONObject currency = jsonArray.getJSONObject(i);
				final String pair = currency.getString("pair");

				if(pair.length() != 6) {
					throw new BitfinexClientException("The currency pair is not 6 chars long: " + pair);
				}

				final double minOrderSize = currency.getDouble("minimum_order_size");
				final String currency1 = pair.substring(0, 3).toUpperCase();
				final String currency2 = pair.substring(3, 6).toUpperCase();
				register(currency1, currency2, minOrderSize);
			}

		} catch (IOException e) {
			throw new BitfinexClientException(e);
		} 
	}
298656
public static CurrencyFunction currency(String fieldName, @Nullable String currencyCode) {

		Assert.hasText(fieldName, "FieldName for currency function must not be 'empty'.");
		return currency(new SimpleField(fieldName), currencyCode);
	}
936608
@Override
    public CurrencyAmount add(final CurrencyAmount money) {
        if (!money.getCurrency().equals(currency)) {
            throw new IllegalArgumentException("You cannot add " + money.getCurrency() + " with " + currency);
        }
        return new Cash(currency, BigDecimalUtil.add(amount, money.getAmount()));
    }