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