Package net.codecrete.qrbill.generator
Class BillTextFormatter
java.lang.Object
net.codecrete.qrbill.generator.BillTextFormatter
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 Summary
ConstructorDescriptionBillTextFormatter
(Bill bill) Creates a new instance for the specified bill.BillTextFormatter
(Bill bill, boolean isValidated) Creates a new instance for the given bill. -
Method Summary
Modifier and TypeMethodDescriptionGets the formatted account number.Returns the additional information.Gets the formatted amount.Gets the formatted creditor address.Gets the reduced formatted creditor address.Gets the "payable by" text (debtor address).Gets the "payable by" text with a reduced debtor address.Gets the "payable to" text (account number and creditor address).Gets the "payable to" text (account number and creditor address) with a reduced address.Gets the formatted reference number.
-
Constructor Details
-
BillTextFormatter
Creates a new instance for the specified bill.- Parameters:
bill
- QR bill data- Throws:
QRBillValidationError
- if the bill cannot be validated without errors
-
BillTextFormatter
Creates a new instance for the given bill.- Parameters:
bill
- QR bill dataisValidated
- indicates if the bill has already been validated
-
-
Method Details
-
getPayableTo
Gets the "payable to" text (account number and creditor address).- Returns:
- "payable to" text
-
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
Gets the formatted account number.- Returns:
- account number
-
getCreditorAddress
Gets the formatted creditor address.- Returns:
- formatted address
-
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
Gets the formatted reference number.- Returns:
- reference number, or
null
if no reference number has been specified
-
getAmount
Gets the formatted amount.- Returns:
- the amount, or
null
if no amount has been specified
-
getPayableBy
Gets the "payable by" text (debtor address).- Returns:
- formatted address, or
null
if no debtor address has been specified
-
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
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
-