Skip to main content

Re: Question: javax.measure.quantity in API

  • From: Martin Desruisseaux < >
  • To:
  • Subject: Re: Question: javax.measure.quantity in API
  • Date: Thu, 14 Aug 2014 13:00:11 +0200
  • Organization: Geomatys

Hello Otávio

Le 13/08/14 12:33, Otávio Gonçalves de Santana a écrit :
> In API I see some classes that are specialized of Quantity.
> Do these classes should not go to impl?
> I believe the API, should contain the behavior of Quantity and measure
> Unit and not the specializations, isn't?

The quantity sub-interfaces are used for compile-time type-safety in two
places:

  * When used directly (e.g. a getWaterTemperature() method returning a
    Temperature instance);
  * When used for parameterization of Unit<? extends Quantity>.

If we want to make possible the use of Unit instances from different
libraries (implementations), then the fact that Quantity is part of Unit
declaration forces us to standardize at least the most important
Quantity sub-types. If we don't do that, only Unit<?> in method
signature would be implementation-neutral. Any declaration like
Unit<Temperature> would be implementation-specific.

This raise the question about which criterion to use for deciding which
Quantity sub-types to include. I will post a separated email on this topic.

    Martin



Question: javax.measure.quantity in API

Otávio Gonçalves de Santana 08/13/2014

Re: Question: javax.measure.quantity in API

Werner Keil 08/13/2014

Re: Question: javax.measure.quantity in API

Martin Desruisseaux 08/14/2014

Re: Question: javax.measure.quantity in API

Werner Keil 08/14/2014
 
 
Close
loading
Please Confirm
Close