Package com.wesabe.xmlson

Examples of com.wesabe.xmlson.XmlsonObject.addProperty()


    final XmlsonObject result = new XmlsonObject("account");
    result.addProperty("name", account.getName());
    result.addProperty("position", account.getPosition());
    // REVIEW coda@wesabe.com -- May 21, 2009: Replace account URI building once AccountResource is written
    result.addProperty("uri", String.format("/accounts/%d", account.getRelativeId()));
    result.addProperty("type", account.getAccountType().toString());
    result.addProperty("currency", account.getCurrency().getCurrencyCode());
    result.addProperty("status", account.getStatus().toString().toLowerCase(Locale.US));
    if (account.hasBalance()) {
      final Money balance = account.getBalance();
      result.add(moneyPresenter.present("balance", balance, locale));
View Full Code Here


    result.addProperty("name", account.getName());
    result.addProperty("position", account.getPosition());
    // REVIEW coda@wesabe.com -- May 21, 2009: Replace account URI building once AccountResource is written
    result.addProperty("uri", String.format("/accounts/%d", account.getRelativeId()));
    result.addProperty("type", account.getAccountType().toString());
    result.addProperty("currency", account.getCurrency().getCurrencyCode());
    result.addProperty("status", account.getStatus().toString().toLowerCase(Locale.US));
    if (account.hasBalance()) {
      final Money balance = account.getBalance();
      result.add(moneyPresenter.present("balance", balance, locale));
      result.addProperty("last-balance-at", ISO_DATETIME.print(account.getLastActivityDate()));
View Full Code Here

    result.addProperty("position", account.getPosition());
    // REVIEW coda@wesabe.com -- May 21, 2009: Replace account URI building once AccountResource is written
    result.addProperty("uri", String.format("/accounts/%d", account.getRelativeId()));
    result.addProperty("type", account.getAccountType().toString());
    result.addProperty("currency", account.getCurrency().getCurrencyCode());
    result.addProperty("status", account.getStatus().toString().toLowerCase(Locale.US));
    if (account.hasBalance()) {
      final Money balance = account.getBalance();
      result.add(moneyPresenter.present("balance", balance, locale));
      result.addProperty("last-balance-at", ISO_DATETIME.print(account.getLastActivityDate()));
    }
View Full Code Here

    result.addProperty("currency", account.getCurrency().getCurrencyCode());
    result.addProperty("status", account.getStatus().toString().toLowerCase(Locale.US));
    if (account.hasBalance()) {
      final Money balance = account.getBalance();
      result.add(moneyPresenter.present("balance", balance, locale));
      result.addProperty("last-balance-at", ISO_DATETIME.print(account.getLastActivityDate()));
    }
    FinancialInst financialInst = account.getFinancialInst();
    if (financialInst != null) {
      result.add(financialInstPresenter.present(financialInst));
    }
View Full Code Here

   
    for (Map.Entry<Tag, MonetarySummary> summary : summaries.entrySet()) {
      final XmlsonObject item = new XmlsonObject("summary");
     
      final XmlsonObject tag = new XmlsonObject("tag");
      tag.addProperty("name", summary.getKey().toString());
      item.add(tag);
      item.add(sumOfMoneyPresenter.present("spending", summary.getValue().getSpending(), locale));
      item.add(sumOfMoneyPresenter.present("earnings", summary.getValue().getEarnings(), locale));
      item.add(sumOfMoneyPresenter.present("net", summary.getValue().getNet(), locale));
     
View Full Code Here

   
    for (Map.Entry<Interval, Money> summary : summaries.entrySet()) {
      final XmlsonObject item = new XmlsonObject("summary");
     
      final XmlsonObject interval = new XmlsonObject("interval");
      interval.addProperty("start", ISO_BASIC.print(summary.getKey().getStart()));
      interval.addProperty("end", ISO_BASIC.print(summary.getKey().getEnd()));
      item.add(interval);
      item.add(moneyPresenter.present("balance", summary.getValue(), locale));
     
      array.add(item);
View Full Code Here

    for (Map.Entry<Interval, Money> summary : summaries.entrySet()) {
      final XmlsonObject item = new XmlsonObject("summary");
     
      final XmlsonObject interval = new XmlsonObject("interval");
      interval.addProperty("start", ISO_BASIC.print(summary.getKey().getStart()));
      interval.addProperty("end", ISO_BASIC.print(summary.getKey().getEnd()));
      item.add(interval);
      item.add(moneyPresenter.present("balance", summary.getValue(), locale));
     
      array.add(item);
    }
View Full Code Here

    this.moneyPresenter = moneyPresenter;
  }
 
  public XmlsonObject present(TaggedAmount taggedAmount, Locale locale) {
    final XmlsonObject root = new XmlsonObject("tag");
    root.addProperty("name", taggedAmount.getTag().toString());
    root.addProperty("uri", String.format("/tags/%s", taggedAmount.getTag()));
    if (taggedAmount.isSplit()) {
      root.add(moneyPresenter.present("amount", taggedAmount.getAmount(), locale));
    }
    return root;
View Full Code Here

  }
 
  public XmlsonObject present(TaggedAmount taggedAmount, Locale locale) {
    final XmlsonObject root = new XmlsonObject("tag");
    root.addProperty("name", taggedAmount.getTag().toString());
    root.addProperty("uri", String.format("/tags/%s", taggedAmount.getTag()));
    if (taggedAmount.isSplit()) {
      root.add(moneyPresenter.present("amount", taggedAmount.getAmount(), locale));
    }
    return root;
  }
View Full Code Here

    if (position.getInvestmentSecurity() != null) {
      root.add(investmentSecurityPresenter.present(position.getInvestmentSecurity()));
    } else {
      root.addNullProperty("investment-security");
    }
    root.addProperty("units", position.getUnits());
    root.add(moneyPresenter.present("unit-price", position.getUnitPrice(), locale));
    root.add(moneyPresenter.present("market-value", position.getMarketValue(), locale));
    return root;
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.