本文整理汇总了Java中org.javamoney.moneta.CurrencyUnitBuilder类的典型用法代码示例。如果您正苦于以下问题:Java CurrencyUnitBuilder类的具体用法?Java CurrencyUnitBuilder怎么用?Java CurrencyUnitBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CurrencyUnitBuilder类属于org.javamoney.moneta包,在下文中一共展示了CurrencyUnitBuilder类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: BitcoinCurrencyProvider
import org.javamoney.moneta.CurrencyUnitBuilder; //导入依赖的package包/类
public BitcoinCurrencyProvider() {
CurrencyUnit btcUnit = CurrencyUnitBuilder.of("BTC", CONTEXT)
.setDefaultFractionDigits(bitcoinFractionDigits)
.build();
bitcoinSet.add(btcUnit);
bitcoinSet = Collections.unmodifiableSet(bitcoinSet);
}
开发者ID:ConsensusJ,项目名称:consensusj,代码行数:8,代码来源:BitcoinCurrencyProvider.java
示例2: shouldDeserialize
import org.javamoney.moneta.CurrencyUnitBuilder; //导入依赖的package包/类
@Test
public void shouldDeserialize() throws IOException {
final CurrencyUnit actual = unit.readValue("\"EUR\"", CurrencyUnit.class);
final CurrencyUnit expected = CurrencyUnitBuilder.of("EUR", "default").build();
assertThat(actual, is(expected));
}
开发者ID:zalando,项目名称:jackson-datatype-money,代码行数:8,代码来源:CurrencyUnitDeserializerTest.java
示例3: shouldDeserializeWithTyping
import org.javamoney.moneta.CurrencyUnitBuilder; //导入依赖的package包/类
@Test
public void shouldDeserializeWithTyping() throws IOException {
unit.enableDefaultTyping();
final CurrencyUnit actual = unit.readValue("\"EUR\"", CurrencyUnit.class);
final CurrencyUnit expected = CurrencyUnitBuilder.of("EUR", "default").build();
assertThat(actual, is(expected));
}
开发者ID:zalando,项目名称:jackson-datatype-money,代码行数:10,代码来源:CurrencyUnitDeserializerTest.java
示例4: shouldSerialize
import org.javamoney.moneta.CurrencyUnitBuilder; //导入依赖的package包/类
@Test
public void shouldSerialize() throws JsonProcessingException {
final String expected = "EUR";
final CurrencyUnit currency = CurrencyUnitBuilder.of(expected, "default").build();
final String actual = unit.writeValueAsString(currency);
assertThat(actual, is('"' + expected + '"'));
}
开发者ID:zalando,项目名称:jackson-datatype-money,代码行数:10,代码来源:CurrencyUnitSerializerTest.java
示例5: testCountingQuery
import org.javamoney.moneta.CurrencyUnitBuilder; //导入依赖的package包/类
/**
* Implement a {@link javax.money.MonetaryQuery} that return {@code true} for each amount, that has an ISO
* currency (as available on {@link java.util.Currency}.
*/
@Test
public void testCountingQuery(){
MonetaryQuery<Boolean> query = alg.getCountingQuery();
assertTrue(Money.of(2, "CHF").query(query));
assertFalse(FastMoney.of(4.5, CurrencyUnitBuilder.of("GEEC", CURENCY_CONTEXT).build()).query(query));
assertTrue(Money.of(10, "INR").query(query));
assertFalse(FastMoney.of(-1.5, CurrencyUnitBuilder.of("2xx2", CURENCY_CONTEXT).build()).query(query));
}
开发者ID:atsticks,项目名称:moneymachine,代码行数:13,代码来源:MoneyAlgorithmicsTest.java
示例6: BitcoinCurrencyProvider
import org.javamoney.moneta.CurrencyUnitBuilder; //导入依赖的package包/类
public BitcoinCurrencyProvider() {
CurrencyUnit btcUnit = CurrencyUnitBuilder.of("BTC", CONTEXT)
.setDefaultFractionDigits(bitcoinFractionDigits)
.build();
bitcoinSet.add(btcUnit);
bitcoinSet = Collections.unmodifiableSet(bitcoinSet);
}
开发者ID:JavaMoney,项目名称:javamoney-shelter,代码行数:8,代码来源:BitcoinCurrencyProvider.java
示例7: main
import org.javamoney.moneta.CurrencyUnitBuilder; //导入依赖的package包/类
public static void main(String... arg) throws MonetaryException {
CurrencyUnit btc = CurrencyUnitBuilder.of("BTC", "Bitcoin.de").build();
System.out.println("Currency: " + btc);
//MtGoxV2ConversionProvider provider = new MtGoxV2ConversionProvider("USD");
BitcoinDeRateProvider provider = new BitcoinDeRateProvider();
provider.loadRate("USD", true);
ExchangeRate rate = provider.getExchangeRate(Monetary.getCurrency("USD"), btc);
System.out.println("Rate: " + rate);
rate = provider.getExchangeRate(Monetary.getCurrency("EUR"), btc);
System.out.println("Rate2: " + rate);
rate = provider.getExchangeRate(Monetary.getCurrency("CHF"), btc);
System.out.println("Rate3: " + rate);
}
开发者ID:JavaMoney,项目名称:javamoney-shelter,代码行数:16,代码来源:BitcoinDeConversionDemo.java
示例8: testCashRoundings
import org.javamoney.moneta.CurrencyUnitBuilder; //导入依赖的package包/类
@Test
public void testCashRoundings(){
CurrencyUnit chf = CurrencyUnitBuilder.of("CHF","").build();
CurrencyUnit eur = CurrencyUnitBuilder.of("EUR","").build();
CurrencyUnit sek = CurrencyUnitBuilder.of("SEK","").build();
MonetaryRounding rounding = Monetary.getRounding(
RoundingQueryBuilder.of()
.setCurrency(chf)
.set("cashRounding", true).build());
MonetaryRounding roundingEUR = Monetary.getRounding(
RoundingQueryBuilder.of()
.setCurrency(eur)
.set("cashRounding", true).build());
MonetaryRounding roundingSEK = Monetary.getRounding(
RoundingQueryBuilder.of()
.setCurrency(sek)
.set("cashRounding", true).build());
System.out.println(MonetaryFormats.getAmountFormat(new Locale("ch", "")).format(Money.of(3459.97,chf)));
System.out.println(MonetaryFormats.getAmountFormat(new Locale("ch", "")).format(Money.of(3459.97,chf).with(rounding)));
System.out.println(MonetaryFormats.getAmountFormat(new Locale("de", "")).format(Money.of(3459.97,eur)));
System.out.println(MonetaryFormats.getAmountFormat(new Locale("de", "")).format(Money.of(3459.97,eur).with(roundingEUR)));
System.out.println(MonetaryFormats.getAmountFormat(new Locale("sv", "")).format(Money.of(3459.97,sek)));
System.out.println(MonetaryFormats.getAmountFormat(new Locale("sv", "")).format(Money.of(3459.97,sek).with(roundingSEK)));
}
开发者ID:JavaMoney,项目名称:jsr354-ri,代码行数:32,代码来源:MonetaryRoundingsTest.java
示例9: main
import org.javamoney.moneta.CurrencyUnitBuilder; //导入依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
ConsoleUtils.printDetails(Monetary.getCurrency("CHF"));
Monetary.getCurrencies(CurrencyQueryBuilder.of().setProviderNames("ConfigurableCurrencyUnitProvider").build()).forEach(
ConsoleUtils::printDetails
);
CurrencyUnitBuilder.of("GeeCon", "GeeCon-Conference").build(true);
Monetary.getCurrencies(CurrencyQueryBuilder.of().setProviderNames("ConfigurableCurrencyUnitProvider").build()).forEach(
ConsoleUtils::printDetails
);
}
开发者ID:JavaMoney,项目名称:javamoney-examples,代码行数:16,代码来源:CurrenciesAccess.java
示例10: main
import org.javamoney.moneta.CurrencyUnitBuilder; //导入依赖的package包/类
public static void main(String[] args) {
ConsoleUtils.printDetails(
CurrencyUnitBuilder.of("GeeCoin", "BuildingCurrenciesExample").setCurrencyCode("GCC").setDefaultFractionDigits(2).build());
Monetary.getCurrencies(CurrencyQueryBuilder.of().setProviderNames("ConfigurableCurrencyUnitProvider").build()).forEach(
ConsoleUtils::printDetails
);
ConsoleUtils.printDetails(
CurrencyUnitBuilder.of("GeeCoin", "BuildingCurrenciesExample").setCurrencyCode("GCC").setDefaultFractionDigits(2).build(true));
}
开发者ID:JavaMoney,项目名称:javamoney-examples,代码行数:10,代码来源:CurrenciesUseBuilder.java
示例11: CDITestCurrencyProvider
import org.javamoney.moneta.CurrencyUnitBuilder; //导入依赖的package包/类
public CDITestCurrencyProvider() {
currencies.add(CurrencyUnitBuilder.of("CDITest", "CDITestCurrencyProvider").build());
currencies = Collections.unmodifiableSet(currencies);
}
开发者ID:JavaMoney,项目名称:javamoney-lib,代码行数:5,代码来源:CDITestCurrencyProvider.java
示例12: GeeConCurrencyProvider
import org.javamoney.moneta.CurrencyUnitBuilder; //导入依赖的package包/类
public GeeConCurrencyProvider(){
currencies.add(CurrencyUnitBuilder.of("GeeCon1",context ).setDefaultFractionDigits(1).build());
currencies.add(CurrencyUnitBuilder.of("GeeCon2",context ).setDefaultFractionDigits(2).build());
currencies.add(CurrencyUnitBuilder.of("GeeCon3",context ).setDefaultFractionDigits(3).build());
currencies = Collections.unmodifiableSet(currencies);
}
开发者ID:JavaMoney,项目名称:javamoney-examples,代码行数:7,代码来源:GeeConCurrencyProvider.java
注:本文中的org.javamoney.moneta.CurrencyUnitBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论