Esempio n. 1
0
  public void test(TestHarness harness) {
    Currency currency;
    boolean threwException;

    /* Check getInstance with a null string */
    threwException = false;
    try {
      currency = Currency.getInstance((String) null);
    } catch (NullPointerException exception) {
      threwException = true;
    }
    harness.check(threwException, "Currency instance request with null string exception check.");
    /* Check getInstance with a non-existant ISO string */
    threwException = false;
    try {
      currency = Currency.getInstance(INVALID_CURRENCY_CODE);
    } catch (IllegalArgumentException exception) {
      threwException = true;
    }
    harness.check(
        threwException,
        "Currency instance request with invalid currency code string exception check.");
    /* Check getInstance with a null locale */
    threwException = false;
    try {
      currency = Currency.getInstance((Locale) null);
    } catch (NullPointerException exception) {
      threwException = true;
    }
    harness.check(threwException, "Currency instance request with null locale exception check.");
  }
  public void testCompositeUserType() {
    Session s = openSession();
    org.hibernate.Transaction t = s.beginTransaction();

    Transaction tran = new Transaction();
    tran.setDescription("a small transaction");
    tran.setValue(new MonetoryAmount(new BigDecimal(1.5), Currency.getInstance("USD")));
    s.persist(tran);

    List result =
        s.createQuery(
                "from Transaction tran where tran.value.amount > 1.0 and tran.value.currency = 'USD'")
            .list();
    assertEquals(result.size(), 1);
    tran.getValue().setCurrency(Currency.getInstance("AUD"));
    result =
        s.createQuery(
                "from Transaction tran where tran.value.amount > 1.0 and tran.value.currency = 'AUD'")
            .list();
    assertEquals(result.size(), 1);

    if (!(getDialect() instanceof HSQLDialect)) {

      result = s.createQuery("from Transaction txn where txn.value = (1.5, 'AUD')").list();
      assertEquals(result.size(), 1);
      result = s.createQuery("from Transaction where value = (1.5, 'AUD')").list();
      assertEquals(result.size(), 1);
    }

    s.delete(tran);
    t.commit();
    s.close();
  }
Esempio n. 3
0
 CurrencyConverter() {
   Arrays.asList(Locale.getAvailableLocales())
       .stream()
       .filter(locale -> StringUtils.hasText(locale.getCountry()))
       .forEach(
           locale ->
               currencies.put(
                   Currency.getInstance(locale).getCurrencyCode(),
                   Currency.getInstance(locale).getSymbol(locale)));
 }
Esempio n. 4
0
  @UnityCallable
  public static void LogAppEvent(String params_str) {
    Log.v(TAG, "LogAppEvent(" + params_str + ")");
    UnityParams unity_params = UnityParams.parse(params_str);

    Bundle parameters = new Bundle();
    if (unity_params.has("parameters")) {
      UnityParams unity_params_parameter = unity_params.getParamsObject("parameters");
      parameters = unity_params_parameter.getStringParams();
    }

    if (unity_params.has("logPurchase")) {
      FB.getAppEventsLogger()
          .logPurchase(
              new BigDecimal(unity_params.getDouble("logPurchase")),
              Currency.getInstance(unity_params.getString("currency")),
              parameters);
    } else if (unity_params.hasString("logEvent")) {
      if (unity_params.has("valueToSum")) {
        FB.getAppEventsLogger()
            .logEvent(
                unity_params.getString("logEvent"),
                unity_params.getDouble("valueToSum"),
                parameters);
      } else {
        FB.getAppEventsLogger().logEvent(unity_params.getString("logEvent"), parameters);
      }
    } else {
      Log.e(TAG, "couldn't logPurchase or logEvent params: " + params_str);
    }
  }
  public ESInvoiceEntry.Builder getInvoiceOtherRegionsEntryBuilder() {
    ESProductEntity product =
        (ESProductEntity)
            this.injector
                .getInstance(DAOESProduct.class)
                .create(this.product.getOtherRegionProductEntity());
    this.context = this.contexts.canaryIslands().staCruzDeTenerife().getParentContext();

    ESInvoiceEntry.Builder invoiceEntryBuilder =
        this.injector.getInstance(ESInvoiceEntry.Builder.class);
    ESShippingPoint.Builder originBuilder = this.shippingPoint.getShippingPointBuilder();

    invoiceEntryBuilder.clear();

    invoiceEntryBuilder
        .setUnitAmount(AmountType.WITHOUT_TAX, ESInvoiceEntryTestUtil.AMOUNT)
        .setTaxPointDate(new Date())
        .setDescription(product.getDescription())
        .setQuantity(ESInvoiceEntryTestUtil.QUANTITY)
        .setUnitOfMeasure(product.getUnitOfMeasure())
        .setProductUID(product.getUID())
        .setContextUID(this.context.getUID())
        .setShippingOrigin(originBuilder)
        .setCurrency(Currency.getInstance("EUR"));

    return invoiceEntryBuilder;
  }
