Package com.prowidesoftware.swift.model
Class SwiftValueBlock
- java.lang.Object
-
- com.prowidesoftware.swift.model.SwiftBlock
-
- com.prowidesoftware.swift.model.SwiftValueBlock
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
SwiftBlock1
,SwiftBlock2
public abstract class SwiftValueBlock extends SwiftBlock implements java.io.Serializable
Base class for SWIFT blocks that contain its fields concatenated as a single fixed length value; blocks 1 and 2.
This is an abstract class so specific block classes for each block should be instantiated.- Since:
- 4.0
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.prowidesoftware.swift.model.SwiftBlock
blockType, input, output, unparsedTexts
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SwiftValueBlock()
Default constructor, shouldn't be used normally.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getBlockValue()
This method should be overwritten by subclasses, calling this method will throw ajava.lang.UnsupportedOperationException
java.lang.String
getValue()
This method should be overwritten by subclasses, calling this method will throw ajava.lang.UnsupportedOperationException
protected java.lang.String
getValuePart(java.lang.String value, int start)
Returns a fragment of the block value received from a starting index until the end of value (or null if value is not large enough).protected java.lang.String
getValuePart(java.lang.String value, int start, int size)
returns a fragment of the block value received (or null if value is not large enough).
This method is used in derived classes to get value fragments.boolean
isEmpty()
Tells if the block contains at least one field.void
setBlockValue(java.lang.String value)
This method should be overwritten by subclasses, calling this method will throw ajava.lang.UnsupportedOperationException
void
setValue(java.lang.String value)
This method should be overwritten by subclasses and proper parsing be done to set specific values of the block, calling this method will throw ajava.lang.UnsupportedOperationException
int
size()
Tells the block's string value size (in chars).
NOTICE this does not return the actual number of fields set because value blocks are mostly fixed length.-
Methods inherited from class com.prowidesoftware.swift.model.SwiftBlock
equals, getBlockType, getInput, getName, getNumber, getOutput, getUnparsedTexts, getUnparsedTextsSize, hashCode, isTagBlock, setBlockName, setBlockNumber, setBlockType, setInput, setOutput, setUnparsedTexts, toString, unparsedTextAddText, unparsedTextAddText, unparsedTextGetAsMessage, unparsedTextGetText, unparsedTextIsMessage, unparsedTextVerify
-
-
-
-
Method Detail
-
getBlockValue
public java.lang.String getBlockValue()
This method should be overwritten by subclasses, calling this method will throw ajava.lang.UnsupportedOperationException
- Returns:
- N/A
-
setBlockValue
public void setBlockValue(java.lang.String value)
This method should be overwritten by subclasses, calling this method will throw ajava.lang.UnsupportedOperationException
- Parameters:
value
- unused
-
getValue
public java.lang.String getValue()
This method should be overwritten by subclasses, calling this method will throw ajava.lang.UnsupportedOperationException
- Returns:
- the blocks value as a single string
-
setValue
public void setValue(java.lang.String value)
This method should be overwritten by subclasses and proper parsing be done to set specific values of the block, calling this method will throw ajava.lang.UnsupportedOperationException
- Parameters:
value
- the blocks value as a single string
-
isEmpty
public boolean isEmpty()
Tells if the block contains at least one field. This method must be called on specific subclasses, calling it for SwiftValueBlock will throw ajava.lang.UnsupportedOperationException
- Returns:
true
if getValue returns a non null object
-
size
public int size()
Tells the block's string value size (in chars).
NOTICE this does not return the actual number of fields set because value blocks are mostly fixed length. This method must be called on specific subclasses, calling it for SwiftValueBlock will throw ajava.lang.UnsupportedOperationException
- Returns:
- the size of the value or zero if value is null
-
getValuePart
protected java.lang.String getValuePart(java.lang.String value, int start, int size)
returns a fragment of the block value received (or null if value is not large enough).
This method is used in derived classes to get value fragments.- Parameters:
value
- the full block valuestart
- the starting point of the fragment in the big block valuesize
- the fragment size- Returns:
- the value fragment or null if value is not large enough
-
getValuePart
protected java.lang.String getValuePart(java.lang.String value, int start)
Returns a fragment of the block value received from a starting index until the end of value (or null if value is not large enough).
This method is used in derived classes to get value fragments.
- Parameters:
value
- the full block valuestart
- the starting point of the fragment in the big block value- Returns:
- the value fragment or null if value is not large enough
- Since:
- 7.7
-
-