Validates that the currency of this money and the specified money match.

@param moneyProvider  the money to check, not null
@throws CurrencyMismatchException if the currencies differ
772596
private BigMoney checkCurrencyEqual(BigMoneyProvider moneyProvider) {
        BigMoney money = of(moneyProvider);
        if (isSameCurrency(money) == false) {
            throw new CurrencyMismatchException(getCurrencyUnit(), money.getCurrencyUnit());
        }
        return money;
    }
167631
def valid?
      return false if !@amount.nil? && @amount < 0
      currency_validator = EnumAttributeValidator.new('String', ["UNKNOWN_CURRENCY", "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "USN", "USS", "UYI", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XTS", "XXX", "YER", "ZAR", "ZMK", "ZMW", "BTC"])
      return false unless currency_validator.valid?(@currency)
      return true
    end
366441
public static function withSecure($amount, Currency $currency = null)
    {
        if(!is_long($amount))
            throw new InvalidAmountException;
        $money = self::withRaw(0, $currency);
        $money->setFraction($amount / 100);
        $money->setWhole($amount / 100);
        return $money;
    }
379896
private function _checkCurrency(&$currency)
    {
        if (!isset($currency)) {
            throw new Klarna_ArgumentNotSetException("Currency");
        }
        if (is_numeric($currency) && !is_int($currency)) {
            $currency = intval($currency);
        }
        if (!is_numeric($currency) || !is_int($currency)) {
            throw new Klarna_InvalidTypeException("Currency", "integer");
        }
    }
655746
public function validateMoney(MoneyInterface $money)
    {
        try {
            $this->numberValidator->validateNumber($money->getAmount());
        } catch (InvalidNumberException $exception) {
            throw new InvalidAmountException(
                'Invalid amount for money specified: ' . $money->getAmount(),
                0,
                $exception
            );
        }

        if (!($this->math->isZero($money->getAmount()) && $money->getCurrency() === null)) {
            if (!is_string($money->getCurrency())) {
                throw new InvalidCurrencyException('Specified currency is not string');
            } elseif (!in_array($money->getCurrency(), $this->informationProvider->getSupportedCurrencies())) {
                throw new InvalidCurrencyException('Invalid currency specified: ' . $money->getCurrency());
            }
        }
    }
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()));
    }
338676
public static String formatCurrency(ITemplate template, Object data, String currencyCode) {
        return formatCurrency(template, data, currencyCode, null);
    }
1123837
private void processCurrency(Row row)
   {
      String currencyName = row.getString("curr_short_name");
      DecimalFormatSymbols symbols = new DecimalFormatSymbols();
      symbols.setDecimalSeparator(row.getString("decimal_symbol").charAt(0));
      symbols.setGroupingSeparator(row.getString("digit_group_symbol").charAt(0));
      DecimalFormat nf = new DecimalFormat();
      nf.setDecimalFormatSymbols(symbols);
      nf.applyPattern("#.#");
      m_currencyMap.put(currencyName, nf);

      if (currencyName.equalsIgnoreCase(m_defaultCurrencyName))
      {
         m_numberFormat = nf;
         m_defaultCurrencyData = row;
      }
   }
928506
def validate_currency(*currencies):
	
	validated_currency = []
	if not currencies:
		raise CurrencyException('My function need something to run, duh')
	for currency in currencies:
		currency = currency.upper()
		if not isinstance(currency, str):
			raise TypeError('Currency code should be a string: ' + repr(currency))
		if currency not in _currencies:
			raise CurrencyException('Currency code not found: ' + repr(currency))
		validated_currency.append(currency)
	return validated_currency[0] if len(validated_currency) == 1 else validated_currency
653175
@Override
    public MonetaryAmountFactory<T> setCurrency(CurrencyUnit currency) {
        Objects.requireNonNull(currency);
        this.currency = currency;
        return this;
    }
1062370
protected function isCurrencyValid($currencyValue)
    {
        $availableCurrencies = $this->facade->getAvailableCurrencies();
        /** @var Currency $currency */
        $currencyFound = false;
        foreach ($availableCurrencies as $currency) {
            if ($currencyValue == $currency->getCode()) {
                $currencyFound = true;
            }
        }
        if (!$currencyFound) {
            throw new InvalidConditionValueException(
                \get_class(),
                'currency'
            );
        }

        return true;
    }
43626
@Override
    public int compareTo(CurrencyUnit currency) {
        Objects.requireNonNull(currency);
        return getCurrencyCode().compareTo(currency.getCurrencyCode());
    }
843166
public CoinsuperResponse<List<CoinsuperTicker>> getCoinsuperTicker(CurrencyPair currencyPair)
      throws IOException {

    Map<String, String> data = new HashMap<String, String>();
    data.put("symbol", currencyPair.toString());

    RestRequestParam parameters =
        RestApiRequestHandler.generateRequestParam(data, this.apiKey, this.secretKey);

    return coinsuper.getTickers(parameters);
  }
1069114
private void evalCurrency(MessageArg arg) {
    String currencyCode = arg.currency();
    if (currencyCode == null) {
      return;
    }
    CLDR.Currency currency = CLDR.Currency.fromString(currencyCode);
    if (currency == null) {
      return;
    }
    
    initCurrencyArgsParser();
    parseArgs(currencyArgsParser);
    
    BigDecimal number = arg.asBigDecimal();
    NumberFormatter formatter = CLDR_INSTANCE.getNumberFormatter(locale);
    formatter.formatCurrency(number, currency, buf, currencyArgsParser.options());
  }
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();
  }
400204
def not_supported_currencies(self, project='moneywagon', level="full"):
        
        supported = self.supported_currencies(project, level)
        ret = []
        for symbol, data in self.sorted_crypto_data:
            if symbol == '': # template
                continue
            if symbol not in supported:
                ret.append(symbol)
        return ret
681744
@Override
    public int compareTo(MonetaryAmount o) {
        Objects.requireNonNull(o);
        int compare;
        if (currency.equals(o.getCurrency())) {
            compare = asNumberStripped().compareTo(RoundedMoney.from(o).asNumberStripped());
        } else {
            compare = currency.getCurrencyCode().compareTo(o.getCurrency().getCurrencyCode());
        }
        return compare;
    }