Class JsUndefined

java.lang.Object
io.karatelabs.js.JsUndefined
All Implemented Interfaces:
JsValue

public final class JsUndefined extends Object implements JsValue
Singleton representing JavaScript's undefined value.

Implements JsValue so it's handled uniformly with other JS types. getJavaValue() returns null for Java interop.

  • Field Details

  • Method Details

    • getJavaValue

      public Object getJavaValue()
      Description copied from interface: JsValue
      Returns the idiomatic Java representation of this object. Used when values leave the JS engine and need to be consumed by Java code.

      Examples: JsNumber → Number, JsDate → Date, JsUint8Array → byte[]

      Specified by:
      getJavaValue in interface JsValue
    • getJsValue

      public Object getJsValue()
      Description copied from interface: JsValue
      Returns the raw internal value for use in JS operations (comparison, arithmetic, etc.). This enables a consistent "unwrap first, then switch on raw types" pattern.

      Examples: JsNumber → Number, JsDate → Long (millis), JsUint8Array → byte[]

      Default implementation delegates to JsValue.getJavaValue() which is correct for most types. Override when internal representation differs from external (e.g., JsDate stores long millis).

      Specified by:
      getJsValue in interface JsValue
    • toString

      public String toString()
      Overrides:
      toString in class Object