List of usage examples for java.util Currency getInstance
public static Currency getInstance(Locale locale)
Currency
instance for the country of the given locale. From source file:org.eclipsetrader.yahoo.internal.core.UtilTest.java
public void testGetRSSNewsFeed() throws Exception { Stock stock = new Stock("Stock", new FeedIdentifier("MSFT", new FeedProperties()), Currency.getInstance("USD")); String expected = "http://finance.yahoo.com/rss/headline?s=MSFT"; URL url = Util.getRSSNewsFeedForSecurity(stock); assertEquals(expected, url.toString()); }
From source file:org.totschnig.myexpenses.task.CsvImportTask.java
public CsvImportTask(TaskExecutionFragment taskExecutionFragment, Bundle b) { this.taskExecutionFragment = taskExecutionFragment; this.dateFormat = (QifDateFormat) b.getSerializable(TaskExecutionFragment.KEY_DATE_FORMAT); this.data = (ArrayList<CSVRecord>) b.getSerializable(CsvImportDataFragment.KEY_DATASET); this.column2FieldMap = (int[]) b.getSerializable(CsvImportDataFragment.KEY_FIELD_TO_COLUMN); this.discardedRows = b.getParcelable(CsvImportDataFragment.KEY_DISCARDED_ROWS); this.accountId = b.getLong(DatabaseConstants.KEY_ACCOUNTID); this.mCurrency = Currency.getInstance(b.getString(DatabaseConstants.KEY_CURRENCY)); this.mAccountType = (AccountType) b.getSerializable(DatabaseConstants.KEY_TYPE); }
From source file:com.clover.sdk.v1.merchant.Merchant.java
/** * Get the merchant currency.// www . ja v a 2 s .c o m */ public Currency getCurrency() { String code = data.getString(KEY_CURRENCY, "USD"); return Currency.getInstance(code); }
From source file:org.eclipsetrader.yahoo.internal.core.UtilTest.java
public void testGetRSSNewsFeedForIndex() throws Exception { Stock stock = new Stock("Stock", new FeedIdentifier("^IXIC", new FeedProperties()), Currency.getInstance("USD")); String expected = "http://finance.yahoo.com/rss/headline?s=%5EIXIC"; URL url = Util.getRSSNewsFeedForSecurity(stock); assertEquals(expected, url.toString()); }
From source file:com.github.woki.payments.adyen.ClientPaymentsTest.java
@Test(expected = APSAccessException.class) public void testClientCSEError2() { Client cli = Client.endpoint(APUtil.TEST_ENDPOINT).credentials("merchant", "password") .encryptionKey(PUBKEY_TEXT_ERR2).build(); cli.authorise(PaymentRequestBuilder.merchantAccount("mrchntacct") .amount(new Amount(Currency.getInstance("EUR"), 1000L)) .card(CardBuilder.number("4111111111111111").cvc("737").expiry(2016, 6).holder("Johnny Tester Visa") .build())/*w w w . j a v a 2s . co m*/ .reference(reference(ReferenceType.UUID)) .shopper(NameBuilder.first("Willian").last("Oki").build(), "willian.oki@gmail.com", "127.0.0.1", "Test/DAPI/Authorisation/Willian Oki", ShopperInteraction.Ecommerce) .build()); }
From source file:com.premiumminds.billy.france.services.builders.impl.FRManualBuilderImpl.java
@Override protected void validateValues() throws ValidationException { GenericInvoiceEntity i = this.getTypeInstance(); i.setCurrency(Currency.getInstance("EUR")); for (GenericInvoiceEntry e : i.getEntries()) { if (e.getCurrency() == null) { GenericInvoiceEntryEntity entry = (GenericInvoiceEntryEntity) e; entry.setCurrency(i.getCurrency()); e = entry;//w w w. ja v a2s. c o m } else { Validate.isTrue(i.getCurrency().getCurrencyCode().equals(e.getCurrency().getCurrencyCode())); } } }
From source file:de.bstreit.java.oscr.SpringConfigurationDoesComponentScan.java
/** * TODO [11]: Maybe make this a setting that is saved in the database? * /*from w w w . j av a 2 s.co m*/ * @return the default currency */ @Bean public Currency getDefaultCurrency() { return Currency.getInstance(getLocale()); }
From source file:com.aoindustries.creditcards.TransactionRequest.java
/** * Creates an empty TransactionRequest. The values should be set using the appropriate setter methods. *//*from w ww .j a v a 2 s .c om*/ public TransactionRequest() { setCurrency(Currency.getInstance(accessor.getMessage("TransactionRequest.currency.default"))); }
From source file:org.osframework.contract.date.fincal.definition.CentralBank.java
/** * Constructor.// w w w . j a v a 2s . c o m * * @param id unique identifier for this instance * @param name name of this central bank * @param country ISO-3166 country code for this central bank * @param currency ISO-4217 code for currency managed by this central bank * @throws IllegalArgumentException if <code>country</code> is not valid * ISO-3166 alpha2 code or if <code>currencyCode</code> is not valid * ISO-4217 code */ public CentralBank(final String id, final String name, final String country, final String currencyCode) { this(id, name, country, Currency.getInstance(currencyCode)); }
From source file:com.erudika.para.i18n.CurrencyUtils.java
/** * Returns the full name of the currency in the language of the given locale. * Defaults to English.// ww w. jav a2 s. co m * @param cur the 3-letter currency code * @param locale the locale * @return the currency name or "" if the currency is unknown */ public String getCurrencyName(String cur, Locale locale) { if (cur != null && CURRENCY_TO_LOCALE_MAP.containsKey(cur.toUpperCase())) { return Currency.getInstance(cur.toUpperCase()).getDisplayName((locale == null ? Locale.US : locale)); } else { return ""; } }