Esempio n. 6
0
  public void test(TestHarness harness) {
    Currency currency;

    /* Set default Locale for the JVM */
    Locale.setDefault(TEST_LOCALE);
    /* Get an instance of the currency */
    currency = Currency.getInstance(TEST_LOCALE);
    /* Check for the correct currency code */
    harness.check(
        currency.getCurrencyCode(),
        ISO4217_CODE,
        "ISO 4217 currency code retrieval check (" + currency.getCurrencyCode() + ").");
    /* Check for the correct currency symbol */
    harness.check(
        currency.getSymbol(),
        CURRENCY_SYMBOL,
        "Currency symbol retrieval check (" + currency.getSymbol() + ").");
    /* Check for the correct fraction digits */
    harness.check(
        currency.getDefaultFractionDigits(),
        FRACTION_DIGITS,
        "Currency fraction digits retrieval check (" + currency.getDefaultFractionDigits() + ").");
    /* Check for the correct currency code from toString()*/
    harness.check(
        currency.toString(),
        ISO4217_CODE,
        "ISO 4217 currency code retrieval check (" + currency.toString() + ").");
  }
  /**
   * Creates a simple store.
   *
   * @return The store created using default values.
   */
  public Store createStore() {
    String country = "Canada";
    String name = "Store 1";
    StoreType storeType = StoreType.B2B;
    String subCountry = "Canada";
    String url = "http://www.some-where-out-there.com";
    TimeZone timeZone = TimeZone.getDefault();
    String code = "store";
    String emailSenderName = "some name";
    String emailSenderAddress = "*****@*****.**";
    String storeAdminEmailAddress = "*****@*****.**";
    Catalog catalog = createCatalog();
    Locale defaultLocale = Locale.getDefault();
    Currency defaultCurrency = Currency.getInstance(Locale.CANADA);

    return createStore(
        country,
        name,
        storeType,
        subCountry,
        url,
        timeZone,
        code,
        emailSenderName,
        emailSenderAddress,
        storeAdminEmailAddress,
        catalog,
        defaultLocale,
        defaultCurrency);
  }
Esempio n. 8
0
 public static Object convert(PropertyType property) {
   try {
     if (Date.class.getName().equals(property.getType())) {
       return dateFormat.parse(property.getValue());
     }
     if (Double.class.getName().equals(property.getType())) {
       return numberFormat.parse(property.getValue()).doubleValue();
     }
     if (Float.class.getName().equals(property.getType())) {
       return numberFormat.parse(property.getValue()).floatValue();
     }
     if (Integer.class.getName().equals(property.getType())) {
       return numberFormat.parse(property.getValue()).intValue();
     }
     if (Long.class.getName().equals(property.getType())) {
       return numberFormat.parse(property.getValue()).longValue();
     }
     if (Byte.class.getName().equals(property.getType())) {
       return numberFormat.parse(property.getValue()).byteValue();
     }
     if (Short.class.getName().equals(property.getType())) {
       return numberFormat.parse(property.getValue()).shortValue();
     }
     if (Boolean.class.getName().equals(property.getType())) {
       return "true".equals(property.getValue());
     }
     if (Currency.class.getName().equals(property.getType())) {
       return Currency.getInstance(property.getValue());
     }
   } catch (ParseException e) {
     e.printStackTrace();
   }
   return property.getValue();
 }
  /** @tests java.text.DecimalFormatSymbols#setInternationalCurrencySymbol(java.lang.String) */
  @TestTargetNew(
      level = TestLevel.COMPLETE,
      notes = "",
      method = "setInternationalCurrencySymbol",
      args = {java.lang.String.class})
  @KnownFailure("getCurrency() doesn't return null for bogus currency code.")
  public void test_setInternationalCurrencySymbolLjava_lang_String() {
    Locale locale = Locale.CANADA;
    DecimalFormatSymbols dfs =
        ((DecimalFormat) NumberFormat.getCurrencyInstance(locale)).getDecimalFormatSymbols();
    Currency currency = Currency.getInstance("JPY");
    dfs.setInternationalCurrencySymbol(currency.getCurrencyCode());

    assertTrue("Test1: Returned incorrect currency", currency == dfs.getCurrency());
    assertEquals(
        "Test1: Returned incorrect currency symbol",
        currency.getSymbol(locale),
        dfs.getCurrencySymbol());
    assertTrue(
        "Test1: Returned incorrect international currency symbol",
        currency.getCurrencyCode().equals(dfs.getInternationalCurrencySymbol()));

    String symbol = dfs.getCurrencySymbol();
    dfs.setInternationalCurrencySymbol("bogus");
    assertNull("Test2: Returned incorrect currency", dfs.getCurrency());
    assertTrue("Test2: Returned incorrect currency symbol", dfs.getCurrencySymbol().equals(symbol));
    assertEquals(
        "Test2: Returned incorrect international currency symbol",
        "bogus",
        dfs.getInternationalCurrencySymbol());
  }
 public static String localeCurrencyCode() {
   try {
     return Currency.getInstance(Locale.getDefault()).getCurrencyCode();
   } catch (final IllegalArgumentException x) {
     return null;
   }
 }
