Class AbstractVoucher

java.lang.Object
de.calamanari.pk.factorymethod.AbstractVoucher
Direct Known Subclasses:
FreakliesShopVoucher, MoronStoreVoucher

public abstract class AbstractVoucher
extends java.lang.Object
Abstract Voucher is the abstract product in this FACTORY METHOD example scenario.
Author:
Karl Eilebrecht
  • Constructor Summary

    Constructors
    Constructor Description
    AbstractVoucher​(java.lang.String firstName, java.lang.String lastName, double value)
    Creates a new voucher
  • Method Summary

    Modifier and Type Method Description
    java.lang.String getFirstName()
    Returns the first name of the voucher's owner.
    abstract java.lang.String getId()
    Returns this voucher's ID
    java.lang.String getLastName()
    Returns the last name of the voucher's owner
    double getValue()
    Returns the value of this voucher
    abstract java.lang.String getVoucherDisplayCode()
    Returns the human readable code of this voucher, the user will enter when applying it to an order.
    void setFirstName​(java.lang.String firstName)
    Sets the first name of the voucher's owner
    void setLastName​(java.lang.String lastName)
    Sets the last name of the voucher's owner
    void setValue​(double value)
    Sets the value of this voucher
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

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

    • AbstractVoucher

      public AbstractVoucher​(java.lang.String firstName, java.lang.String lastName, double value)
      Creates a new voucher
      Parameters:
      firstName - person's first name
      lastName - person's last name
      value - the vouchers value
  • Method Details

    • getLastName

      public java.lang.String getLastName()
      Returns the last name of the voucher's owner
      Returns:
      last name
    • setLastName

      public void setLastName​(java.lang.String lastName)
      Sets the last name of the voucher's owner
      Parameters:
      lastName - name of the owner
    • getFirstName

      public java.lang.String getFirstName()
      Returns the first name of the voucher's owner.
      Returns:
      first name of the owner
    • setFirstName

      public void setFirstName​(java.lang.String firstName)
      Sets the first name of the voucher's owner
      Parameters:
      firstName - first name of the owner
    • getValue

      public double getValue()
      Returns the value of this voucher
      Returns:
      value voucher's value
    • setValue

      public void setValue​(double value)
      Sets the value of this voucher
      Parameters:
      value - vouchers value
    • getId

      public abstract java.lang.String getId()
      Returns this voucher's ID
      Returns:
      id of voucher
    • getVoucherDisplayCode

      public abstract java.lang.String getVoucherDisplayCode()
      Returns the human readable code of this voucher, the user will enter when applying it to an order.
      Returns:
      display code
    • toString

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