diff -r 03c5c5dc94e7 -r 58ec6da75f6f task4/solution14/src/org/apidesign/apifest08/currency/CurrencyRateImpl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/task4/solution14/src/org/apidesign/apifest08/currency/CurrencyRateImpl.java Sat Oct 11 23:38:46 2008 +0200 @@ -0,0 +1,37 @@ + +package org.apidesign.apifest08.currency; + +public final class CurrencyRateImpl implements CurrencyRate { + private String currency1; + private String currency2; + private Rate rate; + + CurrencyRateImpl(final String currency1, final String currency2, final Rate rate) { + if ((currency1 == null)||(currency2 == null) || (rate == null)) { + throw new IllegalArgumentException("Argument cannot be null."); + } + if ("".equals(currency1) || "".equals(currency2)) { + throw new IllegalArgumentException("Name of currency cannot be empty string"); + } + if (currency1.equals(currency2)) { + throw new IllegalArgumentException("Currencies in rate cannot be the same"); + } + + this.currency1 = currency1; + this.currency2 = currency2; + this.rate = rate; + } + + public String getCurrency1() { + return currency1; + } + + public String getCurrency2() { + return currency2; + } + + public Rate getRate(){ + return rate; + } + +}