Joda-Money

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

  • Owner: JodaOrg/joda-money
  • Platform: Linux,Mac,Windows,BSD,Unix-like,Solaris
  • License:: Apache License 2.0
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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

Main metrics

Overview
Name With OwnerJodaOrg/joda-money
Primary LanguageJava
Program languageJava (Language Count: 3)
Platform
License:Apache License 2.0
所有者活动
Created At2011-05-10 14:55:09
Pushed At2025-03-17 22:05:33
Last Commit At
Release Count20
Last Release Namev2.0.2 (Posted on 2025-03-17 22:02:38)
First Release Namev0.5 (Posted on )
用户参与
Stargazers Count669
Watchers Count25
Fork Count119
Commits Count421
Has Issues Enabled
Issues Count84
Issue Open Count8
Pull Requests Count60
Pull Requests Open Count0
Pull Requests Close Count13
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private