SlideShare a Scribd company logo
Money, Money, Money,
can be funny
with JSR 354
Werner Keil
@wernerkeil
@jsr354
November 4, 2019
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Who am I?
Werner Keil
• Consultant – Coach
• Creative Cosmopolitan
• Open Source Evangelist
• Software Architect
• Maintenance Lead – JSR 354
• Maintenance Lead – JSR 385
[www.linkedin.com/in/catmedia]
Twitter @wernerkeil
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Agenda
1. History and Motivation
2. Overview
3. Currencies and Amounts
4. Precision, Rounding and Conversion
5. Action
6. Roadmap
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
History and Motivation
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Motivation
Monetary values are a key feature to many applications
Existing java.util.Currency class is strictly a structure used for
representing ISO-4217 standard currencies.
No standard value type to represent a monetary amount
No support for currency arithmetic or conversion
JDK Formatting features lack flexibility
<dependency>
<groupId>org.javamoney</groupId>
<artifactId>moneta</artifactId>
<version>1.3</version>
</dependency>
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Overview of JSR 354
Core API: javax.money
CurrencyUnit, MonetaryAmount and exceptions
Conversion API: javax.money.convert
ExchangeRate, ConversionContext, CurrencyConversion
Formatting: javax.money.format
AmountFormatContext, MonetaryAmountFormat
Extensions: javax.money.spi
CurrencyProvider, RoundingProvider, ServiceProvider,…
Reference Implementation: org.javamoney.moneta
TCK: org.javamoney.tck
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Currencies and Amounts
javax.money
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Currencies
ISO 4217
Special Codes
Ambiguities
Unmodeled
Aspects
Minor units
• Precious Metals (XAU, XAG)
• Testing (XTS)
• No Currency (XXX)
• Supranational currencies, e.g. East Caribbean dollar,
the CFP franc, the CFA franc.
• CFA franc: West African CFA franc und Central African CFA
franc = denotes 2 effectively interchangeable (!).
• Switzerland: CHF, CHE (WIR-EURO), CHW (WIR)
• USA: USD, USN (next day), USS (same day)
Legal acceptance, e.g. Indian Rupees are legally accepted in
Bhutan/Nepal, but not vice versa!
Typically 1/100, rarely 1/1000, but also 1/5
(Mauritania, Madagascar), 0.00000001 (Bitcoin)
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Video Game Currencies (Gold, Gil, Rupees, Credits, Gold Rings, Hearts, Zenny,
Potch, Munny, Nuyen…)
Facebook Libra, a new virtual currency you can use to buy
virtual goods in any games or apps of the Facebook
platform that accept payments. Facebook also
plans to use Libra for money transfer similar to
Western Union, MoneyGram or others.
Scrutiny by regulators and some countries
like China may not allow it at all
Bitcoin (sign: BTC) is a decentralized digital currency
based on an open-source, peer-to-peer internet protocol.
It was introduced by a pseudonymous developer named
Satoshi Nakamoto in 2009. Hundreds of “Altcoins” followed
Virtual Currencies
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Local Currencies
Brixton, Bristol Pound,...
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Precision and Rounding
javax.money
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Numeric Precision
• Internal Precision (implied by internal number type)
• External Precision (Rounding applied, when the numeric part is
accessed/passed outside)
• Formatting Precision (Rounding for display and output)
• Interoperability
• Different precision/scale
• Distinct numeric representation
• Serialization
-> only internal rounding is applied automatically.
-> The precision/scale capabilities of an MonetaryAmount are inherited
to its operational results.
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Rounding
• External Rounding and Formatting Rounding depends on use case
• Rounding is modeled as a MonetaryOperator
Example for non standard-rounding: Argentina
• If the third digit is 2 or less,
change it to 0 or drop it.
• If the third digit is between 3
and 7, change it to 5.
• If the third digit is 8 or more, add
one to the second digit and drop the third digit
or change it to 0.
Original Rounded Remark
123.452 123.45 3. digit <3 -> round down
123.456 123.455 3<= 3. digit <=7 -> change to 5
123.459 123.46 3. digit >=8 -> round up
Implementation:
MoneyRounding
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Currency Conversion
javax.money.convert
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Adopters
@YourTwitterHandle#DVXFR14{session hashtag} © 2012-2019 JavaMoney project and others. All rights reserved.#DWX #JavaMoney @jsr354
Action
@wernerkeil
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Roadmap
• Embracing Java 8 features
• Further support of JSR 310 (Date & Time) types
• Type Annotations (if appropriate)
• Use of Lambdas where appropriate
• Alignment with Java 9+ features
• Modular environment - While the API should be backward-compatible with at least Java SE 8, both
API and RI expose Java 9 modules
• Multi-release JAR files - This should allow a single API and RI to support Java 8, 9 and beyond.
• Bean Validation Support
• Valhalla Inline Types when available
• See https://github.com/JavaMoney/jsr354-api/issues
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
Links
JavaMoney: http://javamoney.org
JSR 354 Twitter Account: @jsr354
JSR detail page on JCP.org: https://www.jcp.org/en/jsr/detail?id=354
JavaMoney on GitHub: https://github.com/JavaMoney
JavaMoney on Groups.io: https://javamoney.groups.io
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil @thodorisbais@wernerkeil
We’re running for an Associate Seat!
© 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil
@wernerkeil

