japod@23: japod@23: package org.apidesign.apifest08.currency; japod@23: japod@23: import java.math.BigDecimal; japod@23: japod@23: /** japod@23: * Result of currency conversion. Holds converted value and remainder. japod@23: *

japod@41: * Converted describes value converted to target currenty. Remainder describes japod@41: * how much from original amount was not possible to convert. Convertor never loses any (small) money japod@23: * in conversion error (rounding), but instead of rounding is converts only as much as possible and keeps rest as remainder. japod@23: * japod@23: * @author arnostvalicek japod@23: */ japod@23: public class ConversionResult { japod@23: private BigDecimal converted; japod@23: private BigDecimal remainder; japod@23: japod@23: /** japod@23: * Get converted value. japod@23: * @return Returns converted value. japod@23: */ japod@23: public BigDecimal getConverted() { japod@23: return converted; japod@23: } japod@23: japod@23: void setConverted(BigDecimal converted) { japod@23: this.converted = converted; japod@23: } japod@23: japod@23: japod@23: /** japod@23: * Get remainder of conversion. Remainder is set if part of converted amount which can't be converted japod@23: * because this target currency precision can't handle small numbers. Remainder value is in from currency japod@23: *

japod@23: * Converter never loses any precision in conversion. Remainer describes how much of amount can't be converted. japod@23: * If we substract remainder from amount we will be able to get exact conversion. japod@23: * japod@23: * @return Returns remainder of conversion. japod@23: */ japod@23: public BigDecimal getRemainder() { japod@23: return remainder; japod@23: } japod@23: japod@23: void setRemainder(BigDecimal remainder) { japod@23: this.remainder = remainder; japod@23: } japod@23: japod@23: }