Package com.prowidesoftware.swift.model
Class SwiftBlock2
- java.lang.Object
-
- com.prowidesoftware.swift.model.SwiftBlock
-
- com.prowidesoftware.swift.model.SwiftValueBlock
-
- com.prowidesoftware.swift.model.SwiftBlock2
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
SwiftBlock2Input
,SwiftBlock2Output
public abstract class SwiftBlock2 extends SwiftValueBlock implements java.io.Serializable
Base class for SWIFT Application Header Block (block 2)The Application Header contains information about the message type and the destination of the message.
There are two types of application headers: Input and Output. Both, input and output block 2 flavors are fixed-length and continuous with no field delimiters. The fields that conform the blocks's value are represented in the subclasses as individual attributes for easier management.
This is an abstract class so specific block 2 subclasses should be instantiated.
- Since:
- 4.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SwiftBlock2.MessagePriority
Message priority values
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
messagePriority
String of 1 character containing the message priority as follows:
S = System
N = Normal
U = Urgentprotected java.lang.String
messageType
String of 3 character containing the Message Type (MT) as classified and numbered by SWIFT.-
Fields inherited from class com.prowidesoftware.swift.model.SwiftBlock
blockType, input, output, unparsedTexts
-
-
Constructor Summary
Constructors Constructor Description SwiftBlock2()
Default Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clean()
Sets all attributes to nullboolean
equals(java.lang.Object o)
java.lang.String
field(SwiftBlock2Field field)
Generic getter for block attributes based on qualified names fromSwiftBlock2Field
java.lang.String
getMessagePriority()
Gets the message prioritySwiftBlock2.MessagePriority
getMessagePriorityType()
Gets the message priority as enumjava.lang.String
getMessageType()
Gets the Message Type (MT) as classified and numbered by SWIFT.java.lang.String
getName()
Returns the block name (the value 2 as a string)java.lang.Integer
getNumber()
Returns the block number (the value 2 as an integer)int
hashCode()
boolean
isInput()
Returnstrue
if this block 2 is an input block 2.boolean
isOutput()
Returnstrue
if this block 2 is an output block 2.protected void
setBlockName(java.lang.String blockName)
Sets the block name.protected void
setBlockNumber(java.lang.Integer blockNumber)
Sets the block number.void
setField(SwiftBlock2Field field, java.lang.String value)
Generic setter for block attributes based on qualified names fromSwiftBlock2Field
void
setMessagePriority(java.lang.String messagePriority)
Set the message priorityvoid
setMessageType(java.lang.String messageType)
Sets the Message Type (MT) as classified and numbered by SWIFT.java.lang.String
toJson()
Specific serialization is provided for block 2 input and output.java.lang.String
toString()
convert this to string-
Methods inherited from class com.prowidesoftware.swift.model.SwiftValueBlock
getBlockValue, getValue, getValuePart, getValuePart, isEmpty, setBlockValue, setValue, size
-
Methods inherited from class com.prowidesoftware.swift.model.SwiftBlock
getBlockType, getInput, getOutput, getUnparsedTexts, getUnparsedTextsSize, isTagBlock, setBlockType, setInput, setOutput, setUnparsedTexts, unparsedTextAddText, unparsedTextAddText, unparsedTextGetAsMessage, unparsedTextGetText, unparsedTextIsMessage, unparsedTextVerify
-
-
-
-
Field Detail
-
messagePriority
protected java.lang.String messagePriority
String of 1 character containing the message priority as follows:
S = System
N = Normal
U = Urgent
-
messageType
protected java.lang.String messageType
String of 3 character containing the Message Type (MT) as classified and numbered by SWIFT. Three-digit FIN message type, example 103.
-
-
Method Detail
-
setBlockNumber
protected void setBlockNumber(java.lang.Integer blockNumber)
Sets the block number. Will cause an exception unless setting block number to 2.- Specified by:
setBlockNumber
in classSwiftBlock
- Parameters:
blockNumber
- the block number to set- Throws:
java.lang.IllegalArgumentException
- if parameter blockName is not the integer 2- Since:
- 5.0
-
setBlockName
protected void setBlockName(java.lang.String blockName)
Sets the block name. Will cause an exception unless setting block number to "2".- Specified by:
setBlockName
in classSwiftBlock
- Parameters:
blockName
- the block name to set- Throws:
java.lang.IllegalArgumentException
- if parameter blockName is not the string "2"- Since:
- 5.0
-
getNumber
public java.lang.Integer getNumber()
Returns the block number (the value 2 as an integer)- Specified by:
getNumber
in classSwiftBlock
- Returns:
- Integer containing the block's number
-
getName
public java.lang.String getName()
Returns the block name (the value 2 as a string)- Specified by:
getName
in classSwiftBlock
- Returns:
- block name
- Since:
- 5.0
-
toString
public java.lang.String toString()
convert this to string- Overrides:
toString
in classSwiftBlock
-
getMessageType
public java.lang.String getMessageType()
Gets the Message Type (MT) as classified and numbered by SWIFT.- Returns:
- messageType String of 3 character
-
setMessageType
public void setMessageType(java.lang.String messageType)
Sets the Message Type (MT) as classified and numbered by SWIFT. Three-digit FIN message type, example 103.- Parameters:
messageType
- String of 3 character
-
getMessagePriority
public java.lang.String getMessagePriority()
Gets the message priority- Returns:
- message priority
-
setMessagePriority
public void setMessagePriority(java.lang.String messagePriority)
Set the message priority- Parameters:
messagePriority
- the message priority
-
getMessagePriorityType
public SwiftBlock2.MessagePriority getMessagePriorityType()
Gets the message priority as enum- Returns:
- message priority enum value or null if the priority is not set or contains an invalid value
- Since:
- 7.8.4
-
isInput
public boolean isInput()
Returnstrue
if this block 2 is an input block 2.- Returns:
true
if block 2 is input, offalse
in other case
-
isOutput
public boolean isOutput()
Returnstrue
if this block 2 is an output block 2.- Returns:
true
if block 2 is output, offalse
in other case
-
clean
public void clean()
Sets all attributes to null- Since:
- 6.4
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classSwiftBlock
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classSwiftBlock
-
toJson
public java.lang.String toJson()
Specific serialization is provided for block 2 input and output.- Returns:
- JSON representation of this block 2
- Since:
- 7.9.8 current block 2 implementation, based on Gson (method signature with null implementation is available since 7.5)
-
field
public java.lang.String field(SwiftBlock2Field field)
Generic getter for block attributes based on qualified names fromSwiftBlock2Field
- Parameters:
field
- field to get- Returns:
- field value or null if attribute is not set
- Since:
- 7.7
-
setField
public void setField(SwiftBlock2Field field, java.lang.String value)
Generic setter for block attributes based on qualified names fromSwiftBlock2Field
- Parameters:
field
- field to setvalue
- content to set- Since:
- 7.8
-
-