More Related Content

Similar to Money, Money, Money, can be funny with JSR 354 (Devoxx BE)

Top crypto wallets best 7 bitcoin wallet apps in 2022
Top crypto wallets  best 7 bitcoin wallet apps in 2022Top crypto wallets  best 7 bitcoin wallet apps in 2022
Top crypto wallets best 7 bitcoin wallet apps in 2022
Moon Technolabs Pvt. Ltd.
 
Describe how corda works
Describe how corda works Describe how corda works
Describe how corda works
Blockchain Council
 
Winning in a 
Mobile Search World #LearnInbound
Winning in a 
Mobile Search World #LearnInboundWinning in a 
Mobile Search World #LearnInbound
Winning in a 
Mobile Search World #LearnInbound
Aleyda Solís
 
Developing DeFi (decentralised finance) apps with Ethereum
Developing DeFi (decentralised finance) apps with EthereumDeveloping DeFi (decentralised finance) apps with Ethereum
Developing DeFi (decentralised finance) apps with Ethereum
Michael John Peña
 
Cryptosherlock oneledger research
Cryptosherlock oneledger researchCryptosherlock oneledger research
Cryptosherlock oneledger research
stsoien
 
Fundyourselfnow
FundyourselfnowFundyourselfnow
Fundyourselfnow
incredibleden
 
Cryset Pitch Deck
Cryset Pitch DeckCryset Pitch Deck
Cryset Pitch Deck
Munachi Ogueke
 
JFall 2016: Oracle JET Session
JFall 2016: Oracle JET SessionJFall 2016: Oracle JET Session
JFall 2016: Oracle JET Session
Geertjan Wielenga
 
8 online blockchain learning practices you need to prioritize before moving i...
8 online blockchain learning practices you need to prioritize before moving i...8 online blockchain learning practices you need to prioritize before moving i...
8 online blockchain learning practices you need to prioritize before moving i...
Blockchain Council
 
Here's how blockchain experts make money
Here's how blockchain experts make moneyHere's how blockchain experts make money
Here's how blockchain experts make money
Blockchain Council
 
Ebbcash presentation #1
Ebbcash presentation #1Ebbcash presentation #1
Ebbcash presentation #1
YobitKue
 
JSR 354 - Money and Currency API for Java
JSR 354 - Money and Currency API for JavaJSR 354 - Money and Currency API for Java
JSR 354 - Money and Currency API for Java
Werner Keil
 
Talk to MOE educators@Singapore Science Centre for Animate@South Zone
Talk to MOE educators@Singapore Science Centre for Animate@South ZoneTalk to MOE educators@Singapore Science Centre for Animate@South Zone
Talk to MOE educators@Singapore Science Centre for Animate@South Zone
James Chan
 
