SlideShare a Scribd company logo
1 of 33
Download to read offline
RESTMODEL,

A HASHMAP ON STEROIDS
SIMPLIFY REST INPUT IN JAVA WITH
open source powered by
http://www.aiqudo.com/
voice to action
https://github.com/bxfsh
JSON TO JAVA
THE PROBLEM
THE PROBLEM: “JSON” TO “JAVA"
TWO VERY DIFFERENT WORLDS
THE PROBLEM: “JSON” TO “JAVA"
SOLUTION 1: SPRING (REST + JPA) 101
THE PROBLEM: “JSON” TO “JAVA"
SOLUTION 1: SPRING (REST + JPA) 101
THE PROBLEM: “JSON” TO “JAVA"
SOLUTION 1: SPRING (REST + JPA) 101
THE PROBLEM: “JSON” TO “JAVA"
SOLUTION 1: SPRING (REST + JPA) 101
HOW HOMAKOV HACKED GITHUB AND THE LINE OF CODE THAT COULD HAVE PREVENTED IT
HTTPS://GIST.GITHUB.COM/PETERNIXEY/1978249
THE PROBLEM: “JSON” TO “JAVA"
SOLUTION 1: SPRING (REST + JPA) 101
WE NEED TO SANITISE THE DATA
BEFORE WE SAVE IT!
ALTERNATIVES
MAPPING SON TO JAVA
THE PROBLEM: “JSON” TO “JAVA"
SOLUTION 1: MAP<STRING, OBJECT>
THE PROBLEM: “JSON” TO “JAVA"
SOLUTION 1: MAP<STRING, OBJECT>
THE PROBLEM: “JSON” TO “JAVA"
SOLUTION 2: AUTO MAPPER
THE PROBLEM: “JSON” TO “JAVA"
SOLUTION 2: AUTO MAPPER
REST MODEL
MAPPING SON TO JAVA
THE PROBLEM: “JSON” TO “JAVA"
THE REST MODEL
THE PROBLEM: “JSON” TO “JAVA"
THE REST MODEL
Good JSON-Serialisable error object
Chained instruction for setup
Cast-free conversions
THE PROBLEM: “JSON” TO “JAVA"
THE REST MODEL permit(key) + baseline(key)
THE PROBLEM: “JSON” TO “JAVA"
THE REST MODEL permit(key) + baseline(key)
Defaults “name" to "defaultName"
Uses whatever provided in the request body,

and uses the baseline if nothing was provided
THE PROBLEM: “JSON” TO “JAVA"
THE REST MODEL permit(key) + has(key)
THE PROBLEM: “JSON” TO “JAVA"
THE REST MODEL permit(key) + has(key)
has(key) checks against “blank”, not just null or empty
THE PROBLEM: “JSON” TO “JAVA"
THE REST MODEL permitAll()
THE PROBLEM: “JSON” TO “JAVA"
THE REST MODEL permitAll()
do no filter information, if you don’t want
THE PROBLEM: “JSON” TO “JAVA"
THE REST MODEL nested validation
THE PROBLEM: “JSON” TO “JAVA"
THE REST MODEL nested validation
Validation can be performed equally in child objects
THE PROBLEM: “JSON” TO “JAVA"
THE REST MODEL easy cast to many types and lists
THE PROBLEM: “JSON” TO “JAVA"
THE REST MODEL easy cast to many types and lists
Loads can be done with it.
RestModel
FEATURES & ADVANTAGES
▸ JSON keys normalisation (both
camelCase and snake_case
work)
▸ Simple linguistics to scrutinise
and validate input
▸ Also works with Lists and
Nested objects in the same way
▸ When validation errors are
found, provides good JSON
Serialisable Errors object
▸ It’s dependency free!
▸ Cast-free conversion of values
to (almost) all basic types.
▸ Fluent API for chained
instructions
▸ Used in production for 1 year,
1.4 released recently
RestModel
WANT TO HELP?
▸ It’s currently not possible to
extend the converters. We have it
to (almost all) basic types, but
registering your own ain’t possible
▸ Desired, but no way to
simply .bindTo(Entity.class) using
the require/permit rule
HTTPS://GITHUB.COM/BXFSH/BOXFISH-COMMONS-WEB-MODEL
RestModel
WANT TO HELP?
▸ It’s currently not possible to
extend the converters. We have it
to (almost all) basic types, but
registering your own ain’t possible
▸ Desired, but no way to
simply .bindTo(Entity.class) using
the require/permit rule
HTTPS://GITHUB.COM/BXFSH/BOXFISH-COMMONS-WEB-MODEL
MAY SOON BE RENAMED TO AIQUDO
TIME FOR Q&A
// HUDSON MENDES
github.com/hudsonmendes
twitter.com/hudsonmendes
medium.com/@hudsonmendes
linkedin.com/in/hudsonmendes
THANKS!
// HUDSON MENDES
BelfastJUG, Lighting Talk, RestModel, a HashMap on Steroids for JSON parsing

