Class LineItem

  • All Implemented Interfaces:
    java.io.Serializable

    @Entity
    public class LineItem
    extends java.lang.Object
    implements java.io.Serializable
    An immutable persistent entity with complex primary key. The primary key is combination of the primary identity of PurchaseOrder and an 1-based integer index.
    Author:
    Pinaki Poddar
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  LineItem.LineItemId
      Separate identity class.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected LineItem()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Book getBook()
      Gets the Book for this line item.
      int getIndex()
      Gets the 1-based index this line item in its parent PurchaseOrder.
      PurchaseOrder getOrder()
      Gets the parent PurchaseOrder of this line item.
      int getQuantity()
      Gets the quantity of the book for this line item.
      • Methods inherited from class java.lang.Object

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

      • LineItem

        protected LineItem()
    • Method Detail

      • getBook

        public Book getBook()
        Gets the Book for this line item.
        Returns:
        non-null Book.
      • getQuantity

        public int getQuantity()
        Gets the quantity of the book for this line item.
        Returns:
        a positive number.
      • getOrder

        public PurchaseOrder getOrder()
        Gets the parent PurchaseOrder of this line item.
        Returns:
        non-null PurchaseOrder.
      • getIndex

        public int getIndex()
        Gets the 1-based index this line item in its parent PurchaseOrder.
        Returns:
        index must be greater than zero.