Class SwiftTagListBlock
- java.lang.Object
-
- com.prowidesoftware.swift.model.SwiftBlock
-
- com.prowidesoftware.swift.model.SwiftTagListBlock
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<Tag>
- Direct Known Subclasses:
MT101.SequenceA
,MT101.SequenceB
,MT102_STP.SequenceA
,MT102_STP.SequenceB
,MT102_STP.SequenceC
,MT102.SequenceA
,MT102.SequenceB
,MT102.SequenceC
,MT104.SequenceA
,MT104.SequenceB
,MT104.SequenceC
,MT107.SequenceA
,MT107.SequenceB
,MT107.SequenceC
,MT110.Loop1
,MT201.Loop1
,MT202COV.SequenceA
,MT202COV.SequenceB
,MT203.Loop1
,MT203.SequenceA
,MT204.SequenceA
,MT204.SequenceB
,MT205COV.SequenceA
,MT205COV.SequenceB
,MT210.Loop1
,MT210.SequenceA
,MT300.SequenceA
,MT300.SequenceB
,MT300.SequenceB1
,MT300.SequenceB2
,MT300.SequenceC
,MT300.SequenceD
,MT300.SequenceD1
,MT300.SequenceE
,MT300.SequenceE1
,MT300.SequenceE1a
,MT300.SequenceE1a1
,MT300.SequenceF
,MT304.SequenceA
,MT304.SequenceB
,MT304.SequenceB1
,MT304.SequenceB2
,MT304.SequenceC
,MT304.SequenceC1
,MT304.SequenceC1a
,MT304.SequenceD
,MT304.SequenceE
,MT305.SequenceA
,MT305.SequenceB
,MT305.SequenceB1
,MT305.SequenceB1a
,MT305.SequenceB1a1
,MT306.SequenceA
,MT306.SequenceB
,MT306.SequenceC
,MT306.SequenceD
,MT306.SequenceE
,MT306.SequenceF
,MT306.SequenceF1
,MT306.SequenceG
,MT306.SequenceH
,MT306.SequenceI
,MT306.SequenceJ
,MT306.SequenceK
,MT306.SequenceL
,MT306.SequenceM
,MT306.SequenceM1
,MT306.SequenceM1a
,MT306.SequenceM1a1
,MT320.SequenceA
,MT320.SequenceB
,MT320.SequenceC
,MT320.SequenceD
,MT320.SequenceE
,MT320.SequenceF
,MT320.SequenceG
,MT320.SequenceH
,MT320.SequenceI
,MT321.SequenceA
,MT321.SequenceA1
,MT321.SequenceB
,MT321.SequenceB1
,MT321.SequenceB2
,MT321.SequenceB3
,MT321.SequenceC
,MT321.SequenceC1
,MT330.SequenceA
,MT330.SequenceB
,MT330.SequenceC
,MT330.SequenceD
,MT330.SequenceE
,MT330.SequenceF
,MT330.SequenceG
,MT330.SequenceH
,MT340.SequenceA
,MT340.SequenceB
,MT340.SequenceB1
,MT340.SequenceB2
,MT340.SequenceC
,MT340.SequenceD
,MT340.SequenceE
,MT340.SequenceF
,MT340.SequenceG
,MT340.SequenceG1
,MT340.SequenceG1a
,MT340.SequenceG1a1
,MT341.SequenceA
,MT341.SequenceB
,MT341.SequenceC
,MT341.SequenceD
,MT341.SequenceD1
,MT341.SequenceD1a
,MT341.SequenceD1a1
,MT350.SequenceA
,MT350.SequenceB
,MT350.SequenceC
,MT350.SequenceD
,MT350.SequenceD1
,MT360.SequenceA
,MT360.SequenceB
,MT360.SequenceB1
,MT360.SequenceC
,MT360.SequenceC1
,MT360.SequenceC2
,MT360.SequenceD
,MT360.SequenceE
,MT360.SequenceE1
,MT360.SequenceF
,MT360.SequenceF1
,MT360.SequenceF2
,MT360.SequenceG
,MT360.SequenceH
,MT360.SequenceL
,MT360.SequenceM
,MT360.SequenceN
,MT360.SequenceO
,MT360.SequenceO1
,MT360.SequenceO1a
,MT360.SequenceO1a1
,MT361.SequenceA
,MT361.SequenceB
,MT361.SequenceB1
,MT361.SequenceC
,MT361.SequenceC1
,MT361.SequenceC2
,MT361.SequenceD
,MT361.SequenceE
,MT361.SequenceE1
,MT361.SequenceF
,MT361.SequenceF1
,MT361.SequenceF2
,MT361.SequenceG
,MT361.SequenceH
,MT361.SequenceI
,MT361.SequenceJ
,MT361.SequenceK
,MT361.SequenceL
,MT361.SequenceM
,MT361.SequenceN
,MT361.SequenceO
,MT361.SequenceP
,MT361.SequenceP1
,MT361.SequenceP1a
,MT361.SequenceP1a1
,MT362.SequenceA
,MT362.SequenceB
,MT362.SequenceC
,MT362.SequenceD
,MT362.SequenceE
,MT364.SequenceA
,MT364.SequenceB
,MT364.SequenceE
,MT364.SequenceL
,MT364.SequenceM
,MT365.SequenceA
,MT365.SequenceB
,MT365.SequenceE
,MT365.SequenceJ
,MT365.SequenceK
,MT365.SequenceL
,MT365.SequenceM
,MT370.SequenceA
,MT370.SequenceA1
,MT370.SequenceA2
,MT370.SequenceB
,MT370.SequenceB1
,MT380.SequenceA
,MT380.SequenceA1
,MT380.SequenceB
,MT380.SequenceB1
,MT380.SequenceB2
,MT380.SequenceC
,MT381.SequenceA
,MT381.SequenceA1
,MT381.SequenceB
,MT381.SequenceB1
,MT381.SequenceB2
,MT381.SequenceC
,MT410.Loop1
,MT412.Loop1
,MT416.SequenceA
,MT416.SequenceB
,MT420.Loop1
,MT422.Loop1
,MT430.SequenceA
,MT430.SequenceB
,MT450.Loop1
,MT456.Loop1
,MT500.SequenceA
,MT500.SequenceA1
,MT500.SequenceB
,MT500.SequenceB1
,MT500.SequenceB2
,MT500.SequenceC
,MT500.SequenceC1
,MT500.SequenceC2
,MT500.SequenceD
,MT500.SequenceE
,MT501.SequenceA
,MT501.SequenceA1
,MT501.SequenceB
,MT501.SequenceB1
,MT501.SequenceB2
,MT501.SequenceC
,MT501.SequenceC1
,MT501.SequenceC2
,MT501.SequenceD
,MT501.SequenceE
,MT502.SequenceA
,MT502.SequenceA1
,MT502.SequenceB
,MT502.SequenceB1
,MT502.SequenceB2
,MT502.SequenceB3
,MT502.SequenceC
,MT502.SequenceC1
,MT502.SequenceC2
,MT502.SequenceC3
,MT502.SequenceD
,MT502.SequenceE
,MT503.SequenceA
,MT503.SequenceA1
,MT503.SequenceA2
,MT503.SequenceB
,MT503.SequenceB1
,MT503.SequenceC
,MT503.SequenceC1
,MT503.SequenceC2
,MT503.SequenceC3
,MT503.SequenceD
,MT504.SequenceA
,MT504.SequenceA1
,MT504.SequenceA2
,MT504.SequenceB
,MT504.SequenceB1
,MT504.SequenceC
,MT504.SequenceC1
,MT504.SequenceC1a
,MT504.SequenceC1a1
,MT504.SequenceC2
,MT504.SequenceC2a
,MT504.SequenceC2a1
,MT504.SequenceC3
,MT504.SequenceD
,MT504.SequenceD1
,MT504.SequenceE
,MT504.SequenceE1
,MT504.SequenceF
,MT505.SequenceA
,MT505.SequenceA1
,MT505.SequenceA2
,MT505.SequenceB
,MT505.SequenceB1
,MT505.SequenceB1a
,MT505.SequenceB1a1
,MT505.SequenceB2
,MT505.SequenceB2a
,MT505.SequenceB2a1
,MT505.SequenceB3
,MT505.SequenceC
,MT505.SequenceC1
,MT505.SequenceD
,MT505.SequenceD1
,MT505.SequenceE
,MT506.SequenceA
,MT506.SequenceA1
,MT506.SequenceA2
,MT506.SequenceB
,MT506.SequenceB1
,MT506.SequenceC
,MT506.SequenceC1
,MT506.SequenceC2
,MT506.SequenceC3
,MT506.SequenceD
,MT506.SequenceD1
,MT506.SequenceD2
,MT506.SequenceD3
,MT506.SequenceE
,MT507.SequenceA
,MT507.SequenceA1
,MT507.SequenceA2
,MT507.SequenceB
,MT507.SequenceB1
,MT507.SequenceB1a
,MT507.SequenceB1a1
,MT507.SequenceB1b
,MT507.SequenceB1b1
,MT507.SequenceC
,MT508.SequenceA
,MT508.SequenceA1
,MT508.SequenceB
,MT508.SequenceB1
,MT508.SequenceC
,MT509.SequenceA
,MT509.SequenceA1
,MT509.SequenceA2
,MT509.SequenceA2a
,MT509.SequenceB
,MT509.SequenceB1
,MT509.SequenceC
,MT510.SequenceA
,MT510.SequenceA1
,MT510.SequenceA2
,MT510.SequenceA2a
,MT510.SequenceB
,MT510.SequenceC
,MT513.SequenceA
,MT513.SequenceA1
,MT513.SequenceB
,MT513.SequenceB1
,MT513.SequenceC
,MT513.SequenceC1
,MT513.SequenceC2
,MT513.SequenceC3
,MT513.SequenceD
,MT513.SequenceD1
,MT513.SequenceD2
,MT513.SequenceD3
,MT513.SequenceE
,MT513.SequenceF
,MT514.SequenceA
,MT514.SequenceA1
,MT514.SequenceB
,MT514.SequenceB1
,MT514.SequenceB2
,MT514.SequenceC
,MT514.SequenceC1
,MT514.SequenceC2
,MT514.SequenceC3
,MT514.SequenceD
,MT514.SequenceE
,MT515.SequenceA
,MT515.SequenceA1
,MT515.SequenceB
,MT515.SequenceC
,MT515.SequenceC1
,MT515.SequenceC2
,MT515.SequenceD
,MT515.SequenceD1
,MT515.SequenceD2
,MT515.SequenceD3
,MT515.SequenceE
,MT515.SequenceF
,MT516.SequenceA
,MT517.SequenceA
,MT517.SequenceA1
,MT518.SequenceA
,MT518.SequenceA1
,MT518.SequenceB
,MT518.SequenceB1
,MT518.SequenceB2
,MT518.SequenceC
,MT518.SequenceC1
,MT518.SequenceC2
,MT518.SequenceC3
,MT518.SequenceD
,MT518.SequenceE
,MT519.SequenceA
,MT519.SequenceA1
,MT519.SequenceB
,MT519.SequenceB1
,MT519.SequenceB2
,MT519.SequenceC
,MT519.SequenceC1
,MT519.SequenceC2
,MT519.SequenceD
,MT524.SequenceA
,MT524.SequenceA1
,MT524.SequenceB
,MT524.SequenceB1
,MT524.SequenceC
,MT526.SequenceA
,MT526.SequenceB
,MT527.SequenceA
,MT527.SequenceA1
,MT527.SequenceA2
,MT527.SequenceB
,MT527.SequenceB1
,MT527.SequenceC
,MT527.SequenceD
,MT527.SequenceE
,MT530.SequenceA
,MT530.SequenceB
,MT530.SequenceB1
,MT530.SequenceC
,MT530.SequenceC1
,MT530.SequenceC1a
,MT535.SequenceA
,MT535.SequenceA1
,MT535.SequenceB
,MT535.SequenceB1
,MT535.SequenceB1a
,MT535.SequenceB1b
,MT535.SequenceB1b1
,MT535.SequenceB1c
,MT535.SequenceC
,MT536.SequenceA
,MT536.SequenceA1
,MT536.SequenceB
,MT536.SequenceB1
,MT536.SequenceB1a
,MT536.SequenceB1a1
,MT536.SequenceB1a2
,MT536.SequenceB1a2A
,MT536.SequenceC
,MT537.SequenceA
,MT537.SequenceA1
,MT537.SequenceB
,MT537.SequenceB1
,MT537.SequenceB2
,MT537.SequenceB2a
,MT537.SequenceB2b
,MT537.SequenceB2b1
,MT537.SequenceC
,MT537.SequenceC1
,MT537.SequenceC2
,MT537.SequenceC2a
,MT537.SequenceC3
,MT537.SequenceC3a
,MT537.SequenceD
,MT537.SequenceD1
,MT537.SequenceD1a
,MT537.SequenceD1a1
,MT537.SequenceD1a1A
,MT537.SequenceD1a1A1
,MT537.SequenceD1a1B
,MT537.SequenceD1a1B1
,MT537.SequenceD1a1B1a
,MT537.SequenceD1a1B1a1
,MT537.SequenceE
,MT538.SequenceA
,MT538.SequenceA1
,MT538.SequenceB
,MT538.SequenceB1
,MT538.SequenceB2
,MT538.SequenceB2a
,MT538.SequenceB2a1
,MT538.SequenceC
,MT540.SequenceA
,MT540.SequenceA1
,MT540.SequenceB
,MT540.SequenceB1
,MT540.SequenceC
,MT540.SequenceC1
,MT540.SequenceD
,MT540.SequenceE
,MT540.SequenceE1
,MT540.SequenceE2
,MT540.SequenceE3
,MT540.SequenceF
,MT541.SequenceA
,MT541.SequenceA1
,MT541.SequenceB
,MT541.SequenceB1
,MT541.SequenceC
,MT541.SequenceC1
,MT541.SequenceD
,MT541.SequenceE
,MT541.SequenceE1
,MT541.SequenceE2
,MT541.SequenceE3
,MT541.SequenceF
,MT542.SequenceA
,MT542.SequenceA1
,MT542.SequenceB
,MT542.SequenceB1
,MT542.SequenceC
,MT542.SequenceC1
,MT542.SequenceD
,MT542.SequenceE
,MT542.SequenceE1
,MT542.SequenceE2
,MT542.SequenceE3
,MT542.SequenceF
,MT543.SequenceA
,MT543.SequenceA1
,MT543.SequenceB
,MT543.SequenceB1
,MT543.SequenceC
,MT543.SequenceC1
,MT543.SequenceD
,MT543.SequenceE
,MT543.SequenceE1
,MT543.SequenceE2
,MT543.SequenceE3
,MT543.SequenceF
,MT544.SequenceA
,MT544.SequenceA1
,MT544.SequenceB
,MT544.SequenceB1
,MT544.SequenceC
,MT544.SequenceC1
,MT544.SequenceD
,MT544.SequenceE
,MT544.SequenceE1
,MT544.SequenceE2
,MT544.SequenceE3
,MT544.SequenceF
,MT545.SequenceA
,MT545.SequenceA1
,MT545.SequenceB
,MT545.SequenceB1
,MT545.SequenceC
,MT545.SequenceC1
,MT545.SequenceD
,MT545.SequenceE
,MT545.SequenceE1
,MT545.SequenceE2
,MT545.SequenceE3
,MT545.SequenceF
,MT546.SequenceA
,MT546.SequenceA1
,MT546.SequenceB
,MT546.SequenceB1
,MT546.SequenceC
,MT546.SequenceC1
,MT546.SequenceD
,MT546.SequenceE
,MT546.SequenceE1
,MT546.SequenceE2
,MT546.SequenceE3
,MT546.SequenceF
,MT547.SequenceA
,MT547.SequenceA1
,MT547.SequenceB
,MT547.SequenceB1
,MT547.SequenceC
,MT547.SequenceC1
,MT547.SequenceD
,MT547.SequenceE
,MT547.SequenceE1
,MT547.SequenceE2
,MT547.SequenceE3
,MT547.SequenceF
,MT548.SequenceA
,MT548.SequenceA1
,MT548.SequenceA2
,MT548.SequenceA2a
,MT548.SequenceB
,MT548.SequenceB1
,MT548.SequenceC
,MT548.SequenceC1
,MT548.SequenceC1a
,MT548.SequenceC1a1
,MT548.SequenceC1a1A
,MT548.SequenceC1a1A1
,MT548.SequenceC1a1B
,MT548.SequenceC1a1B1
,MT548.SequenceC1a1B1a
,MT548.SequenceC1a1B1a1
,MT548.SequenceD
,MT549.SequenceA
,MT549.SequenceA1
,MT549.SequenceB
,MT549.SequenceC
,MT549.SequenceD
,MT558.SequenceA
,MT558.SequenceA1
,MT558.SequenceA2
,MT558.SequenceA2a
,MT558.SequenceA3
,MT558.SequenceB
,MT558.SequenceB1
,MT558.SequenceC
,MT558.SequenceD
,MT558.SequenceE
,MT564.SequenceA
,MT564.SequenceA1
,MT564.SequenceB
,MT564.SequenceB1
,MT564.SequenceB2
,MT564.SequenceC
,MT564.SequenceD
,MT564.SequenceE
,MT564.SequenceE1
,MT564.SequenceE1a
,MT564.SequenceE2
,MT564.SequenceF
,MT565.SequenceA
,MT565.SequenceA1
,MT565.SequenceB
,MT565.SequenceB1
,MT565.SequenceB2
,MT565.SequenceC
,MT565.SequenceD
,MT565.SequenceE
,MT566.SequenceA
,MT566.SequenceA1
,MT566.SequenceB
,MT566.SequenceB1
,MT566.SequenceC
,MT566.SequenceD
,MT566.SequenceD1
,MT566.SequenceD1a
,MT566.SequenceD1b
,MT566.SequenceD2
,MT566.SequenceD2a
,MT566.SequenceD2b
,MT566.SequenceE
,MT567.SequenceA
,MT567.SequenceA1
,MT567.SequenceA2
,MT567.SequenceA2a
,MT567.SequenceB
,MT567.SequenceC
,MT568.SequenceA
,MT568.SequenceA1
,MT568.SequenceB
,MT568.SequenceB1
,MT568.SequenceC
,MT569.SequenceA
,MT569.SequenceA1
,MT569.SequenceA2
,MT569.SequenceB
,MT569.SequenceC
,MT569.SequenceC1
,MT569.SequenceC1a
,MT569.SequenceC1a1
,MT569.SequenceC1a1A
,MT569.SequenceD
,MT575.SequenceA
,MT575.SequenceA1
,MT575.SequenceB
,MT575.SequenceB1
,MT575.SequenceB1a
,MT575.SequenceB1a1
,MT575.SequenceB1a2
,MT575.SequenceB1a3
,MT575.SequenceB1a4
,MT575.SequenceC
,MT575.SequenceC1
,MT575.SequenceC2
,MT575.SequenceC2a
,MT575.SequenceD
,MT576.SequenceA
,MT576.SequenceA1
,MT576.SequenceB
,MT576.SequenceB1
,MT576.SequenceB2
,MT576.SequenceB2a
,MT576.SequenceB2b
,MT576.SequenceB2c
,MT576.SequenceC
,MT578.SequenceA
,MT578.SequenceA1
,MT578.SequenceB
,MT578.SequenceB1
,MT578.SequenceC
,MT578.SequenceC1
,MT578.SequenceD
,MT578.SequenceE
,MT578.SequenceE1
,MT578.SequenceE2
,MT578.SequenceE3
,MT578.SequenceF
,MT586.SequenceA
,MT586.SequenceA1
,MT586.SequenceB
,MT586.SequenceB1
,MT586.SequenceB2
,MT586.SequenceB3
,MT586.SequenceB4
,MT586.SequenceB4a
,MT586.SequenceB5
,MT586.SequenceB6
,MT586.SequenceB6a
,MT586.SequenceB6b
,MT586.SequenceC
,MT600.SequenceA
,MT600.SequenceB
,MT600.SequenceC
,MT600.SequenceD
,MT600.SequenceD1
,MT600.SequenceD1a
,MT600.SequenceD1a1
,MT601.SequenceA
,MT601.SequenceB
,MT601.SequenceB1
,MT601.SequenceB1a
,MT601.SequenceB1a1
,MT604.Loop1
,MT605.Loop1
,MT620.SequenceA
,MT620.SequenceB
,MT620.SequenceC
,MT620.SequenceD
,MT620.SequenceE
,MT620.SequenceF
,MT620.SequenceG
,MT620.SequenceG1
,MT620.SequenceH
,MT670.SequenceA
,MT670.SequenceA1
,MT670.SequenceA2
,MT670.SequenceB
,MT670.SequenceB1
,MT670.SequenceB2
,MT670.SequenceC
,MT671.SequenceA
,MT671.SequenceA1
,MT671.SequenceB
,MT671.SequenceB1
,MT671.SequenceB2
,MT671.SequenceC
,MT760.SequenceA
,MT760.SequenceB
,MT760.SequenceC
,MT767.SequenceA
,MT767.SequenceB
,MT767.SequenceC
,MT801.Loop1
,MT801.Loop2
,MT920.Loop1
,MT973.Loop1
,SwiftBlock3
,SwiftBlock4
,SwiftBlock5
,SwiftBlockUser
public class SwiftTagListBlock extends SwiftBlock implements java.io.Serializable, java.lang.Iterable<Tag>
Base class for SWIFT blocks that contain and arbitrary set of fields (3, 4, 5 and user blocks).
Specific block classes for each block should be instantiated.- Since:
- 4.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static SwiftTagListBlock
EMPTY_LIST
Immutableempty instance of this class.-
Fields inherited from class com.prowidesoftware.swift.model.SwiftBlock
blockType, input, output, unparsedTexts
-
-
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 blockSwiftTagListBlock
append(SwiftTagListBlock block)
Appends all tags in block to the contents of this blockSwiftTagListBlock
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 listSwiftTagListBlock
append(Tag... tags)
Appends all tags to the current blockTag[]
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 nameboolean
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 taglistint
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 valueboolean
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 onincludeOrExclude
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 togetTag(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//QCASField
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/QCASField[]
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 nameSwiftTagListBlock
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 sequencejava.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 togetSubBlockByTagNames(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 secuenceTag
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 XDTETag[]
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//20090818java.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 namesint
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 listint
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 metint
indexOfFirst(java.lang.String tagname)
Gets the index of the first tag with the given name in this tag listint
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 valueint
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 metint
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 metboolean
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 startsWithint
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 stringvoid
visit(TagVisitor visitor)
-
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
-
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//20090818For 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 XDTEFor 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 50BcomponentValue
- 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 50BcomponentValue
- 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 50BcomponentValue
- 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 togetTag(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 50Bcomponent1
- the expected value for the component 1 of the matched fieldcomponent2
- 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 50Bqualifier
- the expected value for the component 1 of the matched fieldconditionalQualifier
- 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 searchcomponentValue
- 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 classSwiftBlock
-
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 tagscontainsTag(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 addindex
- index at which the specified tag is to be inserted (zero based)- Throws:
java.lang.IllegalArgumentException
- if parameter name is nulljava.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 nulljava.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 classSwiftBlock
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classSwiftBlock
-
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 usingTag.equalsIgnoreCR(Tag)
(not object references).- Parameters:
start
- starting tagend
- 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 nameendTagName
- 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 optionendTagNumber
- 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 nameendTagNumber
- 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 optionendTagName
- 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 nameendTagName
- 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 tagend
- 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 useList.subList(int, int)
For a new block containing both boundary elements included usesublist(Integer, Integer)
- Parameters:
from
- may be null in which case is equivalent to zeroto
- 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 usegetSubBlock(Integer, Integer)
- Parameters:
start
- start index, zero based. if null = zeroend
- 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 newSwiftTagListBlock
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 usingTag.equalsIgnoreCR(Tag)
(not object references).- Parameters:
tag
- the tag that will be used for splittingincludeBoundaryInResult
- 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 newSwiftTagListBlock
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 newSwiftTagListBlock
that contains all tags before the first instance of a tag with the given tagname.- Parameters:
tag
- the tag that will be used for splittingincludeBoundaryInResult
- 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 optionletterOptions
- 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 findvalue
- 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 tocontainsTag(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 tocontainsTag(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 onincludeOrExclude
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 namesnames
- 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 sequenceend
- name of the tag that identifies the end of the sequencetail
- 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 togetSubBlockByTagNames(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 blocksearchTags
- 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 sequenceend
- name of the tag that identifies the end of the sequencetail
- 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)
- Parameters:
optionalTags
- the rows of optional tags- Returns:
- a new block with the found fields
- See Also:
getOptionalList(String[][], int)
-
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 tagsstartAt
- 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 matchedvalue
- 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 namestartsWith
- 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 interfacejava.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 classSwiftBlock
- 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 classSwiftBlock
- 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 classSwiftBlock
- 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 classSwiftBlock
- 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 numberletterOption
- 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
-
-