public class SwiftBlock2Input extends SwiftBlock2 implements java.io.Serializable
It's value is fixed-length and continuous with no field delimiters. This class contains its elements as individual attributes for easier management of the block value.
This class does not provide explicit API to get the MIR of an
outgoing message because it should be created using the session and
sequence numbers at header block 1, and this information is not usually
generated by the application creating the message but by the SWIFT
Alliance interface. Therefore neither SwiftBLock1 or SwiftBlock2Input
provide a getter for the MIR.
It also does not provide any API to get the MOR of a sent message
because that information will be available only when the message
is delivered at destination.
MIR,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
SwiftBlock2Input.DeliveryMonitoring
Delivery monitoring values
|
SwiftBlock2.MessagePrioritymessagePriority, messageTypeblockType, input, output, unparsedTexts| Constructor and Description |
|---|
SwiftBlock2Input()
Default constructor
|
SwiftBlock2Input(java.lang.String value)
Creates the block with lenient false, meaning it expects a fixed length value.
|
SwiftBlock2Input(java.lang.String value,
boolean lenient)
Creates a block 2 output object setting attributes by parsing the string argument containing the blocks value.
|
SwiftBlock2Input(java.lang.String messageType,
java.lang.String receiverAddress,
java.lang.String messagePriority,
java.lang.String deliveryMonitoring,
java.lang.String obsolescencePeriod)
Constructor for specific values
|
SwiftBlock2Input(SwiftBlock2Input block)
Copy constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
clean()
Sets all attributes to null
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
field(SwiftBlock2InputField field)
Generic getter for block attributes based on qualified names from
SwiftBlock2InputField |
static SwiftBlock2Input |
fromJson(java.lang.String json)
This method deserializes the JSON data into an outgoing (input) block 2 object.
|
java.lang.String |
getBlockValue()
Returns the block value
|
java.lang.String |
getDeliveryMonitoring()
Gets the Delivery Monitoring field in block 2 input
|
SwiftBlock2Input.DeliveryMonitoring |
getDeliveryMonitoringType()
Gets the delivery monitoring as enum
|
java.lang.String |
getMessagePriority()
Gets the the message priority field in block 2 input
|
java.lang.String |
getMessageType()
Gets the Message Type (MT) as classified and numbered by SWIFT.
|
java.lang.String |
getObsolescencePeriod()
Gets the obsolescence period field in block 2 input
|
java.lang.String |
getReceiverAddress()
Gets the LT receiver's address field in block 2 input
|
BIC |
getReceiverBIC()
Gets the receiver's BIC code from the receiver LT address.
|
java.lang.String |
getValue()
Gets the fixed length block 2 value, as a result of
concatenating its individual elements as follow:
Message Type + Receivers address + Message Priority + Delivery Monitoring + Obsolescence Period. |
int |
hashCode() |
boolean |
isEmpty()
Tell if this block is empty or not.
|
void |
setBlockValue(java.lang.String value)
This method should be overwritten by subclasses, calling
this method will throw a
java.lang.UnsupportedOperationException |
void |
setDeliveryMonitoring(java.lang.String deliveryMonitoring)
Sets the Delivery Monitoring field is as follows:
1 = Non-Delivery Warning 2 = Delivery Notification 3 = Both valid, Non-Delivery Warning and Delivery Notification This value is optional. If the priority is U, delivery monitoring must be: 1 or 3. If the priority is N, delivery monitoring must be: 2 or not included. |
void |
setField(SwiftBlock2InputField field,
java.lang.String value)
Generic setter for block attributes based on qualified names from
SwiftBlock2InputField |
void |
setMessagePriority(java.lang.String messagePriority)
Sets the message priority as follows:
S = System N = Normal U = Urgent |
void |
setMessageType(java.lang.String messageType)
Sets the Message Type (MT) as classified and numbered by SWIFT.
|
void |
setObsolescencePeriod(java.lang.String obsolescencePeriod)
Sets the Obsolescence Period.
It specifies when a non-delivery notification is generated as follows: Valid for U = 003 (15 minutes) Valid for N = 020 (100 minutes) This value is optional. |
void |
setReceiver(BIC bic)
Creates a full LT address using the parameter BIC code and a default LT identifier.
|
void |
setReceiver(java.lang.String receiver)
Completes if necessary and sets the LT address of the receiver.
The receiver addresses will be filled with proper default LT identifier and branch codes if not provided. |
void |
setReceiverAddress(LogicalTerminalAddress logicalTerminal)
Sets the receiver's address.
|
void |
setReceiverAddress(java.lang.String receiverAddress)
Sets the receiver's address.
It is fixed at 12 characters; it must have X in position 9 (padded with "X" if no branch is required). |
void |
setValue(java.lang.String value)
Sets the block's attributes by parsing the fixed length string argument.
|
void |
setValue(java.lang.String value,
boolean lenient)
Sets the block's attributes by parsing the string argument containing the blocks value.
This value can be in different flavors because some fields are optional. Example of supported values: |
field, getMessagePriorityType, getName, getNumber, isInput, isOutput, setBlockName, setBlockNumber, setField, toJson, toStringgetValuePart, getValuePart, sizegetBlockType, getInput, getOutput, getUnparsedTexts, getUnparsedTextsSize, isTagBlock, setBlockType, setInput, setOutput, setUnparsedTexts, unparsedTextAddText, unparsedTextAddText, unparsedTextGetAsMessage, unparsedTextGetText, unparsedTextIsMessage, unparsedTextVerifypublic SwiftBlock2Input(java.lang.String messageType,
java.lang.String receiverAddress,
java.lang.String messagePriority,
java.lang.String deliveryMonitoring,
java.lang.String obsolescencePeriod)
messageType - the message typereceiverAddress - the receiver addressmessagePriority - the message priority (S=system, U=urgent, N=normal)deliveryMonitoring - the delivery monitoring option (1 or 3 for U priority, 2 for N priority)obsolescencePeriod - the obsolescence period, measured in 5 minutes units (3 for priority U, 20 for priority N).public SwiftBlock2Input(java.lang.String value)
value - a string with length between 16 and 23 containing the blocks valuejava.lang.IllegalArgumentException - if parameter has an invalid total sizesetValue(String, boolean)public SwiftBlock2Input(java.lang.String value,
boolean lenient)
value - string containing the entire blocks valuelenient - if true the value will be parsed with a best effort heuristic, if false it will throw a IllegalArgumentException if the value has an invalid total sizesetValue(String, boolean)public SwiftBlock2Input()
public SwiftBlock2Input(SwiftBlock2Input block)
block - an existing block2 to copypublic static SwiftBlock2Input fromJson(java.lang.String json)
json - JSON representationSwiftBlock2.toJson()public java.lang.String getMessageType()
SwiftBlock2getMessageType in class SwiftBlock2public void setMessageType(java.lang.String messageType)
setMessageType in class SwiftBlock2messageType - String of 3 characterpublic void setReceiver(BIC bic)
bic - receiversetReceiverAddress(LogicalTerminalAddress)public void setReceiver(java.lang.String receiver)
receiver - receiversetReceiverAddress(LogicalTerminalAddress)public java.lang.String getReceiverAddress()
public void setReceiverAddress(java.lang.String receiverAddress)
receiverAddress - 12 characters Stringpublic void setReceiverAddress(LogicalTerminalAddress logicalTerminal)
logicalTerminal - the addressLogicalTerminalAddress.getReceiverLogicalTerminalAddress()public BIC getReceiverBIC()
BICpublic java.lang.String getMessagePriority()
getMessagePriority in class SwiftBlock2public void setMessagePriority(java.lang.String messagePriority)
setMessagePriority in class SwiftBlock2messagePriority - String of 1 characterpublic java.lang.String getDeliveryMonitoring()
public void setDeliveryMonitoring(java.lang.String deliveryMonitoring)
deliveryMonitoring - String of 1 character containing the Delivery Monitoring fieldpublic SwiftBlock2Input.DeliveryMonitoring getDeliveryMonitoringType()
public java.lang.String getObsolescencePeriod()
public void setObsolescencePeriod(java.lang.String obsolescencePeriod)
obsolescencePeriod - String of 3 characters containing the Obsolescence Periodpublic boolean isEmpty()
isEmpty in class SwiftValueBlocktrue if all fields are null and false in other casepublic java.lang.String getValue()
getValue in class SwiftValueBlockpublic void setValue(java.lang.String value)
setValue in class SwiftValueBlockvalue - a fixed length (between 16 and 23) string containing the blocks' valuejava.lang.IllegalArgumentException - if parameter has an invalid total size.setValue(String, boolean)public java.lang.String getBlockValue()
getBlockValue in class SwiftValueBlockgetValue()public void setBlockValue(java.lang.String value)
SwiftValueBlockjava.lang.UnsupportedOperationExceptionsetBlockValue in class SwiftValueBlockvalue - unusedsetValue(String)public void setValue(java.lang.String value,
boolean lenient)
"I100BANKDEFFXXXX" (16) or "2:I100BANKDEFFXXXX" (18) // used for service/system messages "I100BANKDEFFXXXXU" (17) or "2:I100BANKDEFFXXXXU" (19) "I100BANKDEFFXXXXU3" (18) or "2:I100BANKDEFFXXXXU3" (20) "I100BANKDEFFXXXXU3003" (21) or "2:I100BANKDEFFXXXXU3003" (23)
value - string containing the entire blocks valuelenient - if true the value will be parsed with a best effort heuristic, if false it will throw a IllegalArgumentException if the value has an invalid total sizepublic void clean()
clean in class SwiftBlock2public boolean equals(java.lang.Object o)
equals in class SwiftBlock2public int hashCode()
hashCode in class SwiftBlock2public java.lang.String field(SwiftBlock2InputField field)
SwiftBlock2InputFieldfield - field to getpublic void setField(SwiftBlock2InputField field, java.lang.String value)
SwiftBlock2InputFieldfield - field to getvalue - content to set