Agent System POND 1.2 (28.2.2002)

FIM.payment
Class InvoiceItem

java.lang.Object
  |
  +--FIM.payment.InvoiceItem
All Implemented Interfaces:
Serializable, XMLEncodeable

public class InvoiceItem
extends Object
implements XMLEncodeable, Serializable

Helper class: Models a line in an invoice. Just contains a text and the price for this item.

Version:
1.0
Author:
Michael Sonntag
See Also:
Serialized Form

Constructor Summary
InvoiceItem(Element elem)
          Creates a new invoice item object from values stored in an XML Element.
InvoiceItem(String item, Price price)
          Creates a new line for an invoice.
 
Method Summary
 void decodeXMLElement(Element elem)
          Parse back the item from an XML element.
 Serializable getAsSerializable()
          Retrieve the item as a serializable (just returns this as this object is directly serializable).
 Element getAsXMLElement(Document doc)
          Retrieve the item as an XML element.
 String getItemName()
          Retrieve the name of this item.
 Price getPrice()
          Retrieve the price of this item.
 String toString()
          Returns a strign representation for an invoice item.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InvoiceItem

public InvoiceItem(String item,
                   Price price)
Creates a new line for an invoice.
Parameters:
item - the name for the item
price - the price for this item

InvoiceItem

public InvoiceItem(Element elem)
Creates a new invoice item object from values stored in an XML Element.
Parameters:
elem - the XML element to parse the values from
Throws:
IllegalArgumentException - if the price could not be parsed back completely
Method Detail

getItemName

public String getItemName()
Retrieve the name of this item.
Returns:
the name

getPrice

public Price getPrice()
Retrieve the price of this item.
Returns:
the price

getAsSerializable

public Serializable getAsSerializable()
Retrieve the item as a serializable (just returns this as this object is directly serializable).
Specified by:
getAsSerializable in interface XMLEncodeable
Returns:
the price object as a serializable

getAsXMLElement

public Element getAsXMLElement(Document doc)
Retrieve the item as an XML element.
Specified by:
getAsXMLElement in interface XMLEncodeable
Parameters:
doc - the document within which to create the element
Returns:
the price as an element

decodeXMLElement

public void decodeXMLElement(Element elem)
                      throws IllegalArgumentException
Parse back the item from an XML element.
Specified by:
decodeXMLElement in interface XMLEncodeable
Parameters:
elem - the element containing the price to parse back
Throws:
IllegalArgumentException - if the element is incorrect (e. g. wrong tag name)

toString

public String toString()
Returns a strign representation for an invoice item. Contains the name and the price.
Specified by:
toString in interface XMLEncodeable
Overrides:
toString in class Object
Returns:
string representation

Agent System POND 1.2 (28.2.2002)

Submit a bug

Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.