anon.pay.xml
Class XMLPaymentOptions
java.lang.Object
anon.pay.xml.XMLPaymentOptions
- All Implemented Interfaces:
- IXMLEncodable
public class XMLPaymentOptions
- extends java.lang.Object
- implements IXMLEncodable
This class represents a XMLPaymentOptions structure.
- Author:
- Tobias Bayer, Elmar Schraml
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_currencies
private java.util.Vector m_currencies
m_paymentOptions
private java.util.Vector m_paymentOptions
m_acceptedCreditCards
private java.lang.String m_acceptedCreditCards
m_sortingLanguage
private java.lang.String m_sortingLanguage
XMLPaymentOptions
public XMLPaymentOptions(java.lang.String xml)
throws java.lang.Exception
- Throws:
java.lang.Exception
XMLPaymentOptions
public XMLPaymentOptions()
XMLPaymentOptions
public XMLPaymentOptions(org.w3c.dom.Element xml)
throws java.lang.Exception
- Throws:
java.lang.Exception
XMLPaymentOptions
public XMLPaymentOptions(org.w3c.dom.Document document)
throws java.lang.Exception
- Throws:
java.lang.Exception
toXmlElement
public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
- Description copied from interface:
IXMLEncodable
- Return an element that can be appended to the document. This
Method must not change the document in any way!
- Specified by:
toXmlElement
in interface IXMLEncodable
- Parameters:
a_doc
- a document
- Returns:
- the interface as xml element
setValues
private void setValues(org.w3c.dom.Element elemRoot)
throws java.lang.Exception
- Throws:
java.lang.Exception
addOption
public void addOption(XMLPaymentOption a_option)
addCurrency
public void addCurrency(java.lang.String a_currency)
getOptionHeadings
public java.util.Enumeration getOptionHeadings(java.lang.String a_language)
getAllOptions
public java.util.Vector getAllOptions()
getAllOptionsSortedByRank
public java.util.Vector getAllOptionsSortedByRank(java.lang.String a_lang)
getOption
public XMLPaymentOption getOption(java.lang.String a_name)
getOption
public XMLPaymentOption getOption(java.lang.String a_heading,
java.lang.String a_language)
- Gets a XMLPaymentOption object for the provided heading
- Parameters:
a_heading
- Stringa_language
- String
- Returns:
- XMLPaymentOption
getCurrencies
public java.util.Vector getCurrencies()
setAcceptedCreditCards
public void setAcceptedCreditCards(java.lang.String a_acceptedCreditCards)
getAcceptedCreditCards
public java.lang.String getAcceptedCreditCards()
compare
public int compare(java.lang.Object object1,
java.lang.Object object2)
- --- not usable directly vie implementing Comparator due to Comparator being Java version 1.2+ only ---
used to compare 2 XMLPaymentOptions by rank
will return -1 (i.e. smaller than) if option1's rank is lower than option2's rank,
thereby placing option1 earlier in a sorted collection
Ranks come from the JPI's database table paymentoptionranks,
and can be set per language.
By default, the ranks for English will be returned; to sort by the ranks for another language,
setSortingLanguage(<2-letter-language code>) before using an XMLPaymentOptions object as a Comparator.
If ranks have not been set for both options in the given language, the comparison will again fall back to comparison by the english ranks.
- Parameters:
o1
- Object, @param o2 Object:
both have to be XMLPaymentOptions, otherwise a ClassCastException will be thrown
- Returns:
- int
setSortingLanguage
public void setSortingLanguage(java.lang.String a_lang)
sortVector
private void sortVector()
- replacement for calling Collections.sort() on the Vector
not the world's most efficient sort, but for a bunch of options it'll do