Class MxId
- java.lang.Object
-
- com.prowidesoftware.swift.model.MxId
-
public class MxId extends java.lang.ObjectClass for identification of MX messages.It is composed by the business process (business area), functionality (message type), variant and version. For a better understanding of ISO 20022 variants check https://www.iso20022.org/variants.page
- Since:
- 7.7
-
-
Constructor Summary
Constructors Constructor Description MxId()MxId(MxBusinessProcess businessProcess, java.lang.String funString, java.lang.String varString, java.lang.String verString)MxId(java.lang.String namespace)Creates a new object getting data from an MX message namespace.MxId(java.lang.String bpString, java.lang.String funString, java.lang.String varString, java.lang.String verString)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringcamelized()booleanequals(java.lang.Object o)MxBusinessProcessgetBusinessProcess()Gets the business process (a.k.a.java.lang.StringgetFunctionality()Gets the functionality (a.k.a.intgetFunctionalityInt()java.lang.StringgetVariant()intgetVariantInt()java.lang.StringgetVersion()intgetVersionInt()inthashCode()java.lang.Stringid()Get a string in the form of businessprocess.functionality.variant.versionbooleanmatches(MxId other)Check if this identification matches another one.booleanmatches(java.lang.String namespace)Check if this identification matches the given namespace.java.lang.StringnamespaceURI()Creates the corresponding ISO 20022 namespace URI for this MX, for example: urn:swift:xsd:camt.003.001.04 All id attributes should be properly filled.MxIdsetBusinessProcess(MxBusinessProcess businessProcess)MxIdsetFunctionality(java.lang.String functionality)MxIdsetVariant(java.lang.String variant)MxIdsetVersion(java.lang.String version)java.lang.StringtoString()
-
-
-
Constructor Detail
-
MxId
public MxId()
-
MxId
public MxId(java.lang.String namespace)
Creates a new object getting data from an MX message namespace.The implementation parses the namespace using a regex to detect the message type part.
- Parameters:
namespace- a complete or partial namespace such as "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" or just "pain.001.001.03"- Throws:
java.lang.IllegalArgumentException- if namespace parameter cannot be parsed as MX identification
-
MxId
public MxId(MxBusinessProcess businessProcess, java.lang.String funString, java.lang.String varString, java.lang.String verString)
-
MxId
public MxId(java.lang.String bpString, java.lang.String funString, java.lang.String varString, java.lang.String verString)
-
-
Method Detail
-
getBusinessProcess
public MxBusinessProcess getBusinessProcess()
Gets the business process (a.k.a. business area)- Returns:
- the business process set
-
setBusinessProcess
public MxId setBusinessProcess(MxBusinessProcess businessProcess)
-
getFunctionality
public java.lang.String getFunctionality()
Gets the functionality (a.k.a. message type)- Returns:
- the functionality set
-
setFunctionality
public MxId setFunctionality(java.lang.String functionality)
-
getVariant
public java.lang.String getVariant()
-
setVariant
public MxId setVariant(java.lang.String variant)
-
getVersion
public java.lang.String getVersion()
-
setVersion
public MxId setVersion(java.lang.String version)
-
camelized
public java.lang.String camelized()
-
getVersionInt
public int getVersionInt()
-
getVariantInt
public int getVariantInt()
-
getFunctionalityInt
public int getFunctionalityInt()
-
namespaceURI
public java.lang.String namespaceURI()
Creates the corresponding ISO 20022 namespace URI for this MX, for example: urn:swift:xsd:camt.003.001.04 All id attributes should be properly filled.- Returns:
- a string representing the namespace URI for the MX or null if any of the attributes is not set
-
id
public java.lang.String id()
Get a string in the form of businessprocess.functionality.variant.version- Returns:
- a string with the MX message type identification or null if any of the properties is null
- Since:
- 7.7
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
matches
public boolean matches(java.lang.String namespace)
Check if this identification matches the given namespace.This is particularly useful if this identifier is not completely filled, for example: if the business process is set to "pain" and the functionality is set to "002" but the variant and version are left null, then this identifier will match any namespace containing pain.002.*.* where the wildcard could be any number.
new MxId("pain", "002", null, null).matches("pain.002.001.03") will be true.- Parameters:
namespace- a complete or partial namespace such as "urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" or just "pain.001.001.03"- Returns:
- true if this id matches the parameter
- Throws:
java.lang.IllegalArgumentException- if namespace parameter cannot be parsed as MX identification- Since:
- 7.10.7
-
matches
public boolean matches(MxId other)
Check if this identification matches another one.This is particularly useful if this identifier is not completely filled, for example: if the business process is set to "pain" and the functionality is set to "002" but the variant and version are left null, then this identifier will match for example both pain.002.001.03 and pain.002.002.04.
The difference between this implementation and
equals(Object)is that here null and empty properties are treated as equals. Meaning it is not sensible to null versus blank properties, thus pain.001.001.null will match pain.001.001.empty.- Parameters:
other- an identification to compare- Returns:
- true if this id matches the parameter
- Throws:
java.lang.IllegalArgumentException- if namespace parameter cannot be parsed as MX identification- Since:
- 7.10.7
-
-