this.value = value; this.currency = currency;
if (o instanceof MonetaryAmount) { // TODO: This would actually require some currency conversion magic return this.getValue().compareTo(((MonetaryAmount) o).getValue()); } return 0;
// TODO: This requires some conversion magic and is therefore broken return new MonetaryAmount(amount.getValue(), toConcurrency);
if (this == o) return true; if (!(o instanceof MonetaryAmount)) return false; final MonetaryAmount monetaryAmount = (MonetaryAmount) o; if (!currency.equals(monetaryAmount.currency)) return false; if (!value.equals(monetaryAmount.value)) return false; return true;
return new MonetaryAmount(new BigDecimal(amount), Currency.getInstance(currencyCode));
return currency;
return value;
int result; result = value.hashCode(); result = 29 * result + currency.hashCode(); return result;
return "Value: '" + getValue() + "', " + "Currency: '" + getCurrency() + "'";