@Override public Number fromString(String string) { double value = 0; for (OrderItem orderItem : order.getOrderItems()) { value = value + (orderItem.getAmount().get() * orderItem.getPrice()); } value += order.getShippingCosts().get(); return value; }
@Override public String toString(Number object) { double value = 0; for (OrderItem orderItem : order.getOrderItems()) { value = value + (orderItem.getAmount().get() * orderItem.getPrice()); } value += order.getShippingCosts().get(); DecimalFormat df = new DecimalFormat("#.00"); return df.format(value) + " Euro"; }