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
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
-
Field Summary
Fields inherited from interface com.amalgamasimulation.desktop.html.js.JSConvertable
NULL, UNDEFINED -
Constructor Summary
ConstructorsConstructorDescriptionJSPrimitive(T value) Constructs a new JSPrimitive instance with the specified value. -
Method Summary
-
Constructor Details
-
JSPrimitive
Constructs a new JSPrimitive instance with the specified value.- Parameters:
value- the primitive value to wrap
-
-
Method Details
-
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:
toJSin interfaceJSConvertable- Returns:
- the JavaScript string representation of the primitive value
-