yparkhi / unitsofmeasure

Automatically exported from code.google.com/p/unitsofmeasure
0 stars 0 forks source link

Add method getSystemsOfUnits to SystemOfUnitsService #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The SystemOfUnitsService has a default method and a method to get a single 
system by name, but it should be able to return a collection of ALL known unit 
systems.

A getSystemsOfUnits() method (at least Collection, or could be a Set)
method to be added to SystemOfUnitsService.

Optionally the getSystemOfUnits() method could be renamed to 
getDefaultSystemOfUnits(), if desired.

Original issue reported on code.google.com by werner.k...@gmail.com on 1 Jan 2013 at 7:35

GoogleCodeExporter commented 9 years ago
I suggest getSystemOfUnitNames() returning a Set<String>. The reason for 
returning only the names instead than fully instantiated SystemOfUnits is that 
the later could be (in some implementations) costly objects. Someone who really 
want all SystemOfUnits can iterate over the names and invoke 
getSystemOfUnits(String), but I think that many users will apply some filtering 
based on the names.

If we add this method in SystemOfUnitsService, we should do something similar 
in UnitFormatServices.

Original comment by martdesr...@gmail.com on 8 Jan 2013 at 5:09

GoogleCodeExporter commented 9 years ago
That's a good starting point. It allows to loop the list of available
systems to be iterated and look up all one by one or based on some
preference only those an implementation wants.

While it's a little extra step, let's say there are several, and the
service wants just SI, I agree, instantiating all inside the getter for
that set could be costly.

Werner

-- 

 Werner Keil | JCP Executive Committee Member | Eclipse UOMo Lead, Babel
Language Champion | Java Godfather

 Twitter @wernerkeil | #Java_Social | #EclipseUOMo | #OpenDDR
Skype werner.keil | Google+ gplus.to/wernerkeil

* Eclipse DemoCamp: November 30 2012, Vienna, Austria. Werner Keil,  Eclipse
UOMo Lead and M�rsk Build Manager will present "Triple-E class Continuous
Delivery with Hudson, Maven, Kokki and PyDev"

Original comment by werner.k...@gmail.com on 8 Jan 2013 at 5:21

GoogleCodeExporter commented 9 years ago
Committed as of revision 225.

Original comment by martdesr...@gmail.com on 10 Jan 2013 at 4:38