Package com.wesabe.api.accounts.presenters

Source Code of com.wesabe.api.accounts.presenters.MerchantReferencePresenter

package com.wesabe.api.accounts.presenters;

import com.wesabe.api.accounts.entities.Merchant;
import com.wesabe.xmlson.XmlsonObject;

/**
* A presenter for {@link Merchant} instances when only a reference, not a full
* representation, is needed.
*
* @author coda
*
*/
public class MerchantReferencePresenter {
  public XmlsonObject present(Merchant merchant) {
    final XmlsonObject root = new XmlsonObject("merchant");
    root.addProperty("name", merchant.getName());
    root.addProperty("id", merchant.getId());
    root.addProperty("uri", String.format("/transactions/merchant/%d", merchant.getId()));
    return root;
  }
}
TOP

Related Classes of com.wesabe.api.accounts.presenters.MerchantReferencePresenter

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.