1 4 5 package com.sun.j2ee.blueprints.docoriented.client; 6 7 import org.w3c.dom.*; 8 9 public class LineItem { 10 11 private String itemId; 12 private int quantity; 13 private float price; 14 15 public LineItem() {} 16 17 public LineItem(String itemId, 18 int quantity, float price) { 19 this.itemId = itemId; 20 this.quantity = quantity; 21 this.price = price; 22 } 23 24 public String getItemId() { 25 return this.itemId; 26 } 27 28 public int getQuantity() { 29 return this.quantity; 30 } 31 32 public float getPrice() { 33 return this.price; 34 } 35 36 public void setItemId(String itemId) { 37 this.itemId = itemId; 38 return; 39 } 40 41 public void setQuantity(int quantity) { 42 this.quantity = quantity; 43 return; 44 } 45 46 public void setPrice(float price) { 47 this.price = price; 48 return; 49 } 50 51 public Node toDOM(Document doc) { 52 Element liElem = doc.createElement("items"); 53 Element elem = doc.createElement("itemId"); 54 elem.appendChild(doc.createTextNode(itemId)); 55 liElem.appendChild(elem); 56 elem = doc.createElement("price"); 57 elem.appendChild(doc.createTextNode(String.valueOf(price))); 58 liElem.appendChild(elem); 59 elem = doc.createElement("quantity"); 60 elem.appendChild(doc.createTextNode(String.valueOf(quantity))); 61 liElem.appendChild(elem); 62 return liElem; 63 } 64 } 65 66 | Popular Tags |