Use Advanced Search to search the entire archive.
[jsr363-experts] PI
- From: Martin Desruisseaux <
>
- To:
- Subject: [jsr363-experts] PI
- Date: Sun, 14 Dec 2014 20:43:30 +0900
- Organization: Geomatys
Le 14/12/14 19:59, Werner Keil a écrit :
>
Other implementations may use say a NoSQL db, etc. So keeping the
>
abstract base class in implementations is reasonable, but pulling just
>
one implementing class out of that hierarchy sounds comtradicting.
But nobody is proposing that...
>
IMHO if SI went into API (so we find a way to solve all the RI
>
dependencies in it;-) so should AbstractSystemOfUnits.
>
No, they would be no dependency and no need for AbstractSystemUnit. Just
use ServiceLoader and current Unit public API, nothing else. No need for
direct dependency to anything from the RI. Example:
public final class SI {
public static final Unit<Length> METRE;
public static final Unit<Time> SECOND;
static {
SystemOfUnits sys = null;
for (SystemOfUnitsProvider p :
ServiceLoader.load(SystemOfUnitsProvider.class)) {
sys = p.getSystemOfUnits();
// TODO: what to do if we find more than one provider on the
classpath?
}
// TODO: what to do if we find no provider on the classpath?
METRE = sys.getUnit(Length.class);
SECOND = sys.getUnit(Time.class);
// etc.
}
}
Martin