Package java.util

Examples of java.util.Currency


        }


        // 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


        DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
        DecimalFormat cloned = (DecimalFormat) format.clone();
        cloned.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
        assertEquals(format, cloned);

        Currency c = Currency.getInstance(Locale.US);
        cloned.setCurrency(c);

        assertEquals(format, cloned);
    }
View Full Code Here

    /**
     * @tests java.text.DecimalFormat#getCurrency()
     */
    //FIXME This test fails on Harmony ClassLibrary
    public void test_getCurrency() {
        Currency currK = Currency.getInstance("KRW");
        Currency currX = Currency.getInstance("XXX");
        Currency currE = Currency.getInstance("EUR");
        Currency curr01;

        DecimalFormat df = (DecimalFormat) NumberFormat
                .getCurrencyInstance(new Locale("ko", "KR"));
        assertTrue("Test1: Returned incorrect currency",
                df.getCurrency() == currK);
View Full Code Here

            df.setCurrency(null);
            fail("Expected NullPointerException");
        } catch (NullPointerException e) {
        }

        Currency currency = Currency.getInstance("AED");
        df.setCurrency(currency);
        assertTrue("Returned incorrect currency", currency == df.getCurrency());
        assertTrue("Returned incorrect currency symbol", currency.getSymbol(
                locale)
                .equals(df.getDecimalFormatSymbols().getCurrencySymbol()));
        assertTrue("Returned incorrect international currency symbol", currency
                .getCurrencyCode().equals(
                        df.getDecimalFormatSymbols()
                                .getInternationalCurrencySymbol()));
    }
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

    setValue(Currency.getInstance(text));
  }

  @Override
  public String getAsText() {
    Currency value = (Currency) getValue();
    return (value != null ? value.getCurrencyCode() : "");
  }
View Full Code Here

   * This implementation returns <code>null</code> to indicate that
   * there is no appropriate text representation.
   */
  @Override
  public String getAsText() {
    Currency value = (Currency) getValue();
    return (value != null ? value.getCurrencyCode() : "");
  }
View Full Code Here

*/
public class InstanceFallbackConverterTest extends ContextTestSupport {

    public void testInstanceFallbackConverter() throws Exception {
        Exchange exchange = new DefaultExchange(context);
        Currency cur = Currency.getInstance(Locale.US);

        String money = context.getTypeConverter().convertTo(String.class, exchange, cur);
        assertEquals("Money talks", money);
    }
View Full Code Here

        assertEquals("Money talks", money);
    }

    public void testInstanceFallbackMandatoryConverter() throws Exception {
        Exchange exchange = new DefaultExchange(context);
        Currency cur = Currency.getInstance(Locale.US);

        String money = context.getTypeConverter().mandatoryConvertTo(String.class, exchange, cur);
        assertEquals("Money talks", money);
    }
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

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.