Package com.prowidesoftware.swift.model
Class SwiftBlock4
- java.lang.Object
-
- com.prowidesoftware.swift.model.SwiftBlock
-
- com.prowidesoftware.swift.model.SwiftTagListBlock
-
- com.prowidesoftware.swift.model.SwiftBlock4
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<Tag>
public class SwiftBlock4 extends SwiftTagListBlock implements java.io.Serializable
Base class for SWIFT Body Block (block 4).
This block is where the actual message content is specified and is what most users see. Generally the other blocks are stripped off before presentation. It mainly contains a list of tags and its format representation, which is variable length and requires use of CRLF as a field delimiter.- Since:
- 4.0
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.prowidesoftware.swift.model.SwiftTagListBlock
EMPTY_LIST
-
Fields inherited from class com.prowidesoftware.swift.model.SwiftBlock
blockType, input, output, unparsedTexts
-
-
Constructor Summary
Constructors Constructor Description SwiftBlock4()
Default constructorSwiftBlock4(java.util.List<Tag> tags)
Constructor with tag initialization
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SwiftBlock4
fromJson(java.lang.String json)
This method deserializes the JSON data into an block 4 object.java.lang.String
getName()
Returns the block name (the value 4 as a string)java.lang.Integer
getNumber()
Returns the block number (the value 4 as an integer)static SwiftBlock4
removeEmptySequences(SwiftBlock4 b4)
Creates a new block with all empty sequences removed.static SwiftBlock4
removeRepeatedBoundaries(SwiftBlock4 b4)
Creates a new block removing all the duplicated sequence boundaries (16R, 16S).protected void
setBlockName(java.lang.String blockName)
Sets the block name.protected void
setBlockNumber(java.lang.Integer blockNumber)
Sets the block number.-
Methods inherited from class com.prowidesoftware.swift.model.SwiftTagListBlock
addTag, addTags, append, append, append, append, append, append, asTagArray, clear, containsAllOf, containsAnyOf, containsField, containsTag, containsTag, containsTag, countAll, countByName, countTagsStarsWith, equals, fields, filterByName, filterByNameOrdered, getField, getFieldByName, getFieldByName, getFieldByName, getFieldByNumber, getFieldByNumber, getFieldByQualifiers, getFieldsByName, getFieldsByName, getFieldsByNumber, getOptionalList, getOptionalList, getOptionalLists, getSubBlock, getSubBlock, getSubBlock, getSubBlock, getSubBlockAfterFirst, getSubBlockAfterFirst, getSubBlockAfterLast, getSubBlockBeforeFirst, getSubBlockBeforeFirst, getSubBlockBeforeLast, getSubBlockByTagNames, getSubBlockDelimitedWithOptionalTail, getSubBlocks, getSubBlocks, getSubBlocks, getSubBlocks, getSubBlocks, getSubBlocks, getSubBlocksByTagNames, getSubBlocksDelimitedWithOptionalTail, getTag, getTagByName, getTagByName, getTagByNumber, getTagIndex, getTagMap, getTags, getTagsByContent, getTagsByName, getTagsByName, getTagsByNumber, getTagsByValue, getTagValue, getTagValues, hashCode, indexOfAnyFirst, indexOfAnyFirstAfterIndex, indexOfAnyLast, indexOfAnyLastAfterIndex, indexOfFirst, indexOfFirstValue, indexOfLast, indexOfLastValue, isEmpty, iterator, removeAfterFirstStartsWith, removeAll, removeSubBlock, removeSubBlocks, removeTag, setTag, setTags, setTags, size, splitByTagName, splitByTagName, sublist, tagIterator, tagNamesList, toJson, toString, visit
-
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
-
-
-
-
Constructor Detail
-
SwiftBlock4
public SwiftBlock4()
Default constructor
-
SwiftBlock4
public SwiftBlock4(java.util.List<Tag> tags)
Constructor with tag initialization- Parameters:
tags
- the list of tags to initialize- Throws:
java.lang.IllegalArgumentException
- if parameter tags is nulljava.lang.IllegalArgumentException
- if parameter tags is not composed of Strings- Since:
- 5.0
-
-
Method Detail
-
removeRepeatedBoundaries
public static SwiftBlock4 removeRepeatedBoundaries(SwiftBlock4 b4)
Creates a new block removing all the duplicated sequence boundaries (16R, 16S).
The implementation uses as sequence boundaries the fields: 16R, 16S. Two or more consecutive 16R (start of sequence) or 16S (end of sequence) with the same qualifier are considered duplicated entries, so all repeated boundary fields 16R or 16S will be dropped.
- Parameters:
b4
- a block with sequences to filter- Returns:
- a new block containing all tags without repeated boundaries or null if the parameter block is null
- Since:
- 9.2.19
-
removeEmptySequences
public static SwiftBlock4 removeEmptySequences(SwiftBlock4 b4)
Creates a new block with all empty sequences removed.
The implementation uses as sequence boundaries the fields: 16R, 16S and 15a. Two consecutive 16R (start of sequence) and 16S (end of sequence) with the same qualifier are considered an empty sequence so both boundary fields 16R and 16S will be dropped. For field 15a (start of sequence) there is no end of sequence boundary so if two consecutive 15a are found, the first one will be dropped. Also a 15a at the end of the block will be considered and empty sequence.
- Parameters:
b4
- a block with sequences to filter- Returns:
- a new block containing all tags that are outside a empty 16R/S or 15a sub-block, or null if the parameter block is null
- Since:
- 7.8.8
-
fromJson
public static SwiftBlock4 fromJson(java.lang.String json)
This method deserializes the JSON data into an block 4 object.- Since:
- 7.9.8
- See Also:
SwiftTagListBlock.toJson()
-
setBlockNumber
protected void setBlockNumber(java.lang.Integer blockNumber)
Sets the block number. Will cause an exception unless setting block number to 4.- Overrides:
setBlockNumber
in classSwiftTagListBlock
- Parameters:
blockNumber
- the block number to set- Throws:
java.lang.IllegalArgumentException
- if parameter blockName is not the integer 4- Since:
- 5.0
-
setBlockName
protected void setBlockName(java.lang.String blockName)
Sets the block name. Will cause an exception unless setting block number to "4".- Overrides:
setBlockName
in classSwiftTagListBlock
- Parameters:
blockName
- the block name to set- Throws:
java.lang.IllegalArgumentException
- if parameter blockName is not the string "4"- Since:
- 5.0
-
getNumber
public java.lang.Integer getNumber()
Returns the block number (the value 4 as an integer)- Overrides:
getNumber
in classSwiftTagListBlock
- Returns:
- Integer containing the block's number
-
getName
public java.lang.String getName()
Returns the block name (the value 4 as a string)- Overrides:
getName
in classSwiftTagListBlock
- Returns:
- block name
- Since:
- 5.0
-
-