Package java.util

Examples of java.util.Currency


            lForm = NumberFormat.getInstance(defaultlocale);
        } else if ((this.template.toString().indexOf('!') != -1)
                || (this.template.toString().compareTo("CURRENCY") == 0)) { //$NON-NLS-1$
            lForm = NumberFormat.getCurrencyInstance(defaultlocale);
        } else if ((this.template.toString().compareTo("EURO_CURRENCY") == 0)) { //$NON-NLS-1$
            Currency euro = Currency.getInstance("EUR"); //$NON-NLS-1$
            lForm = NumberFormat.getCurrencyInstance();
            lForm.setCurrency(euro);
        } else if (this.template.toString().compareTo("INTEGER") == 0) { //$NON-NLS-1$
            lForm = NumberFormat.getIntegerInstance(defaultlocale);
          // AD:14/10/2008: KIN-9 Process any decimal points like Forte
View Full Code Here


            lForm = NumberFormat.getInstance(defaultlocale);
        } else if ((this.template.toString().indexOf('!') != -1)
                || (this.template.toString().compareTo("CURRENCY") == 0)) { //$NON-NLS-1$
            lForm = NumberFormat.getCurrencyInstance(defaultlocale);
        } else if ((this.template.toString().compareTo("EURO_CURRENCY") == 0)) { //$NON-NLS-1$
            Currency euro = Currency.getInstance("EUR"); //$NON-NLS-1$
            lForm = NumberFormat.getCurrencyInstance();
            lForm.setCurrency(euro);
        } else if (this.template.toString().compareTo("INTEGER") == 0) { //$NON-NLS-1$
            lForm = NumberFormat.getIntegerInstance(defaultlocale);
          // AD:14/10/2008: KIN-9 Process any decimal points like Forte
View Full Code Here

        }


        // if still none we will use the default for whatever locale we can get...
        if (iso == null) {
            Currency cur = Currency.getInstance(getLocale(session));
            iso = cur.getCurrencyCode();
        }

        return iso;
    }
View Full Code Here

    {
      return null;
    }
    try
    {
      Currency currency = Currency.getInstance(data.getValue());
      if (currency == null)
      {
        throw new IllegalArgumentException(data.getValue() + " is not a valid java.util.Currency value");
      }
      return currency;
View Full Code Here

        assertEquals(exp.pattern(), result.pattern());
    }

    public void testCurrency() throws IOException
    {
        Currency usd = Currency.getInstance("USD");
        assertEquals(usd, new ObjectMapper().readValue(quote("USD"), Currency.class));
    }
View Full Code Here

        this.locale = locale;
    }

    @Override
    public String formatCurrency(long amount, String currencyCode, boolean international, boolean showGroupings) {
        final Currency currency = Currency.getInstance(currencyCode);
        final int decimalPlaces = getDecimalPlaces(currency);
        final NumberFormat numberFormat = getNumberFormat(currency, international, showGroupings);
        return numberFormat.format(MathUtil.fixedPointToDouble(amount, decimalPlaces));
    }
View Full Code Here

        return numberFormat.format(MathUtil.fixedPointToDouble(amount, decimalPlaces));
    }

    @Override
  public String formatCurrency(BigDecimal amount, String currencyCode, boolean international, boolean showGroupings) {
      final Currency currency = Currency.getInstance(currencyCode);
        final int decimalPlaces = getDecimalPlaces(currency);
        final NumberFormat numberFormat = getNumberFormat(currency, international, showGroupings);
        numberFormat.setMaximumFractionDigits(amount.scale()+decimalPlaces);
        return numberFormat.format(amount.scaleByPowerOfTen(-decimalPlaces));
  }
View Full Code Here

    }

    @Override
    public long parseCurrency(String currencyString, String currencyCode) throws CurrencyParseException, DifferentCurrencyCodeProvided {
        final NumberFormat numberFormat = NumberFormat.getCurrencyInstance(locale);
        final Currency currency = Currency.getInstance(currencyCode);
        numberFormat.setCurrency(currency);
        double val;
        try {
            // TODO Missing support for DifferentCurrencyCodeProvided and for internation currency formats
            val = numberFormat.parse(currencyString).doubleValue();
View Full Code Here

    }
   
    @Override
    public BigDecimal parseCurrencyBigDecimal(String currencyString, String currencyCode) throws CurrencyParseException, DifferentCurrencyCodeProvided {
        final NumberFormat numberFormat = NumberFormat.getCurrencyInstance(locale);
        final Currency currency = Currency.getInstance(currencyCode);
        numberFormat.setCurrency(currency);
        BigDecimal val = BigDecimal.ZERO;
        try {
            // TODO Missing support for DifferentCurrencyCodeProvided and for internation currency formats
            val = BigDecimal.valueOf(numberFormat.parse(currencyString).doubleValue());
View Full Code Here

        assertEquals(exp.pattern(), result.pattern());
    }

    public void testCurrency() throws IOException
    {
        Currency usd = Currency.getInstance("USD");
        assertEquals(usd, new ObjectMapper().readValue(quote("USD"), Currency.class));
    }
View Full Code Here

TOP

Related Classes of java.util.Currency

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.