public abstract class AbstractMX extends AbstractMessage implements IDocument
AbstractMT
Modifier | Constructor and Description |
---|---|
protected |
AbstractMX() |
protected |
AbstractMX(BusinessHeader businessHeader) |
Modifier and Type | Method and Description |
---|---|
String |
document()
Get this message document as an XML string.
|
String |
document(String prefix,
boolean includeXMLDeclaration)
Get this message document as an XML string.
|
Element |
element() |
BusinessHeader |
getBusinessHeader() |
abstract String |
getBusinessProcess()
get the Alphabetic code in four positions (fixed length) identifying the Business Process
|
abstract Class[] |
getClasses()
Get the classes associated with this message
|
abstract int |
getFunctionality()
Get the code identifying the Message Functionality
|
MxId |
getMxId()
Returns the MX message identification.
Composed by the business process, functionality, variant and version. |
abstract String |
getNamespace()
Get the XML namespace of the message
|
abstract int |
getVariant()
Get the Message variant
|
abstract int |
getVersion()
Get the message version
|
String |
header()
Get this message business header as an XML string.
|
String |
header(String prefix,
boolean includeXMLDeclaration)
Get this message business header as an XML string.
|
String |
message()
Get this message document as an XML string (headers not included).
|
String |
message(String rootElement)
Same as message(String) with includeXMLDeclaration set to true
|
protected static String |
message(String namespace,
AbstractMX obj,
Class[] classes,
String prefix,
boolean includeXMLDeclaration) |
String |
message(String rootElement,
boolean includeXMLDeclaration)
Get this message as an XML string.
|
static AbstractMX |
parse(File file,
MxId id)
Parses a file content into a specific instance of Mx.
|
static AbstractMX |
parse(String xml,
MxId id)
Parses the XML string containing the Document element of an MX message into a specific instance of MX message object.
|
protected static AbstractMX |
read(Class<? extends AbstractMX> targetClass,
String xml,
Class[] classes) |
void |
setBusinessHeader(BusinessHeader businessHeader) |
void |
write(File file)
Writes the message document content into a file in XML format (headers not included).
|
void |
write(OutputStream stream)
Writes the message document content into a file in XML format, encoding content in UTF-8 (headers not included).
|
Source |
xmlSource()
Convenience method to get this message XML as javax.xml.transform.Source.
|
getMessageStandardType, isMT, isMX
protected AbstractMX()
protected AbstractMX(BusinessHeader businessHeader)
protected static String message(String namespace, AbstractMX obj, Class[] classes, String prefix, boolean includeXMLDeclaration)
protected static AbstractMX read(Class<? extends AbstractMX> targetClass, String xml, Class[] classes)
public abstract Class[] getClasses()
public abstract String getNamespace()
public abstract String getBusinessProcess()
public abstract int getFunctionality()
public abstract int getVariant()
public abstract int getVersion()
public String message()
message(String, boolean)
public String message(String rootElement, boolean includeXMLDeclaration)
rootElement
- optional specification of the root elementpublic String message(String rootElement)
public String header()
header(String, boolean)
public String header(String prefix, boolean includeXMLDeclaration)
prefix
- optional prefix for namespace (empty by default)includeXMLDeclaration
- true to include the XML declaration (false by default)BusinessHeader.xml(String, boolean)
public String document()
message()
public String document(String prefix, boolean includeXMLDeclaration)
prefix
- optional prefix for namespace (empty by default)includeXMLDeclaration
- true to include the XML declaration (false by default)public Source xmlSource()
null
if message() returns null
or StreamSource in other casemessage()
public void write(File file) throws IOException
file
- a non null file to write, if it does not exists, it will be createdIOException
public void write(OutputStream stream) throws IOException
stream
- a non null stream to writeIOException
public BusinessHeader getBusinessHeader()
public void setBusinessHeader(BusinessHeader businessHeader)
businessHeader
- the header to setpublic MxId getMxId()
public Element element()
public static AbstractMX parse(String xml, MxId id)
xml
- string a string containing the Document of an MX message in XML formatid
- optional parameter to indicate the specific MX type to create; autodetected from namespace if null.public static AbstractMX parse(File file, MxId id) throws IOException
file
- a file containing a swift MX messageid
- optional parameter to indicate the specific MX type to create; autodetected from namespace if null.IOException
parse(String, MxId)