简体   繁体   中英

How do you write your own custom measurement converters

How do you write your own custom converters and specify the conversion factor using javax.measure packages. (eg Pint to gallons)

Well, I don't know the "correct" way to do it, but the obvious way would be to follow the pattern of the NonSI class ; ie create your own class containing statics for each unit, with values based on the standard definitions for the non-SI units in terms of SI units.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM