Class JsonNullable<T>

    • Method Detail

      • undefined

        public static <T> JsonNullable<T> undefined()
        Create a JsonNullable representing an undefined value (not present).
        Type Parameters:
        T -
        Returns:
      • of

        public static <T> JsonNullable<T> of​(T value)
        Create a JsonNullable from the submitted value.
        Type Parameters:
        T - the type of the value
        Parameters:
        value - the value
        Returns:
        the JsonNullable with the submitted value present.
      • get

        public T get()
        Obtain the value of this JsonNullable.
        Returns:
        the value, if present
        Throws:
        NoSuchElementException - if no value is present
      • orElse

        public T orElse​(T other)
        Obtain the value of this JsonNullable.
        Parameters:
        other - the value to be returned if no value is present
        Returns:
        the value of this JsonNullable if present, the submitted value otherwise
      • isPresent

        public boolean isPresent()
      • ifPresent

        public void ifPresent​(Consumer<? super T> action)
        If a value is present, performs the given action with the value, otherwise does nothing.
        Parameters:
        action - the action to be performed, if a value is present
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object