Class ObservableSingleton

java.lang.Object
com.prog3.ipt.Model.CitizenClasses.ObservableSingleton

public class ObservableSingleton extends Object
ObersvableSingleton is a class that implements Observer Method design pattern variant with addition of Singleton Method design pattern
  • Field Details

    • sessionUser

      private static volatile Citizen sessionUser
    • sessionOrder

      private static volatile Order sessionOrder
    • sessionPaymentMethodStrategy

      private static volatile PaymentMethodStrategy sessionPaymentMethodStrategy
    • paymentMethodString

      private static volatile String paymentMethodString
  • Constructor Details

    • ObservableSingleton

      private ObservableSingleton()
      Protect against instantiation via reflection
  • Method Details

    • setCitizenID

      public static void setCitizenID(String citizenID)
    • setCitizen

      public static void setCitizen(Citizen newUser)
    • updateCitizen

      public static void updateCitizen(String name, String surname, LocalDate birthDate, String email, String password)
    • getCitizen

      public static Citizen getCitizen()
      The instance doesn't get created until the method is called for the first time.
    • setOrder

      public static void setOrder(Order newOrder)
    • updateOrder

      public static void updateOrder(LocalDate purchaseDate, double purchasePrice, String citizenID, PaymentMethodStrategy paymentMethodStrategy, ArrayList<TravelDocument> purchaseList, javafx.collections.ObservableList<TravelDocumentFX> observableList)
    • updateOrderWithOrderID

      public static void updateOrderWithOrderID(String orderID, LocalDate purchaseDate, double purchasePrice, String citizenID, PaymentMethodStrategy paymentMethodStrategy, ArrayList<TravelDocument> purchaseList, javafx.collections.ObservableList<TravelDocumentFX> observableList)
    • getOrder

      public static Order getOrder()
    • setPaymentMethodStrategy

      public static void setPaymentMethodStrategy(PaymentMethodStrategy newPaymentMethodStrategy)
    • getPaymentMethodStrategy

      public static PaymentMethodStrategy getPaymentMethodStrategy()
      The instance doesn't get created until the method is called for the first time.
    • setPaymentMethodString

      public static void setPaymentMethodString(String paymentMethodString)
    • getPaymentMethodString

      public static String getPaymentMethodString()