use of java.util.Currency in project camel by apache.
the class InstanceFallbackConverterTest method testInstanceFallbackConverter.
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 says " + context.getName(), money);
}
use of java.util.Currency in project camel by apache.
the class InstanceFallbackConverterTest method testInstanceFallbackMandatoryConverter.
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 says " + context.getName(), money);
}
use of java.util.Currency in project fastjson by alibaba.
the class CurrencyTest4 method test_0.
public void test_0() throws Exception {
JSONObject jsonObject = new JSONObject();
jsonObject.put("currency", "CNY");
String text = JSON.toJSONString(jsonObject);
Currency currency = JSON.parseObject(text, Currency.class);
assertSame(Currency.getInstance("CNY"), currency);
}
use of java.util.Currency in project fastjson by alibaba.
the class CurrencyTest4 method test_1.
public void test_1() throws Exception {
JSONObject jsonObject = new JSONObject();
jsonObject.put("symbol", "CNY");
String text = JSON.toJSONString(jsonObject);
Currency currency = JSON.parseObject(text, Currency.class);
assertSame(Currency.getInstance("CNY"), currency);
}
use of java.util.Currency in project hibernate-orm by hibernate.
the class MonetaryAmountUserType method nullSafeGet.
@Override
public Object nullSafeGet(ResultSet resultSet, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
BigDecimal value = resultSet.getBigDecimal(names[0]);
if (resultSet.wasNull()) {
return null;
}
String cur = resultSet.getString(names[1]);
Currency userCurrency = Currency.getInstance(cur);
return new MonetaryAmount(value, userCurrency);
}
Aggregations