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()java.lang.Stringcategory()Get the category of the message, which is the business process name.booleanequals(java.lang.Object o)Indicates whether some other object is "equal to" this one.MxBusinessProcessgetBusinessProcess()Gets the business process (a.k.a.java.util.Optional<java.lang.String>getBusinessService()Get the optional business service, which could be an additional value to differentiate messages within the same message type.java.lang.StringgetFunctionality()Gets the functionality (a.k.a.intgetFunctionalityInt()java.lang.StringgetVariant()intgetVariantInt()java.lang.StringgetVersion()intgetVersionInt()inthashCode()Returns a hash code value for the object.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)MxIdsetBusinessService(java.lang.String businessService)Set the business service, which could be an additional value to differentiate messages within the same message type.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)
Indicates whether some other object is "equal to" this one.Overrides the default implementation of
Object.equals(Object). This method considers twoMxIdobjects equal if theirbusinessProcess,functionality,variant, andversionfields are equal.Notice the business service field is not included in the comparison.
- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the reference object with which to compare- Returns:
trueif this object is the same as the obj argument;falseotherwise
-
hashCode
public int hashCode()
Returns a hash code value for the object.Overrides the default implementation of
Object.hashCode(). This method generates a hash code based on thebusinessProcess,functionality,variant, andversionfields.Notice the business service field is not included in the hash code calculation.
- Overrides:
hashCodein classjava.lang.Object- Returns:
- a hash code value for this 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
-
category
public java.lang.String category()
Get the category of the message, which is the business process name.- Returns:
- the business process name or null if not set
- Since:
- 9.5.0
-
getBusinessService
public java.util.Optional<java.lang.String> getBusinessService()
Get the optional business service, which could be an additional value to differentiate messages within the same message type. For example "swift.cbprplus.cov.02". Notice when the MxId is created from the namespace this value is not set. This value must be set manually by the application when the MxId is extracted from a whole message and the AppHdr is available. Alternatively, the application can set this value with any other context information and use it as a discriminator.- Returns:
- the business service value or null if not set
- Since:
- 9.5.0
-
setBusinessService
public MxId setBusinessService(java.lang.String businessService)
Set the business service, which could be an additional value to differentiate messages within the same message type. This is mainly intended to contain the business services from the message AppHdr, but could potentially be used to hold any other value that helps to differentiate messages within the same message type.- Parameters:
businessService- a string value to set as discriminator, for example "swift.cbprplus.cov.02"- Since:
- 9.5.0
-
-