2 package org.apidesign.apifest08.currency;
4 public final class CurrencyRateImpl implements CurrencyRate {
5 private String currency1;
6 private String currency2;
9 CurrencyRateImpl(final String currency1, final String currency2, final Rate rate) {
10 if ((currency1 == null)||(currency2 == null) || (rate == null)) {
11 throw new IllegalArgumentException("Argument cannot be null.");
13 if ("".equals(currency1) || "".equals(currency2)) {
14 throw new IllegalArgumentException("Name of currency cannot be empty string");
16 if (currency1.equals(currency2)) {
17 throw new IllegalArgumentException("Currencies in rate cannot be the same");
20 this.currency1 = currency1;
21 this.currency2 = currency2;
25 public String getCurrency1() {
29 public String getCurrency2() {
33 public Rate getRate(){