Esempio n. 11
0
 private Currency getCurrency(String currencyCode) {
   try {
     return Currency.getInstance(currencyCode);
   } catch (Exception e) {
     return null;
   }
 }
  @Nullable
  public static String getCurrencyName(String code) {
    String currencyName = null;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      try {
        Currency currency = Currency.getInstance(code);
        currencyName = currency.getDisplayName(Locale.getDefault());
      } catch (final IllegalArgumentException x) {
        /* ignore */
      }
    } else {
      currencyName = Currencies.CURRENCY_NAMES.get(code);
    }

    // Try cryptocurrency codes
    if (currencyName == null) {
      try {
        CoinType cryptoCurrency = CoinID.typeFromSymbol(code);
        currencyName = cryptoCurrency.getName();
      } catch (final IllegalArgumentException x) {
        /* ignore */
      }
    }

    return currencyName;
  }
Esempio n. 13
0
    /** Set the expected and actual values from their string representations */
    private void setValuesFromStrings() {
      String blurb = "";
      String origEv = getEv();
      String origAv = getAv();
      Currency curr = Currency.getInstance(Locale.getDefault());
      String currSymbol = curr.getSymbol();
      setAv(getAv().replace(currSymbol, ""));
      setEv(getEv().replace(currSymbol, ""));

      if (!getComp().equalsIgnoreCase("between")) {
        try {
          expected = BigDecimal.valueOf(Double.valueOf(getEv()));
        } catch (Exception ex) {
          blurb = "Invalid (expected) Currency value: " + Util.sq(origEv) + "  ";
        }
      }

      try {
        actual = BigDecimal.valueOf(Double.valueOf(getAv()));
      } catch (Exception ex) {
        blurb += "Invalid (actual) Currency value: " + Util.sq(origAv) + "  ";
      }

      if (!isBlank(blurb)) {
        isSpecError = true;
        addError(blurb + "Verification aborted.");
      }
    } // setValuesFromStrings
  /** @tests java.text.DecimalFormatSymbols#setCurrency(java.util.Currency) */
  @TestTargetNew(
      level = TestLevel.COMPLETE,
      notes = "",
      method = "setCurrency",
      args = {java.util.Currency.class})
  public void test_setCurrencyLjava_util_Currency() {
    Locale locale = Locale.CANADA;
    DecimalFormatSymbols dfs =
        ((DecimalFormat) NumberFormat.getCurrencyInstance(locale)).getDecimalFormatSymbols();

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

    Currency currency = Currency.getInstance("JPY");
    dfs.setCurrency(currency);

    assertTrue("Returned incorrect currency", currency == dfs.getCurrency());
    assertEquals(
        "Returned incorrect currency symbol", currency.getSymbol(locale), dfs.getCurrencySymbol());
    assertTrue(
        "Returned incorrect international currency symbol",
        currency.getCurrencyCode().equals(dfs.getInternationalCurrencySymbol()));
  }
