Class StructuredNarrative


  • public class StructuredNarrative
    extends java.lang.Object
    Simple POJO for portions of structured text in narrative containers.

    The structured narrative consist of a codeword or instruction plus additional content. This additional content is normally the actual narrative text but for some fields can include a currency and amount or a country code.

    This model is intended to be a generic container for any type of structured narrative, for any narrative container field. When a component (currency, amount, country or supplement) does not apply to a field, it will be simply set to null by the parser.

    To create this structure see Narrative.builder(int)

    Since:
    9.0.1
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.math.BigDecimal getAmount()
      In fields such as 73A, 71D, 71B and 73 the amount (along the currency) can be present as the first part of the narrative content.
      java.lang.String getBankCode()
      In SCORE messages, in field 71B, there is a bank code within the codeword with a slash separator (i.e.
      java.lang.String getCodeword()
      The codeword is a mandatory keyword to identify this particular narrative content in a narrative field value.
      java.lang.String getCountry()
      In fields such as 77B a two letters country code can be present as the first part of the narrative content.
      java.lang.String getCurrency()
      In fields 73A, 71D, 71B and 73 the currency can be present as the first part of the narrative content along an amount.
      java.lang.String getNarrative()
      Gets this narrative content as a single String, meaning if the narrative was wrapped in lines this method will return the joined lines without separator.
      java.lang.String getNarrative​(java.lang.String delimiter)
      Gets this narrative content as a single String, meaning if the narrative was wrapped in lines this method will return the joined lines.
      java.util.List<java.lang.String> getNarrativeFragments()
      Returns the list of text fragments in the narrative, fragments are segments of the text that is wrapped in lines.
      java.lang.String getNarrativeSupplement()
      Gets this narrative supplement content as a single String, meaning if the text was wrapped in lines this method will return the joined lines without separator.
      java.lang.String getNarrativeSupplement​(java.lang.String delimiter)
      Gets this narrative supplement content as a single String, meaning if the text was wrapped in lines this method will return the joined lines.
      java.util.List<java.lang.String> getNarrativeSupplementFragments()
      In fields such as 75 or 76 the narrative can be split into a first text along an optional second supplement.
      boolean isEmpty()  
      void setBankCode​(java.lang.String bankCode)
      boolean valid()
      Basic validation to check the codeword is present and at least one of the other fields is present
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StructuredNarrative

        public StructuredNarrative()
    • Method Detail

      • getCodeword

        public java.lang.String getCodeword()
        The codeword is a mandatory keyword to identify this particular narrative content in a narrative field value. For most fields it consists of uppercase letters only but for some fields it can be alphanumeric or numbers only. The allowed codewords per field are defined in the standard or agreed between parties.
      • getCurrency

        public java.lang.String getCurrency()
        In fields 73A, 71D, 71B and 73 the currency can be present as the first part of the narrative content along an amount.
      • getBankCode

        public java.lang.String getBankCode()
        In SCORE messages, in field 71B, there is a bank code within the codeword with a slash separator (i.e. C/USD). This will get the bank code (i.e. C for the C/USD case). Or null if this is not possible.
        See Also:
        getCurrency()
      • setBankCode

        public void setBankCode​(java.lang.String bankCode)
      • getAmount

        public java.math.BigDecimal getAmount()
        In fields such as 73A, 71D, 71B and 73 the amount (along the currency) can be present as the first part of the narrative content.
      • getCountry

        public java.lang.String getCountry()
        In fields such as 77B a two letters country code can be present as the first part of the narrative content.
      • getNarrativeFragments

        public java.util.List<java.lang.String> getNarrativeFragments()
        Returns the list of text fragments in the narrative, fragments are segments of the text that is wrapped in lines. If the narrative is a single string in a single line, the list will contain a single element. To get the narrative as a simple joined string use getNarrative(String)
        Returns:
        the narrative fragments or an empty list if the narrative does not have any text
      • getNarrativeSupplementFragments

        public java.util.List<java.lang.String> getNarrativeSupplementFragments()
        In fields such as 75 or 76 the narrative can be split into a first text along an optional second supplement. This method returns the list of text fragments in the supplement, fragments are segments of the text that is wrapped in lines. If the supplement is a single string in a single line, the list will contain a single element. To get the supplement as a simple joined string use getNarrativeSupplement(String)
        Returns:
        the narrative supplement fragments or an empty list if the narrative does not have any supplement text
      • getNarrative

        public java.lang.String getNarrative()
        Gets this narrative content as a single String, meaning if the narrative was wrapped in lines this method will return the joined lines without separator.
        Returns:
        the narrative fragments joined as a single string or null if the narrative does not have any text
      • getNarrative

        public java.lang.String getNarrative​(java.lang.String delimiter)
        Gets this narrative content as a single String, meaning if the narrative was wrapped in lines this method will return the joined lines.
        Parameters:
        delimiter - optional delimiter, could be for example null, empty, space or line break.
        Returns:
        the narrative fragments joined as a single string or null if the narrative does not have any text
      • getNarrativeSupplement

        public java.lang.String getNarrativeSupplement()
        Gets this narrative supplement content as a single String, meaning if the text was wrapped in lines this method will return the joined lines without separator.
        Returns:
        the narrative supplement fragments joined as a single string or null if the narrative does not have any supplement text
      • getNarrativeSupplement

        public java.lang.String getNarrativeSupplement​(java.lang.String delimiter)
        Gets this narrative supplement content as a single String, meaning if the text was wrapped in lines this method will return the joined lines.
        Parameters:
        delimiter - optional delimiter, could be for example null, empty, space or line break.
        Returns:
        the narrative supplement fragments joined as a single string or null if the narrative does not have any supplement text
      • isEmpty

        public boolean isEmpty()
        Returns:
        true if non of the narrative fields are set
      • valid

        public boolean valid()
        Basic validation to check the codeword is present and at least one of the other fields is present