japod@49: japod@49: package org.apidesign.apifest08.currency; japod@49: japod@49: public final class CurrencyRateImpl implements CurrencyRate { japod@49: private String currency1; japod@49: private String currency2; japod@49: private Rate rate; japod@49: japod@49: CurrencyRateImpl(final String currency1, final String currency2, final Rate rate) { japod@49: if ((currency1 == null)||(currency2 == null) || (rate == null)) { japod@49: throw new IllegalArgumentException("Argument cannot be null."); japod@49: } japod@49: if ("".equals(currency1) || "".equals(currency2)) { japod@49: throw new IllegalArgumentException("Name of currency cannot be empty string"); japod@49: } japod@49: if (currency1.equals(currency2)) { japod@49: throw new IllegalArgumentException("Currencies in rate cannot be the same"); japod@49: } japod@49: japod@49: this.currency1 = currency1; japod@49: this.currency2 = currency2; japod@49: this.rate = rate; japod@49: } japod@49: japod@49: public String getCurrency1() { japod@49: return currency1; japod@49: } japod@49: japod@49: public String getCurrency2() { japod@49: return currency2; japod@49: } japod@49: japod@49: public Rate getRate(){ japod@49: return rate; japod@49: } japod@49: japod@49: }