Class Session


  • public final class Session
    extends Object
    Author:
    Maksim Tkachenko
    • Field Detail

      • EMPTY_SESSION

        public static final Session EMPTY_SESSION
        An instance of an empty session.
    • Method Detail

      • singleton

        public static <T> Session singleton​(@NotNull
                                            @NotNull Session.Key<T> key,
                                            @Nullable
                                            T value)
        Constructs a singleton session.
        Type Parameters:
        T - the type of the value of the session variable
        Parameters:
        key - an unique identifier of the session variable
        value - the value of the session variable
        Returns:
        An instance of session with single key-value pair
      • builder

        public static Session.Builder builder()
        Create a new instance of builder.
        Returns:
        A new instance of builder
      • get

        public <T> T get​(@NotNull
                         @NotNull Session.Key<T> key)
        Returns the session variable from the store.
        Type Parameters:
        T - the type of the value of the session variable being retrieved
        Parameters:
        key - the name of the session variable to retrieve
        Returns:
        the value of the session variable stored