1.1 --- a/task1/solution02/src/org/apidesign/apifest08/currency/ConvertorFactory.java Sun Sep 28 14:12:38 2008 +0200
1.2 +++ b/task1/solution02/src/org/apidesign/apifest08/currency/ConvertorFactory.java Tue Sep 30 11:47:02 2008 +0200
1.3 @@ -1,46 +1,27 @@
1.4 package org.apidesign.apifest08.currency;
1.5
1.6 -import java.util.Currency;
1.7
1.8
1.9 /**
1.10 - * Creates default {@link Convertor} implementations.
1.11 + * Creates {@link Convertor} implementations.
1.12 * @author lukas
1.13 *
1.14 */
1.15 public class ConvertorFactory {
1.16 - private static final DefaultConvertorFactory DEFAULT_FACTORY = new DefaultConvertorFactory();
1.17 -
1.18 private ConvertorFactory()
1.19 {
1.20 //nothing
1.21 }
1.22
1.23 /**
1.24 - * Creates {@link Convertor} that converts from sourceCurrency to destinationCurrency with stored exchange rate.
1.25 - * @param sourceCurrency
1.26 - * @param destinationCurrency
1.27 - * @return
1.28 - * @throws UnsupportedConversionException when exchange rate between currencies is not known.
1.29 - */
1.30 - /*
1.31 - * Only one of the createConveror methods is needed. The assignment is not explicit where the exchange rate should be set.
1.32 - */
1.33 - public static final Convertor createConvertor(Currency sourceCurrency, Currency destinationCurrency) throws UnsupportedConversionException
1.34 - {
1.35 - return DEFAULT_FACTORY.getConvertor(sourceCurrency, destinationCurrency);
1.36 - }
1.37 - /**
1.38 * Creates {@link Convertor} that converts from sourceEquivalent.currency to destinationEquivalent.currency.
1.39 * Exchange rate is set as equivalents. It means if you want to create USD to CZK convertor where USD1 = CZK17
1.40 - * call createConvertor(new MoneyImpl(1, USD), new MoneyImpl(17, CZK)).
1.41 + * call createConvertor(new MoneyImpl(1, USD), new MoneyImpl(17, CZK)). Convertor created by this method
1.42 + * rounds the result to two decimal places.
1.43 * @param sourceEquivalent
1.44 * @param destinationEquivalent
1.45 * @return
1.46 */
1.47 - /*
1.48 - * Only one of the createConveror methods is needed. The assignment is not explicit where the exchange rate should be set.
1.49 - */
1.50 public static final Convertor createConvertor(Money sourceEquivalent, Money destinationEquivalent)
1.51 {
1.52 return new DefaultConvertor(sourceEquivalent.getAmount(), destinationEquivalent.getAmount(), sourceEquivalent.getCurrency(), destinationEquivalent.getCurrency());