Class FinPersist
Abstract base class that provides common methods for all persistent objects in the FinTS Subsembly.
public abstract class FinPersist
- Inheritance
-
FinPersist
- Derived
- Inherited Members
Remarks
Classes derived from FinPersist must override WriteXml(XmlWriter) and ReadXml(XmlReader) in order to provide XML persistence.
Constructors
FinPersist()
protected FinPersist()
FinPersist(string)
protected FinPersist(string sXmlRootTag)
Parameters
sXmlRootTag
stringThe default root tag that is used when persisting this object in XML format.
Properties
RootTag
The XML root tag of this object that was given to the contructor.
public string RootTag { get; }
Property Value
Methods
Load(string)
Loads object state from given file.
public void Load(string sFilename)
Parameters
sFilename
stringComplete filename including path. Must not be
null
or an empty string.
Exceptions
- ArgumentNullException
The given parameter sFilename was
null
.- ArgumentOutOfRangeException
The given parameter sFilename was an empty string.
LoadXml(string)
Loads object state from given XML string.
public void LoadXml(string sXml)
Parameters
sXml
stringXML string that contains the object state to be loaded.
Exceptions
- ArgumentNullException
The given parameter sXml was
null
.
Read(Stream)
Reads object state from the given stream.
public void Read(Stream aStream)
Parameters
aStream
StreamStream to read object state from. Must not be
null
and must be readable.
Exceptions
- ArgumentNullException
The given parameter aStream was
null
.- NotSupportedException
The given stream does not support reading.
ReadXml(XmlReader)
Callback that is ultimately invoked in order to read the XML representation of this object.
public abstract void ReadXml(XmlReader aXmlReader)
Parameters
aXmlReader
XmlReader
Remarks
Override this method in order to read the object state in XML format. This method is invoked after the XML RootTag of this object has already been read. It is supposed to read all object data, but not the closing tag.
ReadXmlDocument(XmlReader)
public string ReadXmlDocument(XmlReader aXmlReader)
Parameters
aXmlReader
XmlReader
Returns
ReadXmlElement(XmlReader, string)
protected string ReadXmlElement(XmlReader aXmlReader, string sTag)
Parameters
Returns
ReadXmlElementAcct(XmlReader, string)
protected FinAcct ReadXmlElementAcct(XmlReader aXmlReader, string sTag)
Parameters
Returns
ReadXmlElementAmt(XmlReader, string)
protected SwiftAmt ReadXmlElementAmt(XmlReader aXmlReader, string sTag)
Parameters
Returns
ReadXmlElementBool(XmlReader, string)
protected bool ReadXmlElementBool(XmlReader aXmlReader, string sTag)
Parameters
Returns
ReadXmlElementDate(XmlReader, string)
protected SwiftDate ReadXmlElementDate(XmlReader aXmlReader, string sTag)
Parameters
Returns
ReadXmlElementInt(XmlReader, string)
Reads the element and tries to parse it as an integer value. If the element does not exist, then zero is returned.
protected int ReadXmlElementInt(XmlReader aXmlReader, string sTag)
Parameters
Returns
ReadXmlElementSegment(XmlReader, string)
protected FinSegment ReadXmlElementSegment(XmlReader aXmlReader, string sTag)
Parameters
Returns
ReadXmlElementTime(XmlReader, string)
protected SwiftTime ReadXmlElementTime(XmlReader aXmlReader, string sTag)
Parameters
Returns
SaveAs(string)
Saves object state to the given file.
public void SaveAs(string sFilename)
Parameters
sFilename
stringComplete filename including path. Must not be
null
or an empty string.
Exceptions
- ArgumentNullException
The given parameter sFilename was
null
.- ArgumentOutOfRangeException
The given parameter sFilename was an empty string.
SaveXml()
Creates a XML string with the current object state.
public string SaveXml()
Returns
- string
XML string with the object state.
SaveXml(string)
Creates a XML string with the current object state.
public string SaveXml(string sRootTag)
Parameters
sRootTag
stringRoot tag to be used in the resulting XML string.
Returns
- string
XML string with the object state.
ToXml(string)
Converts this object into an XML document.
public XmlDocument ToXml(string sRootTag)
Parameters
sRootTag
stringRoot tag to be used in the resulting XML document.
Returns
- XmlDocument
New instance of XmlDocument.
Write(Stream)
Writes object state to the given stream.
public void Write(Stream aStream)
Parameters
aStream
StreamStream to write the object state to. Must not be
null
and must be writable. This method does not close the stream after the object state was written to it. It is up to the caller to ultimately close the stream.
Remarks
This method creates an XmlWriter, writes the default root element and passes the XmlWriter to WriteXml(XmlWriter) for XML persistence.
Exceptions
- ArgumentNullException
The given parameter aStream was
null
.- NotSupportedException
The given stream does not support writing.
WriteXml(XmlWriter)
Callback that is ultimately invoked in order to write the XML representation of this object.
public abstract void WriteXml(XmlWriter aXmlWriter)
Parameters
aXmlWriter
XmlWriter
Remarks
Override this method in order to write the object state in XML format. This method is invoked after the opening XML RootTag has already been written. It is supposed to write all object data, but not the closing tag.
WriteXmlDocument(XmlWriter)
public void WriteXmlDocument(XmlWriter aXmlWriter)
Parameters
aXmlWriter
XmlWriter
WriteXmlDocument(XmlWriter, string)
public void WriteXmlDocument(XmlWriter aXmlWriter, string sRootTag)
Parameters
WriteXmlElement(XmlWriter, string, string)
protected void WriteXmlElement(XmlWriter aXmlWriter, string sTag, string sValue)
Parameters
WriteXmlElementAcct(XmlWriter, string, FinAcct)
protected void WriteXmlElementAcct(XmlWriter aXmlWriter, string sTag, FinAcct aAcct)
Parameters
WriteXmlElementAmt(XmlWriter, string, SwiftAmt)
protected void WriteXmlElementAmt(XmlWriter aXmlWriter, string sTag, SwiftAmt tAmt)
Parameters
WriteXmlElementBool(XmlWriter, string, bool)
protected void WriteXmlElementBool(XmlWriter aXmlWriter, string sTag, bool fValue)
Parameters
WriteXmlElementDate(XmlWriter, string, SwiftDate)
protected void WriteXmlElementDate(XmlWriter aXmlWriter, string sTag, SwiftDate tDate)
Parameters
WriteXmlElementInt(XmlWriter, string, int)
Writes the given integer value, if it is non-zero.
protected void WriteXmlElementInt(XmlWriter aXmlWriter, string sTag, int nValue)
Parameters
WriteXmlElementSegment(XmlWriter, string, FinSegment)
Writes the segment as a base 64 encoded string.
protected void WriteXmlElementSegment(XmlWriter aXmlWriter, string sTag, FinSegment aSegment)
Parameters
aXmlWriter
XmlWritersTag
stringaSegment
FinSegment
WriteXmlElementTime(XmlWriter, string, SwiftTime)
protected void WriteXmlElementTime(XmlWriter aXmlWriter, string sTag, SwiftTime tTime)