Class BillTextFormatter

java.lang.Object
net.codecrete.qrbill.generator.BillTextFormatter

public class BillTextFormatter extends Object
Formats text on a QR bill.

The resulting text often contains multiple lines, e.g. for addresses. These line breaks a represented by a line feed character (U+000A). Long lines might require additional line breaks to fit into the given text boxes. These additional line breaks are not included in the resulting text.

  • Constructor Details

    • BillTextFormatter

      public BillTextFormatter(Bill bill)
      Creates a new instance for the specified bill.
      Parameters:
      bill - QR bill data
      Throws:
      QRBillValidationError - if the bill cannot be validated without errors
    • BillTextFormatter

      public BillTextFormatter(Bill bill, boolean isValidated)
      Creates a new instance for the given bill.
      Parameters:
      bill - QR bill data
      isValidated - indicates if the bill has already been validated
  • Method Details

    • getPayableTo

      public String getPayableTo()
      Gets the "payable to" text (account number and creditor address).
      Returns:
      "payable to" text
    • getPayableToReduced

      public String getPayableToReduced()
      Gets the "payable to" text (account number and creditor address) with a reduced address.

      If space is very tight, an address without street and house number can be used.

      Returns:
      "payable to" text
    • getAccount

      public String getAccount()
      Gets the formatted account number.
      Returns:
      account number
    • getCreditorAddress

      public String getCreditorAddress()
      Gets the formatted creditor address.
      Returns:
      formatted address
    • getCreditorAddressReduced

      public String getCreditorAddressReduced()
      Gets the reduced formatted creditor address.

      If space is very tight, a reduced address without street and house number can be used.

      Returns:
      formatted address
    • getReference

      public String getReference()
      Gets the formatted reference number.
      Returns:
      reference number, or null if no reference number has been specified
    • getAmount

      public String getAmount()
      Gets the formatted amount.
      Returns:
      the amount, or null if no amount has been specified
    • getPayableBy

      public String getPayableBy()
      Gets the "payable by" text (debtor address).
      Returns:
      formatted address, or null if no debtor address has been specified
    • getPayableByReduced

      public String getPayableByReduced()
      Gets the "payable by" text with a reduced debtor address.

      If space is very tight, a reduced address without street and house number can be used.

      Returns:
      formatted address, or null if no debtor address has been specified
    • getAdditionalInformation

      public String getAdditionalInformation()
      Returns the additional information.

      It consists of the unstructured message, the bill information, both or none, depending on what has been specified. Lines are separated by a line feed character.

      Returns:
      additional information, or null if neither an unstructured message nor bill information has been specified