Class None

java.lang.Object
org.daiitech.naftah.builtin.lang.None

public final class None extends Object
this class represents a singleton value indicating the absence of a value.

This is similar to null in Java, but it's implemented as a safe, immutable object to avoid NullPointerExceptions.

Used to represent "no value" in expression evaluations or logic operations.

Author:
Chakib Daii
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final None
    The singleton instance of None.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Private constructor to prevent external instantiation.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Object
    get()
    Returns the singleton instance representing None.
    static boolean
    isNone(Object object)
    Checks whether the given object is the None instance.
    Returns the string representation of this None object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • INSTANCE

      private static final None INSTANCE
      The singleton instance of None.
  • Constructor Details

    • None

      private None()
      Private constructor to prevent external instantiation.
  • Method Details

    • get

      public static Object get()
      Returns the singleton instance representing None.
      Returns:
      the None instance
    • isNone

      public static boolean isNone(Object object)
      Checks whether the given object is the None instance.
      Parameters:
      object - the object to check
      Returns:
      true if the object is None; false otherwise
    • toString

      public String toString()
      Returns the string representation of this None object.
      Overrides:
      toString in class Object
      Returns:
      a string indicating absence of value (can be customized)