Esempio n. 15
0
 private static boolean isCurrencyCode(String str) {
   try {
     return (Currency.getInstance(str.toUpperCase()) != null);
   } catch (IllegalArgumentException e) {
   }
   return false;
 }
Esempio n. 16
0
 public Currency getCurrency() {
   if (isVirtual()) {
     throw new UnsupportedOperationException(
         "Virtual MtGox currencies cannot be expressed as a Java currency.");
   }
   return Currency.getInstance(currency_code);
 }
  static {
    String[] ids = null;

    try {
      Set<String> set = new TreeSet<>();

      Locale[] locales = Locale.getAvailableLocales();

      for (int i = 0; i < locales.length; i++) {
        Locale locale = locales[i];

        if (locale.getCountry().length() == 2) {
          Currency currency = Currency.getInstance(locale);

          String currencyId = currency.getCurrencyCode();

          set.add(currencyId);
        }
      }

      ids = set.toArray(new String[set.size()]);
    } catch (Exception e) {
      ids = new String[] {"USD", "CAD", "EUR", "GBP", "JPY"};
    } finally {
      CURRENCY_IDS = ids;
    }
  }
Esempio n. 18
0
  public static void main(String[] args) {

    String numericCode = Currency.getInstance("AFA").getNumericCodeAsString();
    if (!numericCode.equals("004")) { // should return "004" (a 3 digit string)
      throw new RuntimeException("[Expected 004, " + "found " + numericCode + " for AFA]");
    }

    numericCode = Currency.getInstance("AUD").getNumericCodeAsString();
    if (!numericCode.equals("036")) { // should return "036" (a 3 digit string)
      throw new RuntimeException("[Expected 036, " + "found " + numericCode + " for AUD]");
    }

    numericCode = Currency.getInstance("USD").getNumericCodeAsString();
    if (!numericCode.equals("840")) { // should return "840" (a 3 digit string)
      throw new RuntimeException("[Expected 840, " + "found " + numericCode + " for USD]");
    }
  }
Esempio n. 19
0
 public void sendToPayleven(View v) {
   int amount = (int) (Math.round(this.getAmount() * 100)); // in cents
   TransactionRequestBuilder builder =
       new TransactionRequestBuilder(amount, Currency.getInstance("EUR"));
   TransactionRequest request = builder.createTransactionRequest();
   String orderId = "42";
   PaylevenApi.initiatePayment(this, orderId, request);
 }
  /**
   * A specialized TextWatcher designed specifically for converting EditText values to a
   * pretty-print string currency value.
   *
   * @param textBox The EditText box to which this TextWatcher is being applied. Used for replacing
   *     user-entered text with formatted text as well as handling cursor position for inputting
   *     monetary values
   */
  public CurrencyTextWatcher(EditText textBox) {
    editText = textBox;
    lastGoodInput = "";
    ignoreIteration = false;
    locale = editText.getResources().getConfiguration().locale;
    try {
      currency = Currency.getInstance(locale);
    } catch (IllegalArgumentException e) {
      currency = Currency.getInstance(Locale.US);
    }

    currencyFormatter = (DecimalFormat) DecimalFormat.getCurrencyInstance(locale);

    // Different countries use different fractional values for denominations (0.999 <x> vs. 0.99
    // cents), therefore this must be defined at runtime
    CURRENCY_DECIMAL_DIVISOR = (int) Math.pow(10, currency.getDefaultFractionDigits());
  }
Esempio n. 21
0
 /**
  * Returns the currency for an account which has been parsed (but not yet saved to the db)
  *
  * <p>This is used when parsing splits to assign the right currencies to the splits
  *
  * @param accountUID GUID of the account
  * @return Currency of the account
  */
 private Currency getCurrencyForAccount(String accountUID) {
   try {
     return mAccountMap.get(accountUID).getCurrency();
   } catch (Exception e) {
     Crashlytics.logException(e);
     return Currency.getInstance(Money.DEFAULT_CURRENCY_CODE);
   }
 }
 @Test
 public void testGetRate() throws Exception {
   Assume.assumeNotNull(
       RateService.getInstance()
           .getRate(
               Currency.getInstance(Locale.GERMANY).getCurrencyCode(),
               new GregorianCalendar(2010, 6, 1)));
 }
