class CurrencyAmount implements ImmutableBean, Serializable {

  @FromString
  public static CurrencyAmount parse(final String amountStr) {
    ArgumentChecker.notNull(amountStr, "amountStr");
    String[] parts = StringUtils.split(amountStr, ' ');
    if (parts.length != 2) {
      throw new IllegalArgumentException("Unable to parse amount, invalid format: " + amountStr);
    }
    try {
      Currency cur = Currency.parse(parts[0]);
      double amount = Double.parseDouble(parts[1]);
      return new CurrencyAmount(cur, amount);
    } catch (RuntimeException ex) {
      throw new IllegalArgumentException("Unable to parse amount: " + amountStr, ex);
    }
  }

  @ImmutableConstructor private  CurrencyAmount(final Currency currency, final double amount);

}