public class DefaultMonetaryAmountsSpi
extends java.lang.Object
implements javax.money.spi.MonetaryAmountsSpi
MonetaryAmountsSpi
loading the SPIs on startup initially once, using the
JSR's Bootstrap
mechanism.Modifier and Type | Class and Description |
---|---|
static class |
DefaultMonetaryAmountsSpi.ProviderComparator
Comparator used for ordering the services provided.
|
Constructor and Description |
---|
DefaultMonetaryAmountsSpi() |
Modifier and Type | Method and Description |
---|---|
static <T> int |
comparePriority(T service1,
T service2)
Compare two service priorities given the same service interface.
|
<T extends javax.money.MonetaryAmount> |
getAmountFactory(java.lang.Class<T> amountType)
Access the
MonetaryAmountFactory for the given amountType . |
java.util.Set<java.lang.Class<? extends javax.money.MonetaryAmount>> |
getAmountTypes()
Get the currently registered
MonetaryAmount implementation types. |
java.lang.Class<? extends javax.money.MonetaryAmount> |
getDefaultAmountType()
Access the default
MonetaryAmount type. |
java.lang.Class<? extends javax.money.MonetaryAmount> |
queryAmountType(javax.money.MonetaryContext requiredContext)
(non-Javadoc)
|
public static <T> int comparePriority(T service1, T service2)
T
- the interface typeservice1
- first service, not null.service2
- second service, not null.public <T extends javax.money.MonetaryAmount> javax.money.MonetaryAmountFactory<T> getAmountFactory(java.lang.Class<T> amountType)
javax.money.spi.MonetaryAmountsSpi
MonetaryAmountFactory
for the given amountType
.getAmountFactory
in interface javax.money.spi.MonetaryAmountsSpi
amountType
- the MonetaryAmount
implementation type, targeted by the factory.MonetaryAmountFactory
, or null
, if no such
MonetaryAmountFactory
is available in the current context.public java.util.Set<java.lang.Class<? extends javax.money.MonetaryAmount>> getAmountTypes()
javax.money.spi.MonetaryAmountsSpi
MonetaryAmount
implementation types.getAmountTypes
in interface javax.money.spi.MonetaryAmountsSpi
Set
if registered MonetaryAmount
implementation types, never
null
.public java.lang.Class<? extends javax.money.MonetaryAmount> getDefaultAmountType()
javax.money.spi.MonetaryAmountsSpi
MonetaryAmount
type.getDefaultAmountType
in interface javax.money.spi.MonetaryAmountsSpi
MonetaryAmount
type corresponding, never null
.MonetaryAmounts.getDefaultAmountType()
public java.lang.Class<? extends javax.money.MonetaryAmount> queryAmountType(javax.money.MonetaryContext requiredContext)
queryAmountType
in interface javax.money.spi.MonetaryAmountsSpi
requiredContext
- the required MonetaryContext
MonetaryAmount
implementation class, that best matches to cover the given
MonetaryContext
, never null
.MonetaryAmountsSpi.queryAmountType(javax.money.MonetaryContext)