<html> <head> <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p>What would be the purpose to have <tt>Quanties</tt> to return <tt>QuantityFactory</tt>, since <tt>QuantityFactory</tt> should probably be obtained by whatever Service Provider mechanism the platform use (e.g. OSGi, or <tt>java.util.ServiceLoader</tt> on JavaSE)?</p> <p>As a side note, I have a quick look at the code. Why code like that:</p> <blockquote> <pre>if (Long.class.isInstance(value)) { return new LongQuantity<>(Long.class.cast(value), unit); } </pre> </blockquote> <p>instead of:<br> </p> <blockquote> <pre>if (value instanceof Long) { return new LongQuantity<>((Long) value, unit); }</pre> </blockquote> <p>The <tt>Class.isInstance</tt> and <tt>Class.cast</tt> methods are useful when the class is unknown at compile time. But in the above code they are not necessary.<br> </p> <p> Martin<br> </p> <p><br> </p> <br> <div class="moz-cite-prefix">Le 30/10/14 23:25, Werner Keil a écrit :<br> </div> <blockquote cite="mid: " type="cite"> <div dir="ltr"> <div>Hi,</div> <div><br> </div> <div>As Antoine just did some of those for CDI 2 on the Mailing list, let me also try the same here. The last doodle triggered so much discussion on the Mailing list, that the question probably could have been asked here in the first place, too<img style="margin: 0px 0.2ex; vertical-align: middle;" src="cid:part1.08050602.03080209@geomatys.fr" goomoji="329"></div> <div><br> </div> <div>Should <strong>Quantities </strong>(<a moz-do-not-send="true" href="https://github.com/unitsofmeasurement/unit-ri/blob/master/src/main/java/tec/units/ri/quantity/Quantities.java">https://github.com/unitsofmeasurement/unit-ri/blob/master/src/main/java/tec/units/ri/quantity/Quantities.java</a>) return </div> <div>1) a <strong>Quantity </strong>instance like it does now in both RI and SE port</div> <div> or</div> <div>2) a <strong>QuantityFactory</strong>? </div> <div> similar to what JSR 354 does with MonetaryAmounts:</div> <div> <a moz-do-not-send="true" href="https://github.com/JavaMoney/jsr354-api/blob/master/src/main/java/javax/money/MonetaryAmounts.java">https://github.com/JavaMoney/jsr354-api/blob/master/src/main/java/javax/money/MonetaryAmounts.java</a>)</div> <div><br> </div> <div>See <a moz-do-not-send="true" href="https://java.net/jira/browse/UNITSOFMEASUREMENT-65">https://java.net/jira/browse/UNITSOFMEASUREMENT-65</a> </div> <div>The outcome decides, whether we treat QuantityFactory as a core/mandatory part of the API (keeping it under "function" I think it's better than a slightly cluttered impression javax.money makes with 30 top level elements<img style="margin: 0px 0.2ex; vertical-align: middle;" src="cid:part5.07010001.04070101@geomatys.fr" goomoji="347">) or should move it to the optional SPI (which is optional especially because the entire service part is optional in MEEP, too, hence providing services on a device that has no use for it would be a waste)</div> <div><br> </div> <div>Iit is not directly related to <a moz-do-not-send="true" href="https://java.net/jira/browse/UNITSOFMEASUREMENT-67">https://java.net/jira/browse/UNITSOFMEASUREMENT-67</a> but both aim at static "convenience factory" methods.</div> <div><br> </div> <div>Making this simple, please try to reply like</div> <div>+1 for 1)</div> <div>or</div> <div>+1 for 2)</div> <div><br> </div> <div>not with a too lengthy discussion around it yet. It worked well for JSR 365, hope we can also get similar results here<img style="margin: 0px 0.2ex; vertical-align: middle;" src="cid:part1.08050602.03080209@geomatys.fr" goomoji="329"></div> <div><br> </div> <div>Thanks,</div> <div><br clear="all"> </div> <div> <div class="gmail_signature"> <div dir="ltr"><span style="font-family:arial,sans-serif"> <p style="margin:0px;font-size:13px;border-collapse:collapse"><span style="color:rgb(0,0,0);text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;white-space:normal;border-collapse:separate;font-size-adjust:none;font-stretch:normal"><span style="font-family:Helvetica"><span style="font-family:Calibri;font-size:12px"></span></span></span></p> <div><font face="Arial"><span style="font-family:arial,sans-serif"> <p style="margin:0px;font-size:13px;border-collapse:collapse"><span style="font-family:Calibri" lang="EN-US">Werner</span></p> </span> <p style="margin:0px;font-size:13px;border-collapse:collapse"><br> </p> </font> <p style="margin:0px;font-size:13px;border-collapse:collapse"><br> </p> </div> <p style="margin:0px;font-size:13px;border-collapse:collapse"><br> </p> </span><span lang="EN-GB"> <p style="margin:0px;font-size:13px;border-collapse:collapse"><br> </p> <div><br> </div> </span></div> </div> </div> </div> </blockquote> <br> </body> </html>
Attachment:
gif73RITLXXmz.gif
Description: GIF image
Attachment:
gif2qlCzFfYfP.gif
Description: GIF image