|
Agent System POND 1.2 (28.2.2002) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--FIM.payment.Price
A class for representing a price by a currency object and a value. Also supports parsing both from a string.
Constructor Summary | |
Price(Currency curr,
double price)
Creates a new price object. |
|
Price(Element elem)
Creates a new price object from values stored in an XML Element. |
Method Summary | |
int |
compareTo(Object o)
Compares this price to another one. |
void |
decodeXMLElement(Element elem)
Parse back the price from an XML element. |
boolean |
equals(Object obj)
Compares two prices for equality. |
Serializable |
getAsSerializable()
Retrieve the price as a serializable (just returns this as this object is directly serializable). |
Element |
getAsXMLElement(Document doc)
Retrieve the price as an XML element. |
Currency |
getCurrency()
Retrieve the currency of this price. |
double |
getPrice()
Retrieve the value of this price. |
double |
getStandardPrice()
Retrieve the value of this price in Euro. |
String |
toString()
Retrieve a string representation of this price. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public Price(Currency curr, double price)
curr
- the currencyprice
- the valueIllegalArgumentException
- if the currency is null
or the price is < 0.0public Price(Element elem)
elem
- the XML element to parse the values fromIllegalArgumentException
- if the price could not be parsed back completelyMethod Detail |
public Currency getCurrency()
public double getPrice()
public double getStandardPrice()
IllegalStateException
- if no exchange value is presentpublic String toString()
toString
in interface XMLEncodeable
toString
in class Object
public boolean equals(Object obj)
equals
in class Object
obj
- the object to compare to this onetrue
if the currency and the value is the samepublic int compareTo(Object o)
ClassCastException
is thrown.compareTo
in interface Comparable
o
- the object to compare to this oneClassCastException
- if the other object is not a priceClassCastException
- if the other object has a different currency and one of the
currencies cannot be converted to Eurospublic Serializable getAsSerializable()
this
as this object is directly serializable).getAsSerializable
in interface XMLEncodeable
public Element getAsXMLElement(Document doc)
getAsXMLElement
in interface XMLEncodeable
doc
- the document within which to create the elementpublic void decodeXMLElement(Element elem) throws IllegalArgumentException
decodeXMLElement
in interface XMLEncodeable
elem
- the element containing the price to parse backIllegalArgumentException
- if the element is incorrect (e. g. wrong tag name)
|
Agent System POND 1.2 (28.2.2002) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |