Joda-Money

表示货币金额的 Java 库。「Java library to represent monetary amounts.」

  • 所有者: JodaOrg/joda-money
  • 平台: Linux,Mac,Windows,BSD,Unix-like,Solaris
  • 许可证: Apache License 2.0
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Joda-Money

Joda-Money provides a library of classes to store amounts of money.

Joda-Money does not provide, nor is it intended to provide, monetary algorithms beyond the most basic and obvious.
This is because the requirements for these algorithms vary widely between domains.
This library is intended to act as the base layer, providing classes that should be in the JDK.

As a flavour of Joda-Money, here's some example code:

// create a monetary value
Money money = Money.parse("USD 23.87");

// add another amount with safe double conversion
CurrencyUnit usd = CurrencyUnit.of("USD");
money = money.plus(Money.of(usd, 12.43d));

// subtracts an amount in dollars
money = money.minusMajor(2);

// multiplies by 3.5 with rounding
money = money.multipliedBy(3.5d, RoundingMode.DOWN);

// compare two amounts
boolean bigAmount = money.isGreaterThan(dailyWage);

// convert to GBP using a supplied rate
BigDecimal conversionRate = ...;  // obtained from code outside Joda-Money
Money moneyGBP = money.convertedTo(CurrencyUnit.GBP, conversionRate, RoundingMode.HALF_EVEN);

// use a BigMoney for more complex calculations where scale matters
BigMoney moneyCalc = money.toBigMoney();

Users are reminded that this software, like all open source software, is provided
on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.

Joda-Money is licensed under the business-friendly Apache 2.0 licence.

Documentation

Various documentation is available:

Releases

Release 1.0.1 is the current release.
This release is considered stable and worthy of the 1.x tag.
It depends on Java SE 8 or later.

Joda-Money does have a compile-time dependency on Joda-Convert, but this is not required at runtime
thanks to the magic of annotations.

Available in the Maven Central repository

Tidelift dependency check

Support

Please use Stack Overflow for general usage questions.
GitHub issues and pull requests
should be used when you want to help advance the project.
Commercial support is available via the
Tidelift subscription.

To report a security vulnerability, please use the Tidelift security contact.
Tidelift will coordinate the fix and disclosure.

Release process

  • Update version (README.md, index.md, changes.xml)
  • Commit and push
  • mvn clean release:clean release:prepare release:perform
  • git fetch
  • Website will be built and released by Travis

主要指标

概览
名称与所有者JodaOrg/joda-money
主编程语言Java
编程语言Java (语言数: 3)
平台
许可证Apache License 2.0
所有者活动
创建于2011-05-10 14:55:09
推送于2025-08-15 21:48:40
最后一次提交
发布数20
最新版本名称v2.0.2 (发布于 2025-03-17 22:02:38)
第一版名称v0.5 (发布于 )
用户参与
星数669
关注者数25
派生数120
提交数424
已启用问题?
问题数85
打开的问题数9
拉请求数61
打开的拉请求数0
关闭的拉请求数13
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?