Class JSPrimitive<T>

java.lang.Object
com.amalgamasimulation.desktop.html.js.JSPrimitive<T>
Type Parameters:
T - the type of the primitive value
All Implemented Interfaces:
JSConvertable

public class JSPrimitive<T> extends Object implements JSConvertable
The JSPrimitive class represents a JavaScript primitive value, such as a string, number, or boolean. It implements the JSConvertable interface, allowing it to be converted to a JavaScript string representation.
Author:
Alexey Glazyrin
  • Constructor Details

    • JSPrimitive

      public JSPrimitive(T value)
      Constructs a new JSPrimitive instance with the specified value.
      Parameters:
      value - the primitive value to wrap
  • Method Details

    • toJS

      public String toJS()
      Converts the primitive value to a JavaScript string representation. Strings are enclosed in single quotes, while other values are converted directly. Null values are represented as "null".
      Specified by:
      toJS in interface JSConvertable
      Returns:
      the JavaScript string representation of the primitive value