Class SwiftTagListBlock

    • Constructor Summary

      Constructors 
      Constructor Description
      SwiftTagListBlock()
      Default constructor, shouldn't be used normally.
      SwiftTagListBlock​(java.util.List<Tag> tags)
      Intended to be used by search results in this class
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTag​(int index, Tag tag)
      Adds a tag at the specified position in this tag list.
      void addTags​(java.util.List<Tag> tags)
      Add all tags in the List argument to the current blocks.
      SwiftTagListBlock append​(Field field)
      Add the given field to the end of the list.
      SwiftTagListBlock append​(Field... fields)
      Appends all fields to the current block
      SwiftTagListBlock append​(SwiftTagListBlock block)
      Appends all tags in block to the contents of this block
      SwiftTagListBlock append​(SwiftTagListBlock... blocks)
      Appends all blocks to the end of this one.
      SwiftTagListBlock append​(Tag tag)
      Add the given tag to the end of the list
      SwiftTagListBlock append​(Tag... tags)
      Appends all tags to the current block
      Tag[] asTagArray()
      Get the content of this tag block as a Tag array.
      SwiftTagListBlock clear()
      Removes all tags from the backing storage.
      boolean containsAllOf​(java.lang.String... name)
      Tell if this block contains all of the given name tags.
      boolean containsAnyOf​(java.lang.String... name)
      Tell if this block contains any of the given name tags.
      boolean containsField​(java.lang.String name)
      Tell if this block contains at least a field with the given name
      boolean containsTag​(int tagNumber)
      Tells if this block contains at least one tag with the given number (ignoring the letter option).
      boolean containsTag​(Tag t)
      Iterates the internal list of tags and returns true if there is at least one tag equals to the given one.
      boolean containsTag​(java.lang.String name)
      Tells if this block contains at least one tag with the given name.
      int countAll()
      Gets the number of tags in this taglist
      int countByName​(java.lang.String name)
      Counts how many tags with the given name are present in the block.
      int countTagsStarsWith​(java.lang.String name, java.lang.String value)
      Counts tags starting with the given value
      boolean equals​(java.lang.Object o)  
      java.util.List<Field> fields()
      Return the list of fields in this block.
      SwiftTagListBlock filterByName​(boolean include, java.lang.String... names)
      Returns a new block that includes (true) or excludes (false), depending on includeOrExclude flag all tags with names matching any of the parameter names.
      Once a tagname is matched, it is removed from the list of tags to be matched, causing to be only included/excluded the first instance of every tagname.
      For example: 1, 2, 3, 4, 5, 6 filter by names 2, 4, 5 will return 1, 3, 6.
      SwiftTagListBlock filterByNameOrdered​(java.lang.String... names)
      Returns a new block that includes all tags with names matching any of the parameter names until a non matching tag is found.
      Once a tagname is matched, it is removed from the list of tags to be matched, causing to be only included/excluded the first instance of every tagname.
      For example: 1, 2, 3, 9, 4, 5, 6 filter by names 1, 2, 3, 4 will return 1, 2, 3.
      Field getField​(int index)
      Shortcut to getTag(int).getField()
      Field getFieldByName​(java.lang.String name)
      Gets the first field matching the given name.
      Field getFieldByName​(java.lang.String name, java.lang.String componentValue)
      Gets the first field matching the given name and first component value.
      Field getFieldByName​(java.lang.String name, java.lang.String component1, java.lang.String component2)
      Gets all fields matching the given name, matching also the first and second component values.
      For example, for parameters 22F, OPTF and FOO it will match 22F::OPTF/FOO/QCAS but not 22F::OPTF//QCAS
      Field getFieldByNumber​(int fieldNumber)
      Search and retrieve the first Field with the given number.
      Field getFieldByNumber​(int fieldNumber, java.lang.String componentValue)
      Gets the first field matching the given number and component value.
      Field getFieldByQualifiers​(java.lang.String name, java.lang.String qualifier, java.lang.String conditionalQualifier)
      Gets all generic fields matching the given name and qualifiers.
      For example, for parameters 22F, OPTF and QCAS it will match 22F::OPTF//QCAS or 22F::OPTF/DSS/QCAS
      Field[] getFieldsByName​(java.lang.String name)
      Gets all fields matching the given name.
      java.util.List<? extends Field> getFieldsByName​(java.lang.String name, java.lang.String componentValue)
      Gets all fields matching the given name and first component value.
      java.util.List<? extends Field> getFieldsByNumber​(int fieldNumber)
      Get all Fields of a given number.
      For example: for 59 will return any of 59, 59A, 59F, etc...
      java.lang.String getName()
      Returns the block name (this method is to be overwritten for derived classes).
      java.lang.Integer getNumber()
      Returns the block number (this method is to be overwritten for derived classes).
      SwiftTagListBlock getOptionalList​(java.lang.String[][] optionalTags)  
      SwiftTagListBlock getOptionalList​(java.lang.String[][] optionalTags, int startAt)
      Search a sequence of optional tags.
      java.util.List<SwiftTagListBlock> getOptionalLists​(java.lang.String[][] optionalTags)  
      SwiftTagListBlock getSubBlock​(Tag start, Tag end)
      Get all tags between the first occurrence of the starting Tag and the first occurrence of an optional ending Tag.
      SwiftTagListBlock getSubBlock​(java.lang.Integer from, java.lang.Integer to)
      Creates a new block containing the list of tags between the given indexes: from, inclusive, and to, exclusive.
      Similar to the substring method of String, but for a list of Tag instead of an array of characters.
      SwiftTagListBlock getSubBlock​(java.lang.String blockName)
      Gets all tags of a specific sub block, searching for the first occurrence of the starting 16R field (with blockName as value) and its correspondent 16S field (with blockName as value).
      SwiftTagListBlock getSubBlock​(java.lang.String startTagName, java.lang.String endTagName)
      Get all tags between the first occurrence of the starting Tag name and the first occurrence of an optional ending Tag name.
      SwiftTagListBlock getSubBlockAfterFirst​(Tag tag, boolean includeBoundaryInResult)
      Gets the subblock after the first instance of a given tag boundary.
      SwiftTagListBlock getSubBlockAfterFirst​(java.lang.String tagname, boolean includeBoundaryInResult)
      Gets a subblock after the first tag with the given name.
      SwiftTagListBlock getSubBlockAfterLast​(java.lang.String tagname, boolean includeBoundaryInResult)
      Gets the subblock after the last tag with the given name.
      SwiftTagListBlock getSubBlockBeforeFirst​(Tag tag, boolean includeBoundaryInResult)
      Gets the subblock before the first tag with the given tagname.
      SwiftTagListBlock getSubBlockBeforeFirst​(java.lang.String tagname, boolean includeBoundaryInResult)
      Gets the subblock before the first tag with the given tagname.
      SwiftTagListBlock getSubBlockBeforeLast​(java.lang.String tagname, boolean includeBoundaryInResult)
      Gets the subblock with all tags until tha last tag with the given name
      SwiftTagListBlock getSubBlockByTagNames​(java.lang.Integer startIndex, java.lang.String... searchTags)
      Find a sub block given a comprehensive ordered list of search tag names.
      SwiftTagListBlock getSubBlockDelimitedWithOptionalTail​(java.lang.String[] start, java.lang.String[] end, java.lang.String[] tail)
      Get the first found sub block in message that start with tag with tag name, end with tag named endName and optionally, may be null, have optionalTail tag names at the end of the sequence
      java.util.List<SwiftTagListBlock> getSubBlocks​(int startTagNumber, int endTagNumber)
      Get all sub blocks using the starting and ending Tag numbers as block boundaries (Tag values are ignored).
      java.util.List<SwiftTagListBlock> getSubBlocks​(int startTagNumber, java.lang.String endTagName)
      Get all sub blocks using the starting Tag number and ending Tag name as block boundaries (Tag values are ignored).
      java.util.List<SwiftTagListBlock> getSubBlocks​(Tag start, Tag end)
      Get all sub blocks using the starting and ending Tags as block boundaries.
      The starting and end tags are included in the resulting sub blocks.
      java.util.List<SwiftTagListBlock> getSubBlocks​(java.lang.String blockName)
      Gets all sub blocks with a specific name, using ISO 15022 FIN block structure definitions.
      java.util.List<SwiftTagListBlock> getSubBlocks​(java.lang.String startTagName, int endTagNumber)
      Get all sub blocks using the starting Tag name and ending Tag number as block boundaries (Tag values are ignored).
      java.util.List<SwiftTagListBlock> getSubBlocks​(java.lang.String startTagName, java.lang.String endTagName)
      Get all sub blocks using the starting and ending Tag names as block boundaries (Tag values are ignored).
      java.util.List<SwiftTagListBlock> getSubBlocksByTagNames​(java.lang.Integer startIndex, java.lang.String... searchTags)
      Similar to getSubBlockByTagNames(Integer, String...) but will return all matches for the indicated subblock.
      java.util.List<SwiftTagListBlock> getSubBlocksDelimitedWithOptionalTail​(java.lang.String[] start, java.lang.String[] end, java.lang.String[] tail)
      Get all subblocks in message that start with tag with tagname, end with tag named endName and optionally, may be null, have optionalTail tag names at the end of the secuence
      Tag getTag​(int index)
      Gets the Tag at the given index in this block.
      Tag getTagByName​(java.lang.String name)
      Iterate through tags in this block and return the first tag whose name matches the parameter.
      Tag getTagByName​(java.lang.String name, java.lang.String component1, java.lang.String component2)
      Get the first field with the given name, matching the given values for components 1 and 2.
      Tag getTagByNumber​(int tagNumber)
      Search and retrieve the first tag with the given number.
      java.lang.Integer getTagIndex​(java.lang.String startTagNumber, java.lang.String[] letterOptions)
      Get the index of the given tag in the list.
      java.util.Map<java.lang.String,​java.lang.String> getTagMap()
      Gets a Map that contains the the tag names as keys and the values as map value.
      java.util.List<Tag> getTags()
      Gets the internal List of tags in block.
      java.util.List<Tag> getTagsByContent​(java.lang.String content)
      Returns the tags having the specified content as part of its value, regardless of the tag name.
      For example the field :98A::XDTE//20090818 will be included for parameter XDTE
      Tag[] getTagsByName​(java.lang.String name)
      Gets all tags with the given name.
      java.util.List<Tag> getTagsByName​(java.lang.String name, java.lang.String componentValue)
      Gets all tag instances matching the given name and first component value.
      java.util.List<Tag> getTagsByNumber​(int tagNumber)
      Get all tags with a given number, regardless of the letter options.
      java.util.List<Tag> getTagsByValue​(java.lang.String value)
      Returns the tags having the exact specified content as value, regardless of the tag name.
      For example the field :98A::XDTE//20090818 will be included for parameter :XDTE//20090818
      java.lang.String getTagValue​(java.lang.String name)
      Gets the value of the given tag or null if that tag is not found.
      If the tag is present more than once, then this method retrieves the value of the first occurrence.
      java.lang.String[] getTagValues​(java.lang.String name)
      Gets the values for all tags matching the given name.
      int hashCode()  
      int indexOfAnyFirst​(java.lang.String... tagnames)
      Gets the index of the first tag matching any of the given names
      int indexOfAnyFirstAfterIndex​(int index, java.lang.String... tagnames)
      Gets the index of the first tag matching any of the given names at or after the given index in the tag list
      int indexOfAnyLast​(java.lang.String... tagnames)
      Get the index of the last of any tagnames in the list or -1 if not found or any precondition is not met.
      int indexOfAnyLastAfterIndex​(int index, java.lang.String... tagnames)
      Get the index of the last of any tagnames after the given index in the list or -1 if not found or any precondition is not met
      int indexOfFirst​(java.lang.String tagname)
      Gets the index of the first tag with the given name in this tag list
      int indexOfFirstValue​(java.lang.String tagname, java.lang.String value)
      Gets the index of the first tag in this tag list, with the given name and value
      int indexOfLast​(java.lang.String tagname)
      Get the index of the last tagname in the list or -1 if not found or any precondition is not met
      int indexOfLastValue​(java.lang.String tagname, java.lang.String value)
      Get the index of the last tagname with the given value in the list or -1 if not found or any precondition is not met
      boolean isEmpty()
      Tells if the block contains at least one Tag.
      java.util.Iterator<Tag> iterator()  
      SwiftTagListBlock removeAfterFirstStartsWith​(java.lang.String name, java.lang.String startsWith)
      Return a new block with all tags until the first tagname with the given name that start with startsWith
      int removeAll​(java.lang.String name)
      Remove all tags in the current block that match the given name.
      SwiftTagListBlock removeSubBlock​(java.lang.String blockName)
      Removes a sub block using fields 16R and 16S with the given block name as boundary.
      SwiftTagListBlock removeSubBlocks​(java.lang.String blockName)
      Remove all sub blocks with the given name (using fields 16R and 16S as boundaries).
      java.lang.String removeTag​(java.lang.String name)
      Remove the tag with the given name in the block.
      protected void setBlockName​(java.lang.String blockName)
      Sets the block name (this method is to be overwrite for derived classes).
      protected void setBlockNumber​(java.lang.Integer blockNumber)
      Sets the block number (this method is to be overwrite for derived classes).
      Tag setTag​(int index, Tag tag)
      Replaces the tag at the specified position in this tag list with the specified tag.
      void setTags​(Tag[] tags)  
      void setTags​(java.util.List<Tag> tags)
      Set tag in the list of tags of this block.
      int size()
      Tells the amount of fields contained in the block, may be zero.
      java.util.List<SwiftTagListBlock> splitByTagName​(int tagNumber, java.lang.String letterOption)
      Helper method to retrieve all sequences starting with the parameter field.
      java.util.List<SwiftTagListBlock> splitByTagName​(java.lang.String tagName)
      Split the given list with the given tagname.
      SwiftTagListBlock sublist​(java.lang.Integer start, java.lang.Integer end)
      Get a new list with the elements contained between start and end, both inclusive.
      java.util.Iterator<Tag> tagIterator()
      Gets a Iterator for the tags in this block or null if no tags are present on the block an empty iterator is returned.
      java.util.List<java.lang.String> tagNamesList()  
      java.lang.String toJson()
      Get a json representation of this block.
      java.lang.String toString()
      convert this to string
      void visit​(TagVisitor visitor)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • EMPTY_LIST

        public static final SwiftTagListBlock EMPTY_LIST
        Immutableempty instance of this class.
    • Constructor Detail

      • SwiftTagListBlock

        public SwiftTagListBlock()
        Default constructor, shouldn't be used normally. present only for subclasses
      • SwiftTagListBlock

        public SwiftTagListBlock​(java.util.List<Tag> tags)
        Intended to be used by search results in this class
    • Method Detail

      • getTags

        public java.util.List<Tag> getTags()
        Gets the internal List of tags in block.
        Returns:
        a List of Tag
        See Also:
        Tag
      • setTags

        public void setTags​(java.util.List<Tag> tags)
        Set tag in the list of tags of this block.
        Parameters:
        tags - the tags of the block, may be null to remove all the tags of the block
        Throws:
        java.lang.IllegalArgumentException - if parameter tags is not null and contains elements of class other than Tag
      • setTags

        public void setTags​(Tag[] tags)
        Parameters:
        tags - tags to set
        See Also:
        setTags(List)
      • getTagByName

        public Tag getTagByName​(java.lang.String name)
        Iterate through tags in this block and return the first tag whose name matches the parameter.
        Parameters:
        name - the tag name to search, for example "32A" or "58" (letter option wildcard 'a' is not supported)
        Returns:
        the first tag with the given name or null if none is found
        Throws:
        java.lang.IllegalArgumentException - if the name parameter is null
      • getTag

        public Tag getTag​(int index)
        Gets the Tag at the given index in this block.
        Parameters:
        index - the index position of the tag to retrieve (zero based)
        Returns:
        the Tag at the given index
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range
        See Also:
        List.get(int)
      • containsTag

        public boolean containsTag​(java.lang.String name)
        Tells if this block contains at least one tag with the given name.
        Parameters:
        name - the tag name to search, for example "32A" or "58" (letter option wildcard 'a' is not supported)
        Returns:
        true if a tag matching the given name is found
        Throws:
        java.lang.IllegalArgumentException - if the name parameter is null
        See Also:
        getTagByName(String)
      • containsTag

        public boolean containsTag​(int tagNumber)
        Tells if this block contains at least one tag with the given number (ignoring the letter option). For example: containsTag(59) will return true if there is any variant of 59, 59A, 59F, etc...
        Parameters:
        tagNumber - the tag number to search
        Returns:
        true if there is a tag with the given number regardless of the letter option
        See Also:
        getTagByNumber(int)
      • getTagValue

        public java.lang.String getTagValue​(java.lang.String name)
        Gets the value of the given tag or null if that tag is not found.
        If the tag is present more than once, then this method retrieves the value of the first occurrence.
        Parameters:
        name - the tag name to search, for example "32A" or "58" (letter option wildcard 'a' is not supported)
        Returns:
        a String containing the value null if the tag is not found
        Throws:
        java.lang.IllegalArgumentException - if the name parameter is null
        See Also:
        getTagByName(String)
      • getTagsByName

        public Tag[] getTagsByName​(java.lang.String name)
        Gets all tags with the given name. If name is null all tags that contain block data will be returned.
        Parameters:
        name - the tags name to search, for example "32A" or "58" (letter option wildcard 'a' is not supported)
        Returns:
        an array of tags or an empty array if no tags are found
        Throws:
        java.lang.IllegalArgumentException - if the name parameter is null
        See Also:
        to find tags with letter option wildcard
      • getTagByName

        public Tag getTagByName​(java.lang.String name,
                                java.lang.String component1,
                                java.lang.String component2)
        Get the first field with the given name, matching the given values for components 1 and 2.
        Parameters:
        name - the tag name to search, for example "32A" or "58" (letter option wildcard 'a' is not supported)
        component1 - the string to match as component 1.
        component2 - the string to match as component 2.
        Returns:
        the first tag found matching the name and components values or null if none is found
        Throws:
        java.lang.IllegalArgumentException - if the name parameter is null
        Since:
        7.8
      • getTagByNumber

        public Tag getTagByNumber​(int tagNumber)
        Search and retrieve the first tag with the given number. For example: For 59 will return any of 59, 59A, 59F, etc...
        Parameters:
        tagNumber - the tags number to search
        Returns:
        the first tag with the given number or null if no tag is found.
      • getTagsByNumber

        public java.util.List<Tag> getTagsByNumber​(int tagNumber)
        Get all tags with a given number, regardless of the letter options.
        Parameters:
        tagNumber - the tags number to search
        Returns:
        the tags matching the given number or an empty list if none is found.
      • getTagsByValue

        public java.util.List<Tag> getTagsByValue​(java.lang.String value)
        Returns the tags having the exact specified content as value, regardless of the tag name.
        For example the field :98A::XDTE//20090818 will be included for parameter :XDTE//20090818

        For partial match see getTagsByContent(String)

        Parameters:
        value - the value of tags to find
        Returns:
        an list of tags or an empty list if none is found
        Since:
        6.0
      • getTagsByContent

        public java.util.List<Tag> getTagsByContent​(java.lang.String content)
        Returns the tags having the specified content as part of its value, regardless of the tag name.
        For example the field :98A::XDTE//20090818 will be included for parameter XDTE

        For exact value match see getTagsByValue(String)

        Parameters:
        content - partial value of the tags to find
        Returns:
        an list of tags or an empty list if none is found
        Since:
        6.0
      • getTagValues

        public java.lang.String[] getTagValues​(java.lang.String name)
        Gets the values for all tags matching the given name. The tag list is searched in order, the value of all tag matching the name are added to the result.
        Parameters:
        name - the tag name to search, for example "32A" or "58" (letter option wildcard 'a' is not supported)
        Returns:
        and array containing the values of all the matching tags or an empty array if none is found
        Throws:
        java.lang.IllegalArgumentException - if the name parameter is null
        See Also:
        getTagsByName(String)
      • getTagMap

        public java.util.Map<java.lang.String,​java.lang.String> getTagMap()
        Gets a Map that contains the the tag names as keys and the values as map value. If a field is present more than once, then the first instance is processed and the rest is ignored.
        Returns:
        a Map for the tags name and values
      • getFieldByName

        public Field getFieldByName​(java.lang.String name)
        Gets the first field matching the given name.
        Parameters:
        name - the name of the field to match, may end with 'a' as wildcard to select any letter option, for example 50a will match both 50A and 50B
        Returns:
        the found field instance or null if none is found with the given name
        Throws:
        java.lang.IllegalArgumentException - if the name parameter is null
      • getFieldsByName

        public Field[] getFieldsByName​(java.lang.String name)
        Gets all fields matching the given name.
        Parameters:
        name - the name of the field to match, may end with 'a' as wildcard to select any letter option, for example 50a will match both 50A and 50B
        Returns:
        an array of matched fields or an empty array if none is found
        Throws:
        java.lang.IllegalArgumentException - if the name parameter is null
      • getFieldByName

        public Field getFieldByName​(java.lang.String name,
                                    java.lang.String componentValue)
        Gets the first field matching the given name and first component value. This is particularly helpful to find generic field by its qualifier.
        Parameters:
        name - the name of the field to match, may end with 'a' as wildcard to select any letter option, for example 50a will match both 50A and 50B
        componentValue - expected value for component 1 in the matched field, or null to return the first field matching the name
        Returns:
        the first matching field or null if none is found
        Throws:
        java.lang.IllegalArgumentException - if name parameter is null
        Since:
        7.5
      • getFieldsByName

        public java.util.List<? extends Field> getFieldsByName​(java.lang.String name,
                                                               java.lang.String componentValue)
        Gets all fields matching the given name and first component value.
        Parameters:
        name - the name of the field to match, may end with 'a' as wildcard to select any letter option, for example 50a will match both 50A and 50B
        componentValue - expected value for component 1 in the matched fields, or null to return all fields matching the name
        Returns:
        a list of matching fields or an empty list if none is found
        Throws:
        java.lang.IllegalArgumentException - if name parameter is null
        Since:
        7.6
      • getTagsByName

        public java.util.List<Tag> getTagsByName​(java.lang.String name,
                                                 java.lang.String componentValue)
        Gets all tag instances matching the given name and first component value.
        Parameters:
        name - the name of the field to match, may end with 'a' as wildcard to select any letter option, for example 50a will match both 50A and 50B
        componentValue - expected value for component 1 in the matched fields, or null to return all fields matching the name
        Returns:
        a list of matching tags or an empty list if none is found
        Throws:
        java.lang.IllegalArgumentException - if name parameter is null
        Since:
        7.10.6
      • getField

        public Field getField​(int index)
        Shortcut to getTag(int).getField()
        Parameters:
        index - the index position of the field to retrieve (zero based)
        Returns:
        the field at the given index
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range
        See Also:
        getTag(int)
      • getFieldByName

        public Field getFieldByName​(java.lang.String name,
                                    java.lang.String component1,
                                    java.lang.String component2)
        Gets all fields matching the given name, matching also the first and second component values.
        For example, for parameters 22F, OPTF and FOO it will match 22F::OPTF/FOO/QCAS but not 22F::OPTF//QCAS
        Parameters:
        name - the name of the field to match, may end with 'a' as wildcard to select any letter option, for example 50a will match both 50A and 50B
        component1 - the expected value for the component 1 of the matched field
        component2 - the expected value for the component 2 of the matched field
        Returns:
        the first matching field or null if none is found with the given name and component values
        Since:
        7.5
        See Also:
        getFieldByQualifiers(String, String, String)
      • getFieldByQualifiers

        public Field getFieldByQualifiers​(java.lang.String name,
                                          java.lang.String qualifier,
                                          java.lang.String conditionalQualifier)
        Gets all generic fields matching the given name and qualifiers.
        For example, for parameters 22F, OPTF and QCAS it will match 22F::OPTF//QCAS or 22F::OPTF/DSS/QCAS
        Parameters:
        name - the name of the field to match, may end with 'a' as wildcard to select any letter option, for example 50a will match both 50A and 50B
        qualifier - the expected value for the component 1 of the matched field
        conditionalQualifier - the expected value for the conditional qualifier component (usually 2 or 3) of the matched field
        Returns:
        the first matching field or null if none is found with the given name and expected component values
        See Also:
        getFieldByName(String, String), GenericField
      • getFieldByNumber

        public Field getFieldByNumber​(int fieldNumber)
        Search and retrieve the first Field with the given number. For example: for 59 will return any of 59, 59A, 59F, etc...
        Parameters:
        fieldNumber - the field number to search
        Returns:
        the first instance of the given field in the message or null if none is found
        See Also:
        getTagByNumber(int)
      • getFieldsByNumber

        public java.util.List<? extends Field> getFieldsByNumber​(int fieldNumber)
        Get all Fields of a given number.
        For example: for 59 will return any of 59, 59A, 59F, etc...
        Parameters:
        fieldNumber - the field number to search
        Returns:
        the fields matching the given number or an empty list if none is found.
        See Also:
        getTagsByNumber(int)
      • getFieldByNumber

        public Field getFieldByNumber​(int fieldNumber,
                                      java.lang.String componentValue)
        Gets the first field matching the given number and component value. For example: for 59 will return any of 59, 59A, 59F, etc...
        Parameters:
        fieldNumber - the field number to search
        componentValue - expected value for component 1 in the matched field
        Returns:
        the first matching field or null if none is found
      • containsField

        public boolean containsField​(java.lang.String name)
        Tell if this block contains at least a field with the given name
        Parameters:
        name - the name of the field to match, may end with 'a' as wildcard to select any letter option, for example 50a will match both 50A and 50B
        Returns:
        true if this field exists at lease once, false in other case
        See Also:
        getFieldsByName(String)
      • countByName

        public int countByName​(java.lang.String name)
        Counts how many tags with the given name are present in the block.
        Parameters:
        name - the name of the tag
        Returns:
        the amount of tags with the given name in the block
        Throws:
        java.lang.IllegalArgumentException - if tagname key is null
      • toString

        public java.lang.String toString()
        convert this to string
        Overrides:
        toString in class SwiftBlock
      • removeTag

        public java.lang.String removeTag​(java.lang.String name)
        Remove the tag with the given name in the block. If more than one instance of the given name is found the first instance is removed while the rest remains untouched.
        Parameters:
        name - the name of the tag to remove must not be null
        Returns:
        the value of the removed tag
        Throws:
        java.lang.IllegalArgumentException - if parameter name is null
        See Also:
        removeAll(String)
      • removeAll

        public int removeAll​(java.lang.String name)
        Remove all tags in the current block that match the given name. If name is an invalid tag no error is thrown. There is no difference by using this method to tell if a tag was present or not. for quering the block for existing tags containsTag(String) must be used.
        Parameters:
        name - the name of the tag to remove. may be null in which case the tags containing 'block data' will be removed
        Returns:
        the amount of tags removed
        Throws:
        java.lang.IllegalArgumentException - if parameter name is null
        See Also:
        removeTag(String)
      • tagIterator

        public java.util.Iterator<Tag> tagIterator()
        Gets a Iterator for the tags in this block or null if no tags are present on the block an empty iterator is returned.
        Returns:
        an Iterator that may or may not contain objects of type Tag
        See Also:
        Tag
      • addTags

        public void addTags​(java.util.List<Tag> tags)
        Add all tags in the List argument to the current blocks. Current tags will not be removed.
        Parameters:
        tags - the list of tags to add
        Throws:
        java.lang.IllegalArgumentException - if parameter name is null
      • addTag

        public void addTag​(int index,
                           Tag tag)
        Adds a tag at the specified position in this tag list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
        Parameters:
        tag - the tag to add
        index - index at which the specified tag is to be inserted (zero based)
        Throws:
        java.lang.IllegalArgumentException - if parameter name is null
        java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
        Since:
        7.9.7
      • countAll

        public int countAll()
        Gets the number of tags in this taglist
        Returns:
        zero or the amount of tags contained in the block
      • setTag

        public Tag setTag​(int index,
                          Tag tag)
        Replaces the tag at the specified position in this tag list with the specified tag.
        Parameters:
        index - index of the tag to replace (zero based)
        tag - tag to be stored at the specified position
        Returns:
        the tag previously at the specified position
        Throws:
        java.lang.IllegalArgumentException - if parameter name is null
        java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
        Since:
        7.9.7
      • isEmpty

        public boolean isEmpty()
        Tells if the block contains at least one Tag.
        Returns:
        true if the block contains at least one Tag and false in other case
      • size

        public int size()
        Tells the amount of fields contained in the block, may be zero.
        Returns:
        zero if tags is null or empty or the amount of tags in this object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class SwiftBlock
      • getSubBlocks

        public java.util.List<SwiftTagListBlock> getSubBlocks​(Tag start,
                                                              Tag end)
        Get all sub blocks using the starting and ending Tags as block boundaries.
        The starting and end tags are included in the resulting sub blocks.
        Tag compare is done using Tag.equalsIgnoreCR(Tag) (not object references).
        Parameters:
        start - starting tag
        end - ending tag
        Returns:
        a list of SwiftTagListBlock new blocks containing the found tags (the list can be empty if no tags are found)
        Since:
        6.0
      • getSubBlocks

        public java.util.List<SwiftTagListBlock> getSubBlocks​(java.lang.String blockName)
        Gets all sub blocks with a specific name, using ISO 15022 FIN block structure definitions. It searches for a starting 16R field (with blockName as value) and its correspondent 16S field (with blockName as value) as block boundaries.
        Parameters:
        blockName - block name, used for block
        Returns:
        a list containing the found tags (the list can be empty if no tags are found)
        Since:
        6.0
        See Also:
        getSubBlocks(Tag, Tag)
      • getSubBlocks

        public java.util.List<SwiftTagListBlock> getSubBlocks​(java.lang.String startTagName,
                                                              java.lang.String endTagName)
        Get all sub blocks using the starting and ending Tag names as block boundaries (Tag values are ignored). The starting and end tags are included in the resulting sub blocks.
        This method is particularly useful to get sub blocks that are not bounded by 16R and 16S fields.
        Parameters:
        startTagName - starting tag name
        endTagName - ending tag name
        Returns:
        a list of SwiftTagListBlock new blocks containing the found tags (the list can be empty if no tags are found)
        Since:
        6.0
      • getSubBlocks

        public java.util.List<SwiftTagListBlock> getSubBlocks​(int startTagNumber,
                                                              int endTagNumber)
        Get all sub blocks using the starting and ending Tag numbers as block boundaries (Tag values are ignored). The starting and end tags are included in the resulting sub blocks.
        This method is particularly useful to get sub blocks that are not bounded by 16R and 16S fields.
        Parameters:
        startTagNumber - starting tag number regardless of the letter option
        endTagNumber - ending tag number regardless of the letter option
        Returns:
        a list of SwiftTagListBlock new blocks containing the found tags (the list can be empty if no tags are found)
        Since:
        6.2
      • getSubBlocks

        public java.util.List<SwiftTagListBlock> getSubBlocks​(java.lang.String startTagName,
                                                              int endTagNumber)
        Get all sub blocks using the starting Tag name and ending Tag number as block boundaries (Tag values are ignored). The starting and end tags are included in the resulting sub blocks.
        Parameters:
        startTagName - starting tag name
        endTagNumber - ending tag number regardless of the letter option
        Returns:
        a list of SwiftTagListBlock new blocks containing the found tags (the list can be empty if no tags are found)
        Since:
        6.2
      • getSubBlocks

        public java.util.List<SwiftTagListBlock> getSubBlocks​(int startTagNumber,
                                                              java.lang.String endTagName)
        Get all sub blocks using the starting Tag number and ending Tag name as block boundaries (Tag values are ignored). The starting and end tags are included in the resulting sub blocks.
        Parameters:
        startTagNumber - starting tag name number regardless of the letter option
        endTagName - ending tag name
        Returns:
        a list of SwiftTagListBlock new blocks containing the found tags (the list can be empty if no tags are found)
        Since:
        6.2
      • getSubBlock

        public SwiftTagListBlock getSubBlock​(java.lang.String startTagName,
                                             java.lang.String endTagName)
        Get all tags between the first occurrence of the starting Tag name and the first occurrence of an optional ending Tag name. If the ending Tag name is null or not found after the starting Tag name, it returns all tags until end of block. The starting and end tags are included in the resulting block.
        Parameters:
        startTagName - starting tag name
        endTagName - ending tag name or null
        Returns:
        a new block containing the found tags (the block can be empty if no tags are found)
        Since:
        6.0
      • getSubBlock

        public SwiftTagListBlock getSubBlock​(java.lang.String blockName)
        Gets all tags of a specific sub block, searching for the first occurrence of the starting 16R field (with blockName as value) and its correspondent 16S field (with blockName as value).
        Parameters:
        blockName - block name, used for block
        Returns:
        a new block containing the found tags (the block can be empty if no tags are found)
        Since:
        6.0
        See Also:
        getSubBlock(Tag, Tag)
      • getSubBlock

        public SwiftTagListBlock getSubBlock​(Tag start,
                                             Tag end)
        Get all tags between the first occurrence of the starting Tag and the first occurrence of an optional ending Tag. If the ending Tag is null or not found after the starting Tag, it returns all tags until end of block. The starting and end tags are included in the resulting block.
        Parameters:
        start - starting tag
        end - ending tag or null
        Returns:
        a new block containing the found tags (the block can be empty if no tags are found)
        Since:
        6.0
      • getSubBlock

        public SwiftTagListBlock getSubBlock​(java.lang.Integer from,
                                             java.lang.Integer to)
        Creates a new block containing the list of tags between the given indexes: from, inclusive, and to, exclusive.
        Similar to the substring method of String, but for a list of Tag instead of an array of characters. For getting a 'view' only sublist use List.subList(int, int) For a new block containing both boundary elements included use sublist(Integer, Integer)
        Parameters:
        from - may be null in which case is equivalent to zero
        to - may be null or larger than the list size, in which case is equivalent to the index of the last available item.
        Returns:
        a new list with the tags found between given indexes in this tag list
        Throws:
        java.lang.IllegalArgumentException - if from is bigger than to.
        See Also:
        List.subList(int, int)
      • sublist

        public SwiftTagListBlock sublist​(java.lang.Integer start,
                                         java.lang.Integer end)
        Get a new list with the elements contained between start and end, both inclusive. Both start and end may be null. For a new block excluding the end index use getSubBlock(Integer, Integer)
        Parameters:
        start - start index, zero based. if null = zero
        end - last index, zero based, null means last element
      • getSubBlockAfterFirst

        public SwiftTagListBlock getSubBlockAfterFirst​(java.lang.String tagname,
                                                       boolean includeBoundaryInResult)
        Gets a subblock after the first tag with the given name.
        Creates a new SwiftTagListBlock that contains all tags after the first instance of a tag with the given tagname.
        Parameters:
        tagname - the tag that will be used for splitting (value is set to empty)
        includeBoundaryInResult - if true, the found boundary tag will be the first item in the returned block
        Returns:
        a new block with the trimmed content
      • getSubBlockAfterFirst

        public SwiftTagListBlock getSubBlockAfterFirst​(Tag tag,
                                                       boolean includeBoundaryInResult)
        Gets the subblock after the first instance of a given tag boundary.
        All elements after the first instance of the given tag will be included in the result. If the boundary tag is null or not found in the block, an empty block will be returned.
        Tag compare is done using Tag.equalsIgnoreCR(Tag) (not object references).
        Parameters:
        tag - the tag that will be used for splitting
        includeBoundaryInResult - if true, the found boundary tag will be the first item in the returned block
        Returns:
        a new block with the trimmed content
        Since:
        7.9.3
      • getSubBlockAfterLast

        public SwiftTagListBlock getSubBlockAfterLast​(java.lang.String tagname,
                                                      boolean includeBoundaryInResult)
        Gets the subblock after the last tag with the given name.
        All elements after the last instance of a tag with the given name will be included in the result. If the tag name is null or no tag with the given name is found in the block, an empty block will be returned.
        Parameters:
        tagname - the name of the tag that will be used for for splitting (value is set to empty)
        includeBoundaryInResult - if true, the found boundary tag will be the first item in the returned block
        Returns:
        a new block with the trimmed content
      • getSubBlockBeforeFirst

        public SwiftTagListBlock getSubBlockBeforeFirst​(java.lang.String tagname,
                                                        boolean includeBoundaryInResult)
        Gets the subblock before the first tag with the given tagname.
        Creates a new SwiftTagListBlock that contains all tags before the first instance of a tag with the given tagname.
        Parameters:
        tagname - the name of the tag that will be used for splitting (value is set to empty)
        includeBoundaryInResult - if true, the found boundary tag will be the last item in the returned block
        Returns:
        a new block with the trimmed content
      • getSubBlockBeforeFirst

        public SwiftTagListBlock getSubBlockBeforeFirst​(Tag tag,
                                                        boolean includeBoundaryInResult)
        Gets the subblock before the first tag with the given tagname.
        Creates a new SwiftTagListBlock that contains all tags before the first instance of a tag with the given tagname.
        Parameters:
        tag - the tag that will be used for splitting
        includeBoundaryInResult - if true, the found boundary tag will be the last item in the returned block
        Returns:
        a new block with the trimmed content
        Since:
        9.2.9
      • getSubBlockBeforeLast

        public SwiftTagListBlock getSubBlockBeforeLast​(java.lang.String tagname,
                                                       boolean includeBoundaryInResult)
        Gets the subblock with all tags until tha last tag with the given name
        Parameters:
        tagname - the name of the tag that will be used for splitting (value is set to empty)
        includeBoundaryInResult - if true, the found boundary tag will be the last item in the returned block
        Returns:
        the tags contained until the first instance of tagname
      • getTagIndex

        public java.lang.Integer getTagIndex​(java.lang.String startTagNumber,
                                             java.lang.String[] letterOptions)
        Get the index of the given tag in the list.
        Parameters:
        startTagNumber - the number of the tag, without any letter option
        letterOptions - list of letter options to search, an empty string is accepted to search no letter option
        Returns:
        the index inside the internal list of the given tag, null if the tag is not found
        Since:
        6.5
      • containsTag

        public boolean containsTag​(Tag t)
        Iterates the internal list of tags and returns true if there is at least one tag equals to the given one.
        Parameters:
        t - the tag to search in tags
        Returns:
        true if tag is found
        Since:
        6.0
      • splitByTagName

        public java.util.List<SwiftTagListBlock> splitByTagName​(java.lang.String tagName)
        Split the given list with the given tagname. Beware if the tagname is not found the entire list of tags is returned.
      • indexOfLast

        public int indexOfLast​(java.lang.String tagname)
        Get the index of the last tagname in the list or -1 if not found or any precondition is not met
        Returns:
        a 0-based index of the found tag or -1 if not found
      • indexOfLastValue

        public int indexOfLastValue​(java.lang.String tagname,
                                    java.lang.String value)
        Get the index of the last tagname with the given value in the list or -1 if not found or any precondition is not met
        Returns:
        a 0-based index of the found tag or -1 if not found
        Since:
        7.8
      • indexOfAnyLast

        public int indexOfAnyLast​(java.lang.String... tagnames)
        Get the index of the last of any tagnames in the list or -1 if not found or any precondition is not met.
        Parameters:
        tagnames - a variable list of tagnames to search. Exact match only, wildcards NOT accepted
        Returns:
        the zero based index of the last tag found with the given name or -1 if not found
      • indexOfAnyLastAfterIndex

        public int indexOfAnyLastAfterIndex​(int index,
                                            java.lang.String... tagnames)
        Get the index of the last of any tagnames after the given index in the list or -1 if not found or any precondition is not met
      • indexOfFirst

        public int indexOfFirst​(java.lang.String tagname)
        Gets the index of the first tag with the given name in this tag list
        Returns:
        a 0-based index of the found tag or -1 if not found
      • indexOfFirstValue

        public int indexOfFirstValue​(java.lang.String tagname,
                                     java.lang.String value)
        Gets the index of the first tag in this tag list, with the given name and value
        Parameters:
        tagname - the name of the tag to find
        value - the value of the tag to find
        Returns:
        a 0-based index of the found tag or -1 if not found
        Since:
        7.8
      • indexOfAnyFirst

        public int indexOfAnyFirst​(java.lang.String... tagnames)
        Gets the index of the first tag matching any of the given names
        Returns:
        a 0-based index of the found tag or -1 if not found
      • indexOfAnyFirstAfterIndex

        public int indexOfAnyFirstAfterIndex​(int index,
                                             java.lang.String... tagnames)
        Gets the index of the first tag matching any of the given names at or after the given index in the tag list
        Returns:
        a 0-based index of the found tag or -1 if not found
      • removeSubBlock

        public SwiftTagListBlock removeSubBlock​(java.lang.String blockName)
        Removes a sub block using fields 16R and 16S with the given block name as boundary.

        It searches for a starting 16R field (with blockName as value) and its correspondent 16S field (with blockName as value) as block boundaries and removes those fields from the result.

        If the searched block is not found (starting field 16R not present) the result will be just a copy from this block. If the end boundary is not found (ending field field 16S not present), trims all fields after the start boundary 16R.

        If several instances of the searched block are present, only the first one will be removed.

        The boundary fields 16R and 16S are also removed from the result.

        Parameters:
        blockName - block name, for example "SUBBAL" to search for 16R:SUBBAL and 16S:SUBBAL as boundaries
        Returns:
        a new block with the trimmed content
        Since:
        7.4
      • removeSubBlocks

        public SwiftTagListBlock removeSubBlocks​(java.lang.String blockName)
        Remove all sub blocks with the given name (using fields 16R and 16S as boundaries).

        The implementation is similar to removeSubBlock(String) but will remove all found instances of the sub block.

        Parameters:
        blockName - block name, for example "SUBBAL" to search for 16R:SUBBAL and 16S:SUBBAL as boundaries
        Returns:
        a new block with the trimmed content
        Since:
        7.10.3
        See Also:
        removeSubBlock(String)
      • containsAnyOf

        public boolean containsAnyOf​(java.lang.String... name)
        Tell if this block contains any of the given name tags. this is a shorthand for avoiding repeated calls to containsTag(String).
        Parameters:
        name - the list of tags to check, if null or empty this method will return false without further action
        Since:
        7.0
        See Also:
        containsTag(String), containsAllOf(String...)
      • containsAllOf

        public boolean containsAllOf​(java.lang.String... name)
        Tell if this block contains all of the given name tags. this is a shorthand for avoiding repeated calls to containsTag(String).
        Parameters:
        name - the list of tags to check, if null or empty this method will return false without further action
        Since:
        7.4
        See Also:
        containsTag(String), containsAnyOf(String...)
      • filterByName

        public SwiftTagListBlock filterByName​(boolean include,
                                              java.lang.String... names)
        Returns a new block that includes (true) or excludes (false), depending on includeOrExclude flag all tags with names matching any of the parameter names.
        Once a tagname is matched, it is removed from the list of tags to be matched, causing to be only included/excluded the first instance of every tagname.
        For example: 1, 2, 3, 4, 5, 6 filter by names 2, 4, 5 will return 1, 3, 6.
        Parameters:
        include - if true include all tags with given names, if false include all tags with a name not in names
        names - list of tagnames to match
        Returns:
        a new list, an empty list if empty message, preconditions not met or nothing found
        Since:
        7.2
      • filterByNameOrdered

        public SwiftTagListBlock filterByNameOrdered​(java.lang.String... names)
        Returns a new block that includes all tags with names matching any of the parameter names until a non matching tag is found.
        Once a tagname is matched, it is removed from the list of tags to be matched, causing to be only included/excluded the first instance of every tagname.
        For example: 1, 2, 3, 9, 4, 5, 6 filter by names 1, 2, 3, 4 will return 1, 2, 3.
        Parameters:
        names - list of tagnames to match
        Returns:
        a new list, an empty list if empty message, preconditions not met or nothing found
        Since:
        7.2
      • getSubBlocksDelimitedWithOptionalTail

        public java.util.List<SwiftTagListBlock> getSubBlocksDelimitedWithOptionalTail​(java.lang.String[] start,
                                                                                       java.lang.String[] end,
                                                                                       java.lang.String[] tail)
        Get all subblocks in message that start with tag with tagname, end with tag named endName and optionally, may be null, have optionalTail tag names at the end of the secuence
        Parameters:
        start - name of the tag that identifies the begin of the sequence
        end - name of the tag that identifies the end of the sequence
        tail - names of tags that are optional and belong to the sequence, the must be after endName
        Returns:
        an empty list if none found or prerequisites not met
      • getSubBlocksByTagNames

        public java.util.List<SwiftTagListBlock> getSubBlocksByTagNames​(java.lang.Integer startIndex,
                                                                        java.lang.String... searchTags)
        Similar to getSubBlockByTagNames(Integer, String...) but will return all matches for the indicated subblock.
        Returns:
        a list of found subblocks or empty if non matched
        Since:
        7.8.5
      • getSubBlockByTagNames

        public SwiftTagListBlock getSubBlockByTagNames​(java.lang.Integer startIndex,
                                                       java.lang.String... searchTags)
        Find a sub block given a comprehensive ordered list of search tag names.

        For example given the block [20, 21, 32A, 54, 36, 36, 58B, 72]

        • search tags [32A, 36, 72] will return the subblock [32A, 36, 36, 72] notice repetitions are returned
        • search tags [36, 32A, 72] will return the subblock [36, 36, 72] notice order in search is important
        • search tags [36, 99, 72] will return the subblock [36, 36, 72] notice partial match is also returned
        Parameters:
        startIndex - optional starting offset, defaults to zero to search from the beginning of the block
        searchTags - a list of tags to search, in order, for example: 20, 59A, 50K, 72
        Returns:
        a new block with the found tags or an empty block if search produces no matches
        Since:
        7.8.5
      • getSubBlockDelimitedWithOptionalTail

        public SwiftTagListBlock getSubBlockDelimitedWithOptionalTail​(java.lang.String[] start,
                                                                      java.lang.String[] end,
                                                                      java.lang.String[] tail)
        Get the first found sub block in message that start with tag with tag name, end with tag named endName and optionally, may be null, have optionalTail tag names at the end of the sequence
        Parameters:
        start - name of the tag that identifies the begin of the sequence
        end - name of the tag that identifies the end of the sequence
        tail - names of tags that are optional and belong to the sequence, the must be after endName
        Returns:
        the found block or null if prerequisites are not met
      • getOptionalList

        public SwiftTagListBlock getOptionalList​(java.lang.String[][] optionalTags,
                                                 int startAt)
        Search a sequence of optional tags. inside each row, only one is matched. stop conditions: a tag is not in the optional row being processed or any future row or there are no more rows
        Parameters:
        optionalTags - the rows of optional tags
        startAt - the starting index, zero-based
        Returns:
        a new block with the found fields
      • getOptionalLists

        public java.util.List<SwiftTagListBlock> getOptionalLists​(java.lang.String[][] optionalTags)
      • tagNamesList

        public java.util.List<java.lang.String> tagNamesList()
      • countTagsStarsWith

        public int countTagsStarsWith​(java.lang.String name,
                                      java.lang.String value)
        Counts tags starting with the given value
        Parameters:
        name - the exact name of the tag to be matched
        value - the value that will be used to test if tag value startsWith
        Returns:
        the count result
        See Also:
        Tag.startsWith(String)
      • removeAfterFirstStartsWith

        public SwiftTagListBlock removeAfterFirstStartsWith​(java.lang.String name,
                                                            java.lang.String startsWith)
        Return a new block with all tags until the first tagname with the given name that start with startsWith
        Parameters:
        name - a field name
        startsWith - the starting field content to search
        Returns:
        a new block with the trimmed content
      • toJson

        public java.lang.String toJson()
        Get a json representation of this block.

        Example:

         {
          "tags": [
          {
          "name": "113",
          "value": "SEPA"
          },
          {
          "name": "20",
          "value": "REFERENCE"
          }
          ]
         }
          
        Returns:
        a string with the message content serialized as JSON
        Since:
        7.9.8
      • append

        public SwiftTagListBlock append​(SwiftTagListBlock block)
        Appends all tags in block to the contents of this block
        Parameters:
        block - a block to append
        Returns:
        the current instance
      • append

        public SwiftTagListBlock append​(SwiftTagListBlock... blocks)
        Appends all blocks to the end of this one.
        Parameters:
        blocks - may be null or empty, if so nothing happens
        Returns:
        the current updated list
        Since:
        7.8
      • append

        public SwiftTagListBlock append​(Tag tag)
        Add the given tag to the end of the list
        Parameters:
        tag - the tag to add, must not be null
        Returns:
        this
        Throws:
        java.lang.IllegalArgumentException - if tag is null
        Since:
        7.7
      • append

        public SwiftTagListBlock append​(Tag... tags)
        Appends all tags to the current block
        Parameters:
        tags - the tags to append. may be null in which case nothing happens
        Returns:
        this
        Since:
        7.8
      • append

        public SwiftTagListBlock append​(Field field)
        Add the given field to the end of the list. The Field components are serialized into a plain value usign the getValue implementation of the Field object, and this created value is use for the internal Tag actually set into the block.
        Parameters:
        field - the field to add, must not be null
        Returns:
        this
        Throws:
        java.lang.IllegalArgumentException - if field is null
        Since:
        7.7
      • append

        public SwiftTagListBlock append​(Field... fields)
        Appends all fields to the current block
        Parameters:
        fields - the fields to append. may be null in which case nothing happens
        Returns:
        this
        Since:
        7.8
      • iterator

        public java.util.Iterator<Tag> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<Tag>
      • asTagArray

        public Tag[] asTagArray()
        Get the content of this tag block as a Tag array. Returns an empty array if this list is empty.
        Returns:
        this block taqs objects as array
        Since:
        7.8
      • clear

        public SwiftTagListBlock clear()
        Removes all tags from the backing storage.
        Returns:
        this
        Since:
        7.8
      • getName

        public java.lang.String getName()
        Description copied from class: SwiftBlock
        Returns the block name (this method is to be overwritten for derived classes).
        Specified by:
        getName in class SwiftBlock
        Returns:
        block name
      • getNumber

        public java.lang.Integer getNumber()
        Description copied from class: SwiftBlock
        Returns the block number (this method is to be overwritten for derived classes).
        Specified by:
        getNumber in class SwiftBlock
        Returns:
        Integer containing the block's number
      • setBlockName

        protected void setBlockName​(java.lang.String blockName)
        Description copied from class: SwiftBlock
        Sets the block name (this method is to be overwrite for derived classes).
        Specified by:
        setBlockName in class SwiftBlock
        Parameters:
        blockName - the block name to set
      • setBlockNumber

        protected void setBlockNumber​(java.lang.Integer blockNumber)
        Description copied from class: SwiftBlock
        Sets the block number (this method is to be overwrite for derived classes).
        Specified by:
        setBlockNumber in class SwiftBlock
        Parameters:
        blockNumber - the block number to set
      • visit

        public void visit​(TagVisitor visitor)
      • fields

        public java.util.List<Field> fields()
        Return the list of fields in this block.

        THe implementation iterates the existing Tag objects and for each calls the Tag.asField() method to create the corresponding Field instance

        Returns:
        a list of fields in this block or an empty list if the block is empty
        Since:
        7.10.4
      • splitByTagName

        public java.util.List<SwiftTagListBlock> splitByTagName​(int tagNumber,
                                                                java.lang.String letterOption)
        Helper method to retrieve all sequences starting with the parameter field. The boundary field can be indicated with or without the letter option. For example if number 15 is passed with null letter option, this is like splitting by 15a (15A, 15B, 15C, etc..), each time a field 15 is found a new split is done regardless of the letter option. Converselly if a specific letter option is passed, the split is done when that particular number and letter combination is found. If the boundary field is nor present, the result will be empty.
        Parameters:
        tagNumber - the tag number
        letterOption - optional letter option, if null, split is done by tag number for any letter option
        Returns:
        found subsequences or an empty list if boundary tag is not found
        Since:
        7.10.4