public abstract class JsValue extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
JsValue.DispatchMethod
Provides interface for methods to be exposed on JavaScript side.
|
static interface |
JsValue.DispatchObject
Provides interface for objects to be exposed on JavaScript side.
|
Constructor and Description |
---|
JsValue() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
getBoolean()
Get the value of the object as a boolean.
|
abstract int |
getInt()
Get the value of the object as an integer.
|
abstract JsValue.DispatchObject |
getJavaObjectWrapper()
Get the wrapper object for a wrapped Java object.
|
abstract int |
getJavaScriptObjectPointer()
Returns a unique value corresponding to the underlying JavaScript object.
|
abstract double |
getNumber()
Get the value of the object as a double.
|
abstract String |
getString()
Get the value of the object as a string.
|
abstract String |
getTypeString()
Returns a human-readable string describing the type of the JS object.
|
abstract JsValue.DispatchMethod |
getWrappedJavaFunction()
Returns a wrapped Java method.
|
abstract Object |
getWrappedJavaObject()
Unwrap a wrapped Java object.
|
abstract boolean |
isBoolean()
Returns true if the JS value is a boolean.
|
abstract boolean |
isInt()
Returns true if getInt() can be used on this value.
|
abstract boolean |
isJavaScriptObject()
Returns true if the JS value is a native JS object.
|
abstract boolean |
isNull()
Returns true if the JS value is null.
|
abstract boolean |
isNumber()
Returns true if the JS value is a numeric type.
|
abstract boolean |
isString()
Returns true if the JS value is a string.
|
abstract boolean |
isUndefined()
Returns true if the JS value is undefined (void).
|
abstract boolean |
isWrappedJavaFunction()
Returns true if the JS value contains a wrapped Java method.
|
abstract boolean |
isWrappedJavaObject()
Returns true if the JS value is a wrapped Java object.
|
abstract void |
setBoolean(boolean val)
Sets the JS object to be a boolean value.
|
abstract void |
setByte(byte val)
Sets the JS object to be a number, passed as an byte.
|
abstract void |
setChar(char val)
Sets the JS object to be a number, passed as a char.
|
abstract void |
setDouble(double val)
Sets the JS object to be a number, passed as a double.
|
abstract void |
setInt(int val)
Sets the JS object to be a number, passed as an int.
|
abstract void |
setNull()
Set the JS object to be null.
|
abstract void |
setShort(short val)
Sets the JS object to be a number, passed as a short.
|
abstract void |
setString(String val)
Set the JS object to the supplied string.
|
abstract void |
setUndefined()
Set the JS object to be undefined (void).
|
abstract void |
setValue(JsValue other)
Make this JsValue refer to the same underlying object as another JsValue.
|
abstract <T> void |
setWrappedJavaObject(CompilingClassLoader cl,
T val)
Set the JS object to the supplied object, which will be wrapped in a
platform-dependent JavaScript class.
|
String |
toString()
Produce a string representation of the JsValue.
|
public abstract boolean getBoolean()
public abstract int getInt()
public abstract JsValue.DispatchObject getJavaObjectWrapper()
public abstract int getJavaScriptObjectPointer()
0
if isJavaScriptObject()
is
false
public abstract double getNumber()
public abstract String getString()
isString()
is true
.public abstract String getTypeString()
public abstract JsValue.DispatchMethod getWrappedJavaFunction()
public abstract Object getWrappedJavaObject()
public abstract boolean isBoolean()
public abstract boolean isInt()
public abstract boolean isJavaScriptObject()
public abstract boolean isNull()
public abstract boolean isNumber()
public abstract boolean isString()
public abstract boolean isUndefined()
public abstract boolean isWrappedJavaFunction()
public abstract boolean isWrappedJavaObject()
public abstract void setBoolean(boolean val)
val
- the boolean value to setpublic abstract void setByte(byte val)
val
- the value to storepublic abstract void setChar(char val)
val
- the value to storepublic abstract void setDouble(double val)
val
- the value to storepublic abstract void setInt(int val)
val
- the value to storepublic abstract void setNull()
HostedModeException
public abstract void setShort(short val)
val
- the value to storepublic abstract void setString(String val)
val
- the string to put in the JS objectHostedModeException
- on JS allocation failurespublic abstract void setUndefined()
HostedModeException
- on JS allocation failurespublic abstract void setValue(JsValue other)
other
- JsValue to copy JS object frompublic abstract <T> void setWrappedJavaObject(CompilingClassLoader cl, T val)
T
- the type of the Java object to wrapcl
- the classloader to create the wrapper object withval
- the Java object to wrapHostedModeException
Copyright © 2018. All rights reserved.