DEVBCN_Jakarta EE! The future of enterprise application behind the myths. _Al...
DEVBCN_Jakarta EE! The future of enterprise application behind the myths.
_Al...DEVBCN_Jakarta EE! The future of enterprise application behind the myths.
_Al...
DEVBCN_Jakarta EE! The future of enterprise application behind the myths. _Al...
Alberto Salazar
 
Developer Report 2021 (Published: January 2021)
Developer Report 2021 (Published: January 2021)Developer Report 2021 (Published: January 2021)
Developer Report 2021 (Published: January 2021)
Maria Xinhe Shen
 
How to become a Blockchain developer ?
How to become a Blockchain developer ?How to become a Blockchain developer ?
How to become a Blockchain developer ?
Blockchain Council
 
Cryptocurrency Exchange App
Cryptocurrency Exchange AppCryptocurrency Exchange App
Cryptocurrency Exchange App
The NineHertz
 
Developer Report 2021 (Published: January 2021)
Developer Report 2021 (Published: January 2021)Developer Report 2021 (Published: January 2021)
Developer Report 2021 (Published: January 2021)
Maria Xinhe Shen
 

Similar to Money, Money, Money, can be funny with JSR 354 (Devoxx BE) (20)

Top crypto wallets best 7 bitcoin wallet apps in 2022
Top crypto wallets  best 7 bitcoin wallet apps in 2022Top crypto wallets  best 7 bitcoin wallet apps in 2022
Top crypto wallets best 7 bitcoin wallet apps in 2022
 
Sambasiva Suresh Kumar (1)
Sambasiva Suresh Kumar (1)Sambasiva Suresh Kumar (1)
Sambasiva Suresh Kumar (1)
 
Describe how corda works
Describe how corda works Describe how corda works
Describe how corda works
 
Winning in a 
Mobile Search World #LearnInbound
Winning in a 
Mobile Search World #LearnInboundWinning in a 
Mobile Search World #LearnInbound
Winning in a 
Mobile Search World #LearnInbound
 
Developing DeFi (decentralised finance) apps with Ethereum
Developing DeFi (decentralised finance) apps with EthereumDeveloping DeFi (decentralised finance) apps with Ethereum
Developing DeFi (decentralised finance) apps with Ethereum
 
Cryptosherlock oneledger research
Cryptosherlock oneledger researchCryptosherlock oneledger research
Cryptosherlock oneledger research
 
Fundyourselfnow
FundyourselfnowFundyourselfnow
Fundyourselfnow
 
Cryset Pitch Deck
Cryset Pitch DeckCryset Pitch Deck
Cryset Pitch Deck
 
JFall 2016: Oracle JET Session
JFall 2016: Oracle JET SessionJFall 2016: Oracle JET Session
JFall 2016: Oracle JET Session
 
Introduction to SharePoint
Introduction to SharePointIntroduction to SharePoint
Introduction to SharePoint
 
8 online blockchain learning practices you need to prioritize before moving i...
8 online blockchain learning practices you need to prioritize before moving i...8 online blockchain learning practices you need to prioritize before moving i...
8 online blockchain learning practices you need to prioritize before moving i...
 
Here's how blockchain experts make money
Here's how blockchain experts make moneyHere's how blockchain experts make money
Here's how blockchain experts make money
 
Ebbcash presentation #1
Ebbcash presentation #1Ebbcash presentation #1
Ebbcash presentation #1
 
JSR 354 - Money and Currency API for Java
JSR 354 - Money and Currency API for JavaJSR 354 - Money and Currency API for Java
JSR 354 - Money and Currency API for Java
 
Talk to MOE educators@Singapore Science Centre for Animate@South Zone
Talk to MOE educators@Singapore Science Centre for Animate@South ZoneTalk to MOE educators@Singapore Science Centre for Animate@South Zone
Talk to MOE educators@Singapore Science Centre for Animate@South Zone
 
DEVBCN_Jakarta EE! The future of enterprise application behind the myths. _Al...
DEVBCN_Jakarta EE! The future of enterprise application behind the myths.
_Al...DEVBCN_Jakarta EE! The future of enterprise application behind the myths.
_Al...
DEVBCN_Jakarta EE! The future of enterprise application behind the myths. _Al...
 
Developer Report 2021 (Published: January 2021)
Developer Report 2021 (Published: January 2021)Developer Report 2021 (Published: January 2021)
Developer Report 2021 (Published: January 2021)
 
How to become a Blockchain developer ?
How to become a Blockchain developer ?How to become a Blockchain developer ?
How to become a Blockchain developer ?
 
Cryptocurrency Exchange App
Cryptocurrency Exchange AppCryptocurrency Exchange App
Cryptocurrency Exchange App
 
Developer Report 2021 (Published: January 2021)
Developer Report 2021 (Published: January 2021)Developer Report 2021 (Published: January 2021)
Developer Report 2021 (Published: January 2021)
 

More from Werner Keil

Securing eHealth, eGovernment and eBanking with Java - DWX '21
Securing eHealth, eGovernment and eBanking with Java - DWX '21Securing eHealth, eGovernment and eBanking with Java - DWX '21
Securing eHealth, eGovernment and eBanking with Java - DWX '21
Werner Keil
 
OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021
Werner Keil
 
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
Werner Keil
 
OpenDDR and Jakarta MVC - Java2Days 2020 Virtual
OpenDDR and Jakarta MVC - Java2Days 2020 VirtualOpenDDR and Jakarta MVC - Java2Days 2020 Virtual
OpenDDR and Jakarta MVC - Java2Days 2020 Virtual
Werner Keil
 
NoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualNoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 Virtual
Werner Keil
 
JCON 2020: Mobile Java Web Applications with MVC and OpenDDR
JCON 2020: Mobile Java Web Applications with MVC and OpenDDRJCON 2020: Mobile Java Web Applications with MVC and OpenDDR
JCON 2020: Mobile Java Web Applications with MVC and OpenDDR
Werner Keil
 
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
Werner Keil
 
NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL: The first New Jakarta EE Specification (DWX 2019)NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL: The first New Jakarta EE Specification (DWX 2019)
Werner Keil
 
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR DayHow JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
Werner Keil
 
JNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL DatabasesJNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL Databases
Werner Keil
 
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL DatabasesEclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Werner Keil
 
Physikal - Using Kotlin for Clean Energy - KUG Munich
Physikal - Using Kotlin for Clean Energy - KUG MunichPhysikal - Using Kotlin for Clean Energy - KUG Munich
Physikal - Using Kotlin for Clean Energy - KUG Munich
Werner Keil
 
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Werner Keil
 
Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017
Werner Keil
 
Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363
Werner Keil
 
Java2Days - Security for JavaEE and the Cloud
Java2Days - Security for JavaEE and the CloudJava2Days - Security for JavaEE and the Cloud
Java2Days - Security for JavaEE and the Cloud
Werner Keil
 
Apache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ StuttgartApache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ Stuttgart
Werner Keil
 
The First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
The First IoT JSR: Units of Measurement - JUG Berlin-BrandenburgThe First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
The First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
Werner Keil
 
JSR 354: Money and Currency API - Short Overview
JSR 354: Money and Currency API - Short OverviewJSR 354: Money and Currency API - Short Overview
JSR 354: Money and Currency API - Short Overview
Werner Keil
 
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit AgoravaJavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
Werner Keil
 

More from Werner Keil (20)

Securing eHealth, eGovernment and eBanking with Java - DWX '21
Securing eHealth, eGovernment and eBanking with Java - DWX '21Securing eHealth, eGovernment and eBanking with Java - DWX '21
Securing eHealth, eGovernment and eBanking with Java - DWX '21
 
OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021
 
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
How JSR 385 could have Saved the Mars Climate Orbiter - Zurich IoT Day 2021
 
OpenDDR and Jakarta MVC - Java2Days 2020 Virtual
OpenDDR and Jakarta MVC - Java2Days 2020 VirtualOpenDDR and Jakarta MVC - Java2Days 2020 Virtual
OpenDDR and Jakarta MVC - Java2Days 2020 Virtual
 
NoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualNoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 Virtual
 
JCON 2020: Mobile Java Web Applications with MVC and OpenDDR
JCON 2020: Mobile Java Web Applications with MVC and OpenDDRJCON 2020: Mobile Java Web Applications with MVC and OpenDDR
JCON 2020: Mobile Java Web Applications with MVC and OpenDDR
 
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
How JSR 385 could have Saved the Mars Climate Orbiter - JFokus 2020
 
NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL: The first New Jakarta EE Specification (DWX 2019)NoSQL: The first New Jakarta EE Specification (DWX 2019)
NoSQL: The first New Jakarta EE Specification (DWX 2019)
 
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR DayHow JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
How JSR 385 could have Saved the Mars Climate Orbiter - Adopt-a-JSR Day
 
JNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL DatabasesJNoSQL: The Definitive Solution for Java and NoSQL Databases
JNoSQL: The Definitive Solution for Java and NoSQL Databases
 
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL DatabasesEclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
Eclipse JNoSQL: The Definitive Solution for Java and NoSQL Databases
 
Physikal - Using Kotlin for Clean Energy - KUG Munich
Physikal - Using Kotlin for Clean Energy - KUG MunichPhysikal - Using Kotlin for Clean Energy - KUG Munich
Physikal - Using Kotlin for Clean Energy - KUG Munich
 
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
Physikal - JSR 363 and Kotlin for Clean Energy - Java2Days 2017
 
Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017
 
Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363
 
Java2Days - Security for JavaEE and the Cloud
Java2Days - Security for JavaEE and the CloudJava2Days - Security for JavaEE and the Cloud
Java2Days - Security for JavaEE and the Cloud
 
Apache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ StuttgartApache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ Stuttgart
 
The First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
The First IoT JSR: Units of Measurement - JUG Berlin-BrandenburgThe First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
The First IoT JSR: Units of Measurement - JUG Berlin-Brandenburg
 
JSR 354: Money and Currency API - Short Overview
JSR 354: Money and Currency API - Short OverviewJSR 354: Money and Currency API - Short Overview
JSR 354: Money and Currency API - Short Overview
 
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit AgoravaJavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
JavaLand: Quantified Social - Fitness-Geräte und -Portale mit Agorava
 

Recently uploaded

GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 

Recently uploaded (20)

GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 

Money, Money, Money, can be funny with JSR 354 (Devoxx BE)

  • 1. Money, Money, Money, can be funny with JSR 354 Werner Keil @wernerkeil @jsr354 November 4, 2019
  • 2. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Who am I? Werner Keil • Consultant – Coach • Creative Cosmopolitan • Open Source Evangelist • Software Architect • Maintenance Lead – JSR 354 • Maintenance Lead – JSR 385 [www.linkedin.com/in/catmedia] Twitter @wernerkeil
  • 3. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Agenda 1. History and Motivation 2. Overview 3. Currencies and Amounts 4. Precision, Rounding and Conversion 5. Action 6. Roadmap
  • 4. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil History and Motivation
  • 5. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Motivation Monetary values are a key feature to many applications Existing java.util.Currency class is strictly a structure used for representing ISO-4217 standard currencies. No standard value type to represent a monetary amount No support for currency arithmetic or conversion JDK Formatting features lack flexibility <dependency> <groupId>org.javamoney</groupId> <artifactId>moneta</artifactId> <version>1.3</version> </dependency>
  • 6. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Overview of JSR 354 Core API: javax.money CurrencyUnit, MonetaryAmount and exceptions Conversion API: javax.money.convert ExchangeRate, ConversionContext, CurrencyConversion Formatting: javax.money.format AmountFormatContext, MonetaryAmountFormat Extensions: javax.money.spi CurrencyProvider, RoundingProvider, ServiceProvider,… Reference Implementation: org.javamoney.moneta TCK: org.javamoney.tck
  • 7. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Currencies and Amounts javax.money
  • 8. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Currencies ISO 4217 Special Codes Ambiguities Unmodeled Aspects Minor units • Precious Metals (XAU, XAG) • Testing (XTS) • No Currency (XXX) • Supranational currencies, e.g. East Caribbean dollar, the CFP franc, the CFA franc. • CFA franc: West African CFA franc und Central African CFA franc = denotes 2 effectively interchangeable (!). • Switzerland: CHF, CHE (WIR-EURO), CHW (WIR) • USA: USD, USN (next day), USS (same day) Legal acceptance, e.g. Indian Rupees are legally accepted in Bhutan/Nepal, but not vice versa! Typically 1/100, rarely 1/1000, but also 1/5 (Mauritania, Madagascar), 0.00000001 (Bitcoin)
  • 9. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Video Game Currencies (Gold, Gil, Rupees, Credits, Gold Rings, Hearts, Zenny, Potch, Munny, Nuyen…) Facebook Libra, a new virtual currency you can use to buy virtual goods in any games or apps of the Facebook platform that accept payments. Facebook also plans to use Libra for money transfer similar to Western Union, MoneyGram or others. Scrutiny by regulators and some countries like China may not allow it at all Bitcoin (sign: BTC) is a decentralized digital currency based on an open-source, peer-to-peer internet protocol. It was introduced by a pseudonymous developer named Satoshi Nakamoto in 2009. Hundreds of “Altcoins” followed Virtual Currencies
  • 10. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Local Currencies Brixton, Bristol Pound,...
  • 11. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Precision and Rounding javax.money
  • 12. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Numeric Precision • Internal Precision (implied by internal number type) • External Precision (Rounding applied, when the numeric part is accessed/passed outside) • Formatting Precision (Rounding for display and output) • Interoperability • Different precision/scale • Distinct numeric representation • Serialization -> only internal rounding is applied automatically. -> The precision/scale capabilities of an MonetaryAmount are inherited to its operational results.
  • 13. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Rounding • External Rounding and Formatting Rounding depends on use case • Rounding is modeled as a MonetaryOperator Example for non standard-rounding: Argentina • If the third digit is 2 or less, change it to 0 or drop it. • If the third digit is between 3 and 7, change it to 5. • If the third digit is 8 or more, add one to the second digit and drop the third digit or change it to 0. Original Rounded Remark 123.452 123.45 3. digit <3 -> round down 123.456 123.455 3<= 3. digit <=7 -> change to 5 123.459 123.46 3. digit >=8 -> round up Implementation: MoneyRounding
  • 14. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Currency Conversion javax.money.convert
  • 15. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Adopters
  • 16. @YourTwitterHandle#DVXFR14{session hashtag} © 2012-2019 JavaMoney project and others. All rights reserved.#DWX #JavaMoney @jsr354 Action @wernerkeil
  • 17. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Roadmap • Embracing Java 8 features • Further support of JSR 310 (Date & Time) types • Type Annotations (if appropriate) • Use of Lambdas where appropriate • Alignment with Java 9+ features • Modular environment - While the API should be backward-compatible with at least Java SE 8, both API and RI expose Java 9 modules • Multi-release JAR files - This should allow a single API and RI to support Java 8, 9 and beyond. • Bean Validation Support • Valhalla Inline Types when available • See https://github.com/JavaMoney/jsr354-api/issues
  • 18. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil Links JavaMoney: http://javamoney.org JSR 354 Twitter Account: @jsr354 JSR detail page on JCP.org: https://www.jcp.org/en/jsr/detail?id=354 JavaMoney on GitHub: https://github.com/JavaMoney JavaMoney on Groups.io: https://javamoney.groups.io
  • 19. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil @thodorisbais@wernerkeil We’re running for an Associate Seat!
  • 20. © 2012-2019 JavaMoney project and others. All rights reserved.#Devoxx #JavaMoney @jsr354 @wernerkeil @wernerkeil