japod@6: package org.apidesign.apifest08.currency; japod@6: japod@6: /** japod@6: * Interface declaring method for computing conversion. japod@6: * japod@6: * Because of a vague definition of currency amount's type, japod@6: * the interface has a generic type. japod@6: * japod@6: * @author ked japod@6: * @see http://wiki.apidesign.org/wiki/APIDesignPatterns:ResponseReply japod@6: */ japod@6: interface Computer { japod@6: japod@53: void compute(ComputerRequest request, ComputerResponse response); japod@6: japod@6: final class ComputerRequest { japod@6: japod@6: private AmountType input; japod@6: private AmountType inputCurrencyRatio; japod@6: private AmountType outputCurrencyRatio; japod@6: japod@6: AmountType getInput() { japod@6: return input; japod@6: } japod@6: japod@6: void setInput(AmountType input) { japod@6: this.input = input; japod@6: } japod@6: japod@6: AmountType getInputCurrencyRatio() { japod@6: return inputCurrencyRatio; japod@6: } japod@6: japod@6: void setInputCurrencyRatio(AmountType inputCurrencyRatio) { japod@6: this.inputCurrencyRatio = inputCurrencyRatio; japod@6: } japod@6: japod@6: AmountType getOutputCurrencyRatio() { japod@6: return outputCurrencyRatio; japod@6: } japod@6: japod@6: void setOutputCurrencyRatio(AmountType outputCurrencyRatio) { japod@6: this.outputCurrencyRatio = outputCurrencyRatio; japod@6: } japod@6: } japod@6: japod@6: final class ComputerResponse { japod@6: japod@6: private AmountType result; japod@6: japod@6: AmountType getResult() { japod@6: return result; japod@6: } japod@6: japod@6: void setResult(AmountType result) { japod@6: this.result = result; japod@6: } japod@6: } japod@6: japod@6: japod@6: }