Open reeg33 opened 3 weeks ago
Note: there is at least two implementations available. The RI is one of them. Seshat is another. They may provide different set of pre-defined units. In both case (I think in RI too), new units can be created by starting with existing units, then invoke methods such as multiply
or divide
. The Seshat page gives an example. The result may not have the desired label, but parsing and formatting with custom labels can be done by creating a UnitFormat
and invoking the label(Unit, String)
method on it.
I feel that framework is too complicated for me unfortunately, i feel lost among all different libraries (api, implementations, demo, doc...). That is a shame because it seems it would fit perfectly for my app where I need to have my custom derivated units and go from Imperial to SI to custom prefered units system, but unfortunately I can't figure out what I actually need to code from what sources.
If anyone has a real full example of a use of that framework, feel free to give me a link so I can have a look.
@desruisseaux do you mind if I get in your DM, in french if possible ? maybe it'll be easier for me to explain my problem ^^ Cheers Renaud
Hello Renaud. No problem.
@reeg33 Please see the repository uom-demos. It includes various modules such as Console Demos, Desktop Demos, Device Specific Demos, and Web Demos, among others.
There is some point that Seshat may be a bit more compact, but the RI was created to be modular and (in the "core" profile) ultra-compact, fitting eve into the once existing Java ME Embedded devices. While Java ME Embedded may not exist anymore, it allows Edge Devices with sensors to run on a very small profile with little dependencies and add more where unit conversion and visual representation is necessary.
Thank you all for your answers. I think that I was too optimistic with the use of that framework. Those demos are quite useful, unfortunately i couldnt find what i'm looking for. If there's a public project out there using uom, i'm curious to have look. As a background context, on my side, for an engeneering app (heat exchangers) I basically need to :
Let's hope that I'll find nice examples out there soon that can get me where I want to go (feel free to share some links :) ) Cheers,
Hello,
i'm not convinced that's the correct place to post, but maybe someone can redirect me if that's the case.
I need to implement in my code a system that allows unit conversions. Until now, seems the correct place. But, I don't really know how to begin with. I read JSR 385 Specification, i added uom-api to maven, but I found it was only "core code" and I needed to add implemented version. Then I found this RI, but still I have some units that are not present in "Unit.class". How do I code them ? Duplicate all project and modify ? seems I can't extend most of them indroya files (and when I can, methods are private so I can't really go further) Things like
public static final Unit<ThermalConductivity> BTU_PER_HOUR_FAHRENHEIT_FOOT = addUnit(new ProductUnit<>(BTU_PER_HOUR_FAHRENHEIT.divide(FOOT)).asType(ThermalConductivity.class)); public static final Unit<MolarMass> GRAMME_PAR_MOL = addUnit(new ProductUnit<>(GRAM.divide(MOLE)).asType(MolarMass.class));
Is there a "getting started" or "how do i implement my own units" documentation somewhere ? Do I need some more libraries to do the job ?
Sorry if it's a lot of questions, but I find this lib very close to what I want, but seems I dont know how to make it work for me :(