Esempio n. 23
0
  /**
   * Convenient function to get currency code from country code currency code is in English locale
   *
   * @param countryCode
   * @return
   */
  public static Currency getCurrencyCode(String countryCode) {
    try {
      return Currency.getInstance(new Locale("en", countryCode));
    } catch (Exception e) {

    }
    return null;
  }
  @Test
  public void
      testSetCurrentJavaCurrency() // NOPMD the assert(), fail() methods do not occur because the
                                   // sessionService.setAttribute doing all the work
      {
    final CurrencyModel currency1 = new CurrencyModel();
    currency1.setIsocode("USD");
    final List<CurrencyModel> currencyList =
        new ArrayList<CurrencyModel>(Collections.singletonList(currency1));

    when(currencyDao.findCurrenciesByCode("USD")).thenReturn(currencyList);
    Currency.getInstance("USD");
    i18NService.setCurrentJavaCurrency(Currency.getInstance("USD"));

    verify(currencyDao, times(1)).findCurrenciesByCode("USD");
    verify(sessionService, times(1))
        .setAttribute(I18NConstants.CURRENCY_SESSION_ATTR_KEY, currency1);
  }
Esempio n. 25
0
 /**
  * I did this to save time on refactoring the class
  *
  * @param price the priceFormatted to set Format the supplied double to a currency value with
  *     regional settings for KE.
  */
 public void setPriceFormatted(double price) {
   //       this.priceFormatted = "Ksh 345,000";
   Locale locale = new Locale.Builder().setRegion("KE").setLanguage("en").build();
   //       alternatively  Locale loc = Locale.US
   NumberFormat format = NumberFormat.getCurrencyInstance(locale);
   ((DecimalFormat) format).setMinimumFractionDigits(0);
   ((DecimalFormat) format).setCurrency(Currency.getInstance(locale));
   this.priceFormatted = format.format(price);
 }
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {TestingAppConfig.class})
public class ContractServiceIntegrationTest {

  private static final Currency USD = Currency.getInstance("USD");

  private static final double AMOUNT = 123.45;

  private static final String PHONE_NUMBER = "phoneNumber";

  private static final String SURNAME = "surname";

  private static final String NAME = "name";

  @Resource private ContractService testingInstance;
  @Resource private RenterManager renterManger;
  @Resource private EstateManager estateManger;
  @Resource private PriceManager priceManger;
  @Resource private DealerManager dealerManger;
  @Resource private ContractManager contractManager;

  private Renter
      renter; // new Renter("John", "Doe", Calendar.getInstance().getTime(), "ZX067345",
              // "1231230909");
  private Estate estate;
  private Dealer dealer;
  private Price price;

  @Before
  public void setUp() throws ValidationException {
    renter =
        renterManger.createRenter(
            "John", "Doe", Calendar.getInstance().getTime(), "ZX067345", "1231230909");
    estate = estateManger.createEstate(new HashSet<RentArea>(), "Title", "Description");
    price = priceManger.createPrice(AMOUNT, USD);
    dealer = dealerManger.createDealer(NAME, SURNAME, PHONE_NUMBER);
    //		price = new Price();
    //		dealer = new Dealer();
    //		price.setAmount(AMOUNT);
    //		price.setCurrency(USD);
    //		dealer.setName("John");
    //		dealer.setSurname(SURNAME);
    //		dealer.setPhoneNumber(PHONE_NUMBER);
  }

