Class Invoice

java.lang.Object
de.calamanari.pk.lazyload.Invoice
All Implemented Interfaces:
java.io.Serializable

public class Invoice
extends java.lang.Object
implements java.io.Serializable
Invoice - supplementary class to demonstrate LAZY LOAD pattern.
Each invoice has a number of fields, but only the invoiceId and the amountClaimed will be loaded by default. Other fields will be loaded on demand.
Author:
Karl Eilebrecht
See Also:
Serialized Form
  • Field Summary

    Fields
    Modifier and Type Field Description
    static java.util.Comparator<Invoice> BY_ID_COMPARATOR
    Compares the ids, for sorting
  • Constructor Summary

    Constructors
    Constructor Description
    Invoice​(PersistenceSession persistenceSession, java.lang.String invoiceId, java.lang.String amountClaimed)
    Creates new invoice instance
    Invoice​(PersistenceSession persistenceSession, java.lang.String invoiceId, java.lang.String amountClaimed, java.lang.String debtorName, java.lang.String street, java.lang.String zipCode, java.lang.String city)
    Creates new invoice instance
  • Method Summary

    Modifier and Type Method Description
    double getAmountClaimed()
    Returns the amount
    java.lang.String getCity()
    Returns the address field city
    java.lang.String getDebtorName()
    Returns the debtor name
    java.lang.String getInvoiceId()
    Returns the invoice id
    java.lang.String getStreet()
    Returns the address field street
    java.lang.String getZipCode()
    Returns the address field zipCode
    void setLazyFields​(java.lang.String debtorName, java.lang.String street, java.lang.String zipCode, java.lang.String city)
    This method is used to set the lazy-loaded fields when requested
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • BY_ID_COMPARATOR

      public static final java.util.Comparator<Invoice> BY_ID_COMPARATOR
      Compares the ids, for sorting
  • Constructor Details

    • Invoice

      public Invoice​(PersistenceSession persistenceSession, java.lang.String invoiceId, java.lang.String amountClaimed, java.lang.String debtorName, java.lang.String street, java.lang.String zipCode, java.lang.String city)
      Creates new invoice instance
      Parameters:
      persistenceSession - current session
      invoiceId - identifier
      amountClaimed - requested monetary value
      debtorName - name of the one who has to pay
      street - address field
      zipCode - address field
      city - address field
    • Invoice

      public Invoice​(PersistenceSession persistenceSession, java.lang.String invoiceId, java.lang.String amountClaimed)
      Creates new invoice instance
      Parameters:
      persistenceSession - current session
      invoiceId - identifier
      amountClaimed - value to be payed by the debtor
  • Method Details

    • setLazyFields

      public void setLazyFields​(java.lang.String debtorName, java.lang.String street, java.lang.String zipCode, java.lang.String city)
      This method is used to set the lazy-loaded fields when requested
      Parameters:
      debtorName - name of the person who has to pay
      street - address field
      zipCode - address field
      city - address field
    • getInvoiceId

      public java.lang.String getInvoiceId()
      Returns the invoice id
      Returns:
      invoiceId
    • getAmountClaimed

      public double getAmountClaimed()
      Returns the amount
      Returns:
      amount of invoice
    • getDebtorName

      public java.lang.String getDebtorName()
      Returns the debtor name
      Returns:
      debtor name
    • getStreet

      public java.lang.String getStreet()
      Returns the address field street
      Returns:
      street
    • getZipCode

      public java.lang.String getZipCode()
      Returns the address field zipCode
      Returns:
      zipCoe
    • getCity

      public java.lang.String getCity()
      Returns the address field city
      Returns:
      city
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object