@ SuppressWarnings ( "unchecked" ) @ Override public < T extends MonetaryAmount > MonetaryAmountFactory < T > getAmountFactory ( Class < T > amountType ) { if ( Geldbetrag . class . equals ( amountType ) ) { return ( MonetaryAmountFactory < T > ) new GeldbetragFactory ( ) ; } MonetaryAmountFactoryProviderSpi < T > f = MonetaryAmountFactoryProviderSpi . class . cast ( factories . get ( amountType ) ) ; if ( Objects . nonNull ( f ) ) { return f . createMonetaryAmountFactory ( ) ; } throw new MonetaryException ( "no MonetaryAmountFactory found for " + amountType ) ; }
save cast since members are managed by this instance