  @Test
  public void shouldCreateContract() throws ServiceException, ValidationException {
    System.err.println("==================== TEST ==================");
    Contract contract = testingInstance.createContract(renter, estate, dealer, price);
    price.setContract(contract);
    priceManger.update(price);
    System.err.println("==================== TEST DELETE CONTRACT ==================");
    contractManager.delete(contract);
    System.err.println("==================== TEST DELETE DEALER ==================");
    System.out.println(dealerManger.delete(dealer));
  }
}
Esempio n. 27
0
  public void /*test*/ UserWithItems() throws Exception {
    System.out.println("******************** testUserWithItems ********************");

    UserDAO userDAO = new UserDAO();
    assertTrue(userDAO.findAll().size() > 0);

    User user = new User();
    user.setFirstname("Christian");
    user.setAdmin(true);
    user.clearCreatedDate();

    Collection users = userDAO.findByExample(user);

    assertNotNull(users);
    Object[] userArr = users.toArray();
    assertTrue(userArr.length > 0);
    assertTrue(userArr[0] instanceof User);

    User christian = (User) userArr[0];
    assertNotNull(christian.getId());

    Set items = christian.getItems();
    Item item = (Item) items.toArray()[0];
    assertNotNull(item.getId());

    Calendar inThreeDays = GregorianCalendar.getInstance();
    inThreeDays.roll(Calendar.DAY_OF_YEAR, 3);
    Item newItem =
        new Item(
            "Item One",
            "An item in the carsLuxury category.",
            christian,
            new MonetaryAmount(new BigDecimal("1.99"), Currency.getInstance(Locale.US)),
            new MonetaryAmount(new BigDecimal("50.33"), Currency.getInstance(Locale.US)),
            new Date(),
            inThreeDays.getTime());

    christian.addItem(newItem);

    ItemDAO itemDAO = new ItemDAO();
    itemDAO.makePersistent(newItem);

    HibernateUtil.commitTransaction();
  }
  private void updateDocDetail(HttpServletRequest req) {

    String projectId = req.getParameter("project");
    String projectStageId = req.getParameter("projectStage");
    String costItemId = req.getParameter("costItem");
    String currencyString = req.getParameter("currency");
    String sumString = req.getParameter("sum");

    if (!req.getParameter("EditCurrentDetail").isEmpty()) {

      long rowNumber = Long.parseLong(req.getParameter("EditCurrentDetail"));
      PaymentDocument paymentDocument =
          (PaymentDocument) req.getSession(false).getAttribute("currentPaymentDocumentForEdit");

      if (paymentDocument == null) {

        LOG.error("Payment Document not found in session scope.");
        req.getSession(false)
            .setAttribute("errorMessage", "Payment Document not found. Please reload the page.");

      } else {

        PaymentDocumentDetail detail = paymentDocument.getPaymentDetailByRowNumber(rowNumber);

        try {

          if (!((costItemId == null) || costItemId.isEmpty())) {
            CostItem costItemRef = costItemService.retrieveById(Long.parseLong(costItemId));
            detail.setCostItem(costItemRef);
          }
          if (!((projectId == null) || projectId.isEmpty())) {
            Project projectRef = projectService.retrieveById(Long.parseLong(projectId));
            detail.setProject(projectRef);
          }
          if (!((projectStageId == null) || projectStageId.isEmpty())) {
            ProjectStage projectStageRef =
                projectStageService.retrieveById(Long.parseLong(projectStageId));
            detail.setProjectStage(projectStageRef);
          }
          Currency currency = Currency.getInstance(currencyString);
          Money sum = new Money(Double.parseDouble(sumString), currency);
          detail.setSum(sum);

        } catch (IllegalArgumentException | POMServicesException | POMDataModelException e) {

          LOG.error("Could not change Document Details properties: " + e.getMessage(), e);
          req.getSession(false)
              .setAttribute(
                  "errorMessage",
                  "Could not change Document Details properties: " + e.getMessage());
          return;
        }
        req.getSession(false).setAttribute("currentDocDetailForEdit", null);
      }
    }
  }
Esempio n. 29
0
 public static String formatCurrency(double amount, String currencyCode) {
   // I don't know why this is happening but sometimes currencyCode is Kč instead of CZK
   currencyCode = currencyCode.replace("Kč", "CZK");
   Currency currency = Currency.getInstance(currencyCode);
   String formatted = LocaleUtils.formatCurrency(amount, currency);
   // hack for Czech crowns - there is no better solution because Android doesn't allow different
   // settings for
   // locale and language
   return formatted.replace("CZK", "CZK ").replace("Kč", "Kč ");
 }
  /** Used by Stripes to tell the converter what locale the incoming text is in. */
  public void setLocale(Locale locale) {
    this.locale = locale;
    this.formats = getNumberFormats();

    // Use the appropriate currency symbol if our locale has a country, otherwise try the dollar
    // sign!
    if (locale.getCountry() != null && !"".equals(locale.getCountry()))
      this.currencySymbol = Currency.getInstance(locale).getSymbol(locale);
    else this.currencySymbol = "$";
  }