Questions tagged [java-money]

Java Money and Currency API for the Java

JSR 354 JavaMoney Provides a portable and extensible framework for handling of Money & Currency for Java™. The API models monetary amounts and currencies in a platform independent and portable way, including well defined extension points. It's API defines a simple yet flexible contract that enables users to choose the implementation matching their target requirements best and having full control about the numeric state at all stages during monetary processing.

54 questions
1
vote
1 answer

IntelliJ: How to import a folder of .java files as a library?

It's probably a stupid question, but I can't figure out how to properly import a folder of .java files as a library into my IntelliJ project. I am trying to use the JavaMoney API, which I downloaded from here. I know that the normal way would be…
gmolau
  • 2,815
  • 1
  • 22
  • 45
1
vote
2 answers

Get display name of javax.money.CurrencyUnit

I have an instance of javax.money.CurrencyUnit and I want to display what is it's name in a given locale (for example "US Dollars", "Euro", "Japenese Yen", etc). I've read all the documentation but the only thing I was able to find is how to format…
Petar Tahchiev
  • 4,336
  • 4
  • 35
  • 48
1
vote
1 answer

Why is javax.money.CurrencyUnit not Serializable?

Why does javax.money.CurrencyUnit not extend from java.io.Serializable? All of its subtypes implement java.io.Serializable, and on top of that, if you want to use it in your hibernate mapping, then findbugs will stop you (quite correctly)…
Petar Tahchiev
  • 4,336
  • 4
  • 35
  • 48
1
vote
1 answer

Monetary.of(new BigDecimal("100.00"), "EUR") prints "EUR 1E+2"

So here's the question: why this: Monetary.of(new BigDecimal("100.00"), "EUR") prints "EUR 1E+2", but any other decimal != .00 will print correct: Monetary.of(new BigDecimal("100.01"), "EUR") "EUR 100.01"???
Petar Tahchiev
  • 4,336
  • 4
  • 35
  • 48
0
votes
0 answers

Is any Joda library method is there to convert Joda.Money to Pennies?

I want to convert Joda.Money to pennies. Is there any Joda library method available? Sample input: USD 233.33 Sample output: 23333 Tried below 2 options: tried with Money.getAmountMinorInt() and it's returning with multiplies of 100. getAmount…
Remo
  • 534
  • 7
  • 26
0
votes
1 answer

Is there a way to prevent `spring-data-redis` from index nested properties of a particular entity field

Problem I am trying to save an entity that has a field of type javax.money.MonetaryAmount to Redis using spring-data-redis: @RedisHash("transaction") class Transaction( @org.springframework.data.annotation.Id val id: Id, val description:…
W.K.S
  • 9,787
  • 15
  • 75
  • 122
0
votes
0 answers

MonetaryConversions functions of java-money module do not work

JavaFX Application raises an error when I try to call any MonetaryConversions function. The error message cointains org.javamoney.moneta.spi.loader.ResourceCache: module org.javamoney.moneta does not declare…
0
votes
0 answers

How to rename a key of a Money java object in jsonb Postgres

I'm unable to find a way to rename a key in a JSONB. The json I have is the following: {"array": ["value1", "value2", "value3"], "moneyJavaObject": {"amount": 100.0, "currency":"EUR"}} I am trying to rename the "amount" key to -> "value". Thank you…
Vos
  • 41
  • 5
0
votes
2 answers

Problems with Java moneta Money object when used in an Axon command

I have an Axon Command which has an moneta Money object. import lombok.Getter; import lombok.ToString; import lombok.experimental.SuperBuilder; import org.javamoney.moneta.Money; import java.time.LocalDate; import…
Jan
  • 61
  • 6
0
votes
1 answer

Custom Json serialization format for MonetaryAmount JSR354 / moneta, How to register the Serializer properly

Hello stackoverflow experts I have the following InvoiceItem Class which has monetary Amounts import jakarta.json.bind.annotation.JsonbProperty; import jakarta.json.bind.annotation.JsonbTypeSerializer; import…
Toasterson
  • 115
  • 1
  • 2
  • 11
0
votes
1 answer

DefaultMonetaryConversionsSingletonSpi could not be instantiated

I am using Java money API in Eclipse to get convert USD to EUR but I am getting following error Provider org.javamoney.moneta.internal.convert.DefaultMonetaryConversionsSingletonSpi could not be instantiated Below is the code from my…
Waleed Asif
  • 159
  • 3
  • 15
0
votes
1 answer

Java Money get exchange rate hanging

I was trying simple money conversion in using java money-api & moneta repository. javax.money money-api 1.1
0
votes
0 answers

Java Money odd number division and rounding without losing/gaining cents

I have a rounding problem regards to money calculation and its precision. I am using Java Money (Moneta) libaray for all my calculations. I store BigDecimal values in database using NUMERIC(19,4) Problem Given I have shopping cart in total amount…
Vaelyr
  • 2,841
  • 2
  • 21
  • 34
0
votes
1 answer

Javamoney.moneta.Money serialized/deserialized as null although I have jackson-datatype-money dependency

I just want to provide a rest endpoint where the user can send the money amount. I decided to use javamoney.moneta.Money for the first time and it has been persisted in Postgres as null. Here is the model: import javax.persistence.Entity; import…
Jim C
  • 3,957
  • 25
  • 85
  • 162
0
votes
1 answer

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of

I am creating spring web application and trying to add new Entity with Money data(javamoney.moneta). Here is code: @Column(name = FLD_MONEY, unique = false, nullable = true) private FastMoney money; private String currencyUnit; public…
Danik
  • 115
  • 1
  • 2
  • 12