use of java.util.Currency in project hibernate-orm by hibernate.
the class MonetaryAmountUserType method nullSafeGet.
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
BigDecimal amt = StandardBasicTypes.BIG_DECIMAL.nullSafeGet(rs, names[0], session);
Currency cur = StandardBasicTypes.CURRENCY.nullSafeGet(rs, names[1], session);
if (amt == null)
return null;
return new MonetaryAmount(amt, cur);
}
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 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);
}
use of java.util.Currency in project jackson-databind by FasterXML.
the class JDKStringLikeTypesTest method testCurrency.
public void testCurrency() throws IOException {
Currency usd = Currency.getInstance("USD");
assertEquals(usd, new ObjectMapper().readValue(quote("USD"), Currency.class));
}
Aggregations