Skip to content

NLxAROSA/uom-sb-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Units of measure (JSR-385) Spring Boot demo

This is a small demo to demonstrate unit and prefix conversion using the RI of JSR-385 in a Spring Boot application.

Usage (using HTTPie)

http POST http://localhost:7070/conversion value=80 prefix=KILO unit=g targetPrefix=MILLI targetUnit=g

value is the value to convert

prefix and targetPrefix are valid String representation values from javax.measure.MetricPrefix

unit and targetUnit are valid String representation values from tech.units.indriya.unit.Units

Source and target units/prefixes should be compatible (e.g. can't convert from grams to meters) or it will result in a bad request.

The response will look similar to the output below:

{
    "input": {
        "prefix": "KILO",
        "targetPrefix": "MILLI",
        "targetUnit": "g",
        "unit": "g",
        "value": 80
    },
    "targetValue": 80000000.0
}

About

Spring Boot Demo for Units Of Measurement (JSR-385)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages