Reputation: 1146
How can I define a custom unit called roll using JSR 363? How can I define it as a predefined quantity for length like one roll is always 250 meters? How can I define it as a totally separate base unit in case a roll doesn't have a fixed length?
I am using tec.uom:uom-se:1.0.2
. I tried to add a new unit like in JSR 363 adding new units but addUnit
method is private so it cannot be called from the extending class.
Upvotes: 2
Views: 183
Reputation: 3
If you look at the SI and UCUM packages, the Units class is extended, but private addUnit methods are reimplemented. The appropriate style may be to model your own localUnits class and add your own custom units to it. Not sure of the rationale behind addUnit other than all these classes are designed to be singletons, guidance from the reference implementers would be useful.
Upvotes: 0