Awesome Open Source
Awesome Open Source

Joda Money example for Play and Slick

Sample Play framework application to demonstate using Joda Money.

This includes:

  • template helper for rendering currency input - views/helper/inputCurrency.scala.html
  • form mapping for nested org.joda.money.Money values - app.models.JodaMoney.jodaMoney
  • implicit conversion from a (currency, amount) tuples to Money values - app.models.JodaMoney.tuple2Money
  • Slick persistence using the MySQL DECIMAL(13,3) column type.

This example requires Java 7, for the use of java.util.Currency.getDisplayName in the page template. To use Java 6, replace this with a message look-up from the messages file, generated on Java 7 with:

    import scala.collection.JavaConverters._
    org.joda.money.CurrencyUnit.registeredCurrencies.asScala.map {
      currency => s"currency.${currency.getCurrencyCode} = ${currency.toCurrency.getDisplayName}"
    }.mkString("\n")


Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Java (388,606
Scala (28,670
Play Framework (14,769
Currency (6,057
Money (4,291
Joda (284