Class ApplicationState

java.lang.Object
NTNU.IDATT1002.service.ApplicationState

public final class ApplicationState
extends java.lang.Object
Class Application State. Keeps a record of the global application state, such as the current logged in user.
  • Constructor Summary

    Constructors 
    Constructor Description
    ApplicationState()  
  • Method Summary

    Modifier and Type Method Description
    static User getCurrentUser()
    Retrieve the current logged in user if present, or retrieve an anonymous user.
    static void setCurrentUser​(User currentUser)  

    Methods inherited from class java.lang.Object

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

  • Method Details

    • setCurrentUser

      public static void setCurrentUser​(User currentUser)
    • getCurrentUser

      public static User getCurrentUser()
      Retrieve the current logged in user if present, or retrieve an anonymous user.
      Returns:
      the current user.
      Throws:
      java.lang.IllegalArgumentException - if neither the current user nor the anonymous user are present.