SlideShare uma empresa Scribd logo
1 de 20
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

Mais conteúdo relacionado

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

Social Currencies and Crowdfunding
Social Currencies and CrowdfundingSocial Currencies and Crowdfunding
Social Currencies and CrowdfundingWerner Keil
 
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 2022Moon Technolabs Pvt. Ltd.
 
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 #LearnInboundAleyda 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 EthereumMichael John Peña
 
Cryptosherlock oneledger research
Cryptosherlock oneledger researchCryptosherlock oneledger research
Cryptosherlock oneledger researchstsoien
 
JFall 2016: Oracle JET Session
JFall 2016: Oracle JET SessionJFall 2016: Oracle JET Session
JFall 2016: Oracle JET SessionGeertjan 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 moneyBlockchain Council
 
Ebbcash presentation #1
Ebbcash presentation #1Ebbcash presentation #1
Ebbcash presentation #1YobitKue
 
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 JavaWerner 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 ZoneJames 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 AppThe NineHertz
 

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

Social Currencies and Crowdfunding
Social Currencies and CrowdfundingSocial Currencies and Crowdfunding
Social Currencies and Crowdfunding
 
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
 

Mais de 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 '21Werner Keil
 
OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021OpenDDR and Jakarta MVC - JavaLand 2021
OpenDDR and Jakarta MVC - JavaLand 2021Werner 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 2021Werner 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 VirtualWerner Keil
 
NoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualNoSQL Endgame - Java2Days 2020 Virtual
NoSQL Endgame - Java2Days 2020 VirtualWerner 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 OpenDDRWerner 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 2020Werner 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 DayWerner 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 DatabasesWerner 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 DatabasesWerner 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 MunichWerner 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 2017Werner 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 2017Werner Keil
 
Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363Eclipse Science F2F 2016 - JSR 363
Eclipse Science F2F 2016 - JSR 363Werner 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 CloudWerner Keil
 
Apache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ StuttgartApache DeviceMap - Web-Dev-BBQ Stuttgart
Apache DeviceMap - Web-Dev-BBQ StuttgartWerner 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-BrandenburgWerner 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 OverviewWerner 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 AgoravaWerner Keil
 

Mais de 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
 

Último

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 

Último (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

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