Package com.wesabe.xmlson

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


  private XmlsonObject present(Node node, Locale locale) {
    final XmlsonObject root = new XmlsonObject("node");
   
    final XmlsonObject tag = new XmlsonObject("tag");
    tag.addProperty("name", node.getTag().toString());
    root.add(tag);
   
    root.add(sumOfMoneyPresenter.present("sum", node.getSum(), locale));
   
    if (!node.getChildren().isEmpty()) {
View Full Code Here


    this.accountReferencePresenter = accountReferencePresenter;
  }

  public XmlsonObject present(AccountGroup group, Currency currency, Locale locale) {
    final XmlsonObject root = new XmlsonObject("group");
    root.addProperty("name", group.getName());
    // REVIEW coda@wesabe.com -- May 21, 2009: Replace account group URI building once AccountGroupResource is written
    root.addProperty("uri", String.format("/account-groups/%s", group.getId()));
   
    final XmlsonArray accounts = new XmlsonArray("accounts");
    boolean hasTotal = false;
View Full Code Here

  public XmlsonObject present(AccountGroup group, Currency currency, Locale locale) {
    final XmlsonObject root = new XmlsonObject("group");
    root.addProperty("name", group.getName());
    // REVIEW coda@wesabe.com -- May 21, 2009: Replace account group URI building once AccountGroupResource is written
    root.addProperty("uri", String.format("/account-groups/%s", group.getId()));
   
    final XmlsonArray accounts = new XmlsonArray("accounts");
    boolean hasTotal = false;
    for (Account account : group.getAccounts()) {
      accounts.add(accountReferencePresenter.present(account));
View Full Code Here

    this.investmentSecurityPresenter = investmentSecurityPresenter;
  }

  public XmlsonObject present(InvestmentTxaction investmentTxaction, Locale locale) {
    final XmlsonObject root = new XmlsonObject("investment-transaction");
    root.addProperty("id", investmentTxaction.getId());
    root.addProperty("uri", String.format("/investment-transactions/%d", investmentTxaction.getId()));
    root.add(accountPresenter.present(investmentTxaction.getAccount()));
    root.addProperty("trade-date", ISO_BASIC.print(investmentTxaction.getTradeDate()));
    root.addProperty("memo", investmentTxaction.getMemo());
    root.addProperty("units", investmentTxaction.getUnits());
View Full Code Here

  }

  public XmlsonObject present(InvestmentTxaction investmentTxaction, Locale locale) {
    final XmlsonObject root = new XmlsonObject("investment-transaction");
    root.addProperty("id", investmentTxaction.getId());
    root.addProperty("uri", String.format("/investment-transactions/%d", investmentTxaction.getId()));
    root.add(accountPresenter.present(investmentTxaction.getAccount()));
    root.addProperty("trade-date", ISO_BASIC.print(investmentTxaction.getTradeDate()));
    root.addProperty("memo", investmentTxaction.getMemo());
    root.addProperty("units", investmentTxaction.getUnits());
    root.add(moneyPresenter.present("unit-price", investmentTxaction.getUnitPrice(), locale));
View Full Code Here

  public XmlsonObject present(InvestmentTxaction investmentTxaction, Locale locale) {
    final XmlsonObject root = new XmlsonObject("investment-transaction");
    root.addProperty("id", investmentTxaction.getId());
    root.addProperty("uri", String.format("/investment-transactions/%d", investmentTxaction.getId()));
    root.add(accountPresenter.present(investmentTxaction.getAccount()));
    root.addProperty("trade-date", ISO_BASIC.print(investmentTxaction.getTradeDate()));
    root.addProperty("memo", investmentTxaction.getMemo());
    root.addProperty("units", investmentTxaction.getUnits());
    root.add(moneyPresenter.present("unit-price", investmentTxaction.getUnitPrice(), locale));
    Money total = investmentTxaction.getTotal();
    if (total != null) {
View Full Code Here

    final XmlsonObject root = new XmlsonObject("investment-transaction");
    root.addProperty("id", investmentTxaction.getId());
    root.addProperty("uri", String.format("/investment-transactions/%d", investmentTxaction.getId()));
    root.add(accountPresenter.present(investmentTxaction.getAccount()));
    root.addProperty("trade-date", ISO_BASIC.print(investmentTxaction.getTradeDate()));
    root.addProperty("memo", investmentTxaction.getMemo());
    root.addProperty("units", investmentTxaction.getUnits());
    root.add(moneyPresenter.present("unit-price", investmentTxaction.getUnitPrice(), locale));
    Money total = investmentTxaction.getTotal();
    if (total != null) {
      root.add(moneyPresenter.present("total", investmentTxaction.getTotal(), locale));
View Full Code Here

    root.addProperty("id", investmentTxaction.getId());
    root.addProperty("uri", String.format("/investment-transactions/%d", investmentTxaction.getId()));
    root.add(accountPresenter.present(investmentTxaction.getAccount()));
    root.addProperty("trade-date", ISO_BASIC.print(investmentTxaction.getTradeDate()));
    root.addProperty("memo", investmentTxaction.getMemo());
    root.addProperty("units", investmentTxaction.getUnits());
    root.add(moneyPresenter.present("unit-price", investmentTxaction.getUnitPrice(), locale));
    Money total = investmentTxaction.getTotal();
    if (total != null) {
      root.add(moneyPresenter.present("total", investmentTxaction.getTotal(), locale));
    } else {
View Full Code Here

   * @param locale the {@link Locale} for which the representation should be formatted
   * @return an {@link XmlsonObject}
   */
  public XmlsonObject present(String name, Money amount, Locale locale) {
    final XmlsonObject root = new XmlsonObject(name);
    root.addProperty(DISPLAY_KEY, amount.toString(locale));
    root.addProperty(VALUE_KEY, amount.toPlainString());
    return root;
  }
}
View Full Code Here

   * @return an {@link XmlsonObject}
   */
  public XmlsonObject present(String name, Money amount, Locale locale) {
    final XmlsonObject root = new XmlsonObject(name);
    root.addProperty(DISPLAY_KEY, amount.toString(locale));
    root.addProperty(VALUE_KEY, amount.toPlainString());
    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.