Class NullId

    • Method Detail

      • instance

        public static NullId instance()
        Getter for singleton instance.

        The instance is lazyly instanciated, which means the the singleton instance is created when this method is invoked for the first time. Any consecutive calls return the instance.

        Returns:
        The only instance of NullId
      • write

        public void write​(com.google.gson.stream.JsonWriter out)
                   throws IOException
        Writes a null literal to out.
        Specified by:
        write in interface Id<Object>
        Parameters:
        out - The JsonWriter used as output
        Throws:
        IOException - If serialization fails
      • hashCode

        public int hashCode()
        The hash code is always zero because there is only one instance of NullId.
        Overrides:
        hashCode in class Object
        Returns:
        Always 0
      • equals

        public boolean equals​(Object obj)
        Every NullId is equal.
        Overrides:
        equals in class Object
        Returns:
        true if the argument is an instance of NullId
      • toString

        public String toString()
        Gets the literal string "null".
        Overrides:
        toString in class Object
        Returns:
        "null"