author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Sat, 11 Oct 2008 23:38:46 +0200 | |
changeset 61 | 58ec6da75f6f |
parent 53 | task3/solution11/src/org/apidesign/apifest08/currency/ExchangeRateProvider.java@09d690bb97f6 |
child 66 | aa3f99f845ef |
permissions | -rw-r--r-- |
japod@53 | 1 |
package org.apidesign.apifest08.currency; |
japod@53 | 2 |
|
japod@53 | 3 |
/** |
japod@53 | 4 |
* Exchange rate provider. |
japod@53 | 5 |
* |
japod@53 | 6 |
* @author ked |
japod@53 | 7 |
* @see http://wiki.apidesign.org/wiki/APIDesignPatterns:ResponseReply |
japod@53 | 8 |
*/ |
japod@53 | 9 |
public interface ExchangeRateProvider<AmountType, IdentifierType> { |
japod@53 | 10 |
|
japod@53 | 11 |
public void getExchangeRate( |
japod@53 | 12 |
ExchangeRateRequest<AmountType, IdentifierType> request, |
japod@53 | 13 |
ExchangeRateResponse<AmountType, IdentifierType> response); |
japod@53 | 14 |
|
japod@53 | 15 |
public final class ExchangeRateRequest<AmountType, IdentifierType> { |
japod@53 | 16 |
|
japod@53 | 17 |
private IdentifierType currencyAIdentifier; |
japod@53 | 18 |
private IdentifierType currencyBIdentifier; |
japod@53 | 19 |
|
japod@53 | 20 |
ExchangeRateRequest() { |
japod@53 | 21 |
} |
japod@53 | 22 |
|
japod@53 | 23 |
public IdentifierType getCurrencyAIdentifier() { |
japod@53 | 24 |
return currencyAIdentifier; |
japod@53 | 25 |
} |
japod@53 | 26 |
|
japod@53 | 27 |
void setCurrencyAIdentifier(IdentifierType currencyAIdentifier) { |
japod@53 | 28 |
this.currencyAIdentifier = currencyAIdentifier; |
japod@53 | 29 |
} |
japod@53 | 30 |
|
japod@53 | 31 |
public IdentifierType getCurrencyBIdentifier() { |
japod@53 | 32 |
return currencyBIdentifier; |
japod@53 | 33 |
} |
japod@53 | 34 |
|
japod@53 | 35 |
void setCurrencyBIdentifier(IdentifierType currencyBIdentifier) { |
japod@53 | 36 |
this.currencyBIdentifier = currencyBIdentifier; |
japod@53 | 37 |
} |
japod@53 | 38 |
} |
japod@53 | 39 |
|
japod@53 | 40 |
public final class ExchangeRateResponse<AmountType, IdentifierType> { |
japod@53 | 41 |
|
japod@53 | 42 |
private ExchangeRateValue<AmountType, IdentifierType> exchangeRate; |
japod@53 | 43 |
|
japod@53 | 44 |
ExchangeRateResponse() { |
japod@53 | 45 |
} |
japod@53 | 46 |
|
japod@53 | 47 |
ExchangeRateValue<AmountType, IdentifierType> getExchangeRate() { |
japod@53 | 48 |
return exchangeRate; |
japod@53 | 49 |
} |
japod@53 | 50 |
|
japod@53 | 51 |
public void setExchangeRate(ExchangeRateValue<AmountType, IdentifierType> exchangeRate) { |
japod@53 | 52 |
this.exchangeRate = exchangeRate; |
japod@53 | 53 |
} |
japod@53 | 54 |
} |
japod@53 | 55 |
} |