More Related Content

Similar to BelfastJUG, Lighting Talk, RestModel, a HashMap on Steroids for JSON parsing

Where Node.JS Meets iOS
Where Node.JS Meets iOSWhere Node.JS Meets iOS
Where Node.JS Meets iOSSam Rijs
 
JavaScript No longer A “toy” Language
JavaScript No longer A “toy” LanguageJavaScript No longer A “toy” Language
JavaScript No longer A “toy” LanguageKMS Technology
 
Not your father's tests
Not your father's testsNot your father's tests
Not your father's testsSean P. Floyd
 
Java JSON Parser Comparison
Java JSON Parser ComparisonJava JSON Parser Comparison
Java JSON Parser ComparisonAllan Huang
 
JSPP: Morphing C++ into Javascript
JSPP: Morphing C++ into JavascriptJSPP: Morphing C++ into Javascript
JSPP: Morphing C++ into JavascriptChristopher Chedeau
 
Isomorphic App Development with Ruby and Volt - Rubyconf2014
Isomorphic App Development with Ruby and Volt - Rubyconf2014Isomorphic App Development with Ruby and Volt - Rubyconf2014
Isomorphic App Development with Ruby and Volt - Rubyconf2014ryanstout
 
WebSocket JSON Hackday
WebSocket JSON HackdayWebSocket JSON Hackday
WebSocket JSON HackdaySomay Nakhal
 
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...QAFest
 
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...Future Processing
 
Differential Sync and JSON Patch @ SpringOne2GX 2014
Differential Sync and JSON Patch @ SpringOne2GX 2014Differential Sync and JSON Patch @ SpringOne2GX 2014
Differential Sync and JSON Patch @ SpringOne2GX 2014Brian Cavalier
 
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
 ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in... ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...Saurabh Nanda
 
JSON Fuzzing: New approach to old problems
JSON Fuzzing: New  approach to old problemsJSON Fuzzing: New  approach to old problems
JSON Fuzzing: New approach to old problemstitanlambda
 

Similar to BelfastJUG, Lighting Talk, RestModel, a HashMap on Steroids for JSON parsing (20)

Where Node.JS Meets iOS
Where Node.JS Meets iOSWhere Node.JS Meets iOS
Where Node.JS Meets iOS
 
JavaScript No longer A “toy” Language
JavaScript No longer A “toy” LanguageJavaScript No longer A “toy” Language
JavaScript No longer A “toy” Language
 
Not only SQL
Not only SQL Not only SQL
Not only SQL
 
Not your father's tests
Not your father's testsNot your father's tests
Not your father's tests
 
slides-students-C03.pdf
slides-students-C03.pdfslides-students-C03.pdf
slides-students-C03.pdf
 
scala-intro
scala-introscala-intro
scala-intro
 
Play framework
Play frameworkPlay framework
Play framework
 
Java JSON Parser Comparison
Java JSON Parser ComparisonJava JSON Parser Comparison
Java JSON Parser Comparison
 
JSPP: Morphing C++ into Javascript
JSPP: Morphing C++ into JavascriptJSPP: Morphing C++ into Javascript
JSPP: Morphing C++ into Javascript
 
J
JJ
J
 
Isomorphic App Development with Ruby and Volt - Rubyconf2014
Isomorphic App Development with Ruby and Volt - Rubyconf2014Isomorphic App Development with Ruby and Volt - Rubyconf2014
Isomorphic App Development with Ruby and Volt - Rubyconf2014
 
WebSocket JSON Hackday
WebSocket JSON HackdayWebSocket JSON Hackday
WebSocket JSON Hackday
 
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
QA Fest 2018. Adam Stasiak. React Native is Coming – the story of hybrid mobi...
 
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
 
How can your applications benefit from Java 9?
How can your applications benefit from Java 9?How can your applications benefit from Java 9?
How can your applications benefit from Java 9?
 
Os Pruett
Os PruettOs Pruett
Os Pruett
 
Differential Sync and JSON Patch @ SpringOne2GX 2014
Differential Sync and JSON Patch @ SpringOne2GX 2014Differential Sync and JSON Patch @ SpringOne2GX 2014
Differential Sync and JSON Patch @ SpringOne2GX 2014
 
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
 ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in... ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
 
JSON Injection
JSON InjectionJSON Injection
JSON Injection
 
JSON Fuzzing: New approach to old problems
JSON Fuzzing: New  approach to old problemsJSON Fuzzing: New  approach to old problems
JSON Fuzzing: New approach to old problems
 

Recently uploaded

Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 

Recently uploaded (20)

Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 

BelfastJUG, Lighting Talk, RestModel, a HashMap on Steroids for JSON parsing