public class JSValue
extends java.lang.Object
Browser.executeJavaScriptAndReturnValue(String)
method execution.
Modifier and Type | Method and Description |
---|---|
JSArray |
asArray()
Casts the current JavaScript object to
将当前的JavaScript对象转换为JSArray类型。 JSArray type.
|
JSBoolean |
asBoolean()
Casts the current JavaScript object to
将当前的JavaScript对象转换为JSBoolean类型。 JSBoolean type.
|
JSBooleanObject |
asBooleanObject()
Casts the current JavaScript object to
将当前的JavaScript对象转换为JSBooleanObject类型。 JSBooleanObject type.
|
JSFunction |
asFunction()
Casts the current JavaScript object to
将当前的JavaScript对象转换为JSFunction类型。 JSFunction type.
|
java.lang.Object |
asJavaObject()
Casts the current JavaScript object to
将当前的JavaScript对象转换为java.lang.Object类型。 java.lang.Object type.
|
JSNumber |
asNumber()
Casts the current JavaScript object to
将当前的JavaScript对象转换为JSNumber类型。 JSNumber type.
|
JSNumberObject |
asNumberObject()
Casts the current JavaScript object to
将当前的JavaScript对象转换为JSNumberObject类型。 JSNumberObject type.
|
JSObject |
asObject()
Casts the current JavaScript object to
将当前的JavaScript对象转换为JSObject类型。 JSObject type.
|
JSString |
asString()
Casts the current JavaScript object to
将当前的JavaScript对象转换为JSString类型。 JSString type.
|
JSStringObject |
asStringObject()
Casts the current JavaScript object to
将当前的JavaScript对象转换为JSStringObject类型。 JSStringObject type.
|
boolean |
getBooleanValue()
Returns boolean value of the current JavaScript object if object represents a primitive boolean or Boolean object, otherwise throws
如果object表示原始的boolean或Boolean对象,则返回当前JavaScript对象的boolean值,否则抛出IllegalStateException。 IllegalStateException .
|
double |
getNumberValue()
Returns number value of the current JavaScript object if object represents a primitive number or Number object, otherwise throws
如果object表示原始数字或Number对象,则返回当前JavaScript对象的number值,否则抛出IllegalStateException。 IllegalStateException .
|
java.lang.String |
getStringValue()
Returns string value of the current JavaScript object if object represents a primitive string or String object, otherwise throws
如果object表示原始字符串或String对象,则返回当前JavaScript对象的字符串值,否则抛出IllegalStateException。 IllegalStateException .
|
boolean |
isArray()
Indicates whether JavaScript value is an array.
指示JavaScript值是否为数组。 |
boolean |
isBoolean()
Indicates whether JavaScript value is a boolean value.
指示JavaScript值是否为布尔值。 |
boolean |
isBooleanObject()
Indicates whether JavaScript value is a Boolean object.
指示JavaScript值是否为布尔对象。 |
boolean |
isFunction()
Indicates whether JavaScript value is a function.
指示JavaScript值是否为函数。 |
boolean |
isJavaObject()
Indicates whether JavaScript value is a Java object.
指示JavaScript值是否为Java对象。 |
boolean |
isNull()
Indicates whether JavaScript value is NULL.
指示JavaScript值是否为NULL。 |
boolean |
isNumber()
Indicates whether JavaScript value is a number value which equals to double type.
指示JavaScript值是否为等于double类型的数字值。 |
boolean |
isNumberObject()
Indicates whether JavaScript value is a Number object.
指示JavaScript值是否为Number对象。 |
boolean |
isObject()
Indicates whether JavaScript value is an object.
指示JavaScript值是否为对象。 |
boolean |
isString()
Indicates whether JavaScript value is a string.
指示JavaScript值是否为字符串。 |
boolean |
isStringObject()
Indicates whether JavaScript value is a String object.
指示JavaScript值是否为String对象。 |
boolean |
isUndefined()
Indicates whether JavaScript value is undefined.
指示JavaScript值是否未定义。 |
public double getNumberValue()
IllegalStateException
.
java.lang.IllegalStateException
- when current JavaScript object doesn't represent a primitive number or Number object.
public java.lang.String getStringValue()
IllegalStateException
.
java.lang.IllegalStateException
- when current JavaScript object doesn't represent a primitive string or String object.
public boolean getBooleanValue()
IllegalStateException
.
java.lang.IllegalStateException
- when current JavaScript object doesn't represent a primitive boolean or Boolean object.
public boolean isNumber()
true
, then the value can be casted to
JSNumber
type. For example:
if (value.isNumber()) { JSNumber number = value.asNumber(); }
true
when JavaScript value is a number value.
当JavaScript值为数字值时。
public boolean isString()
true
, then the value can be casted to
JSString
type. For example:
if (value.isString()) { JSString string = value.asString(); }
true
when JavaScript value is a string.
当JavaScript值是一个字符串。
public boolean isBoolean()
true
, then the value can be casted to
JSBoolean
type. For example:
if (value.isBoolean()) { JSBoolean bool = value.asBoolean(); }
true
when JavaScript value is a boolean value.
当JavaScript值为布尔值时。
public boolean isArray()
true
, then the value can be casted to
JSArray
type. For example:
if (value.isArray()) { JSArray array = value.asArray(); }
true
when JavaScript value is an array.
当JavaScript值是一个数组时。
public boolean isObject()
true
, then the value can be casted to
JSObject
type. For example:
if (value.isObject()) { JSObject object = value.asObject(); }
true
when JavaScript value is an object.
当JavaScript值是一个对象时。
public boolean isFunction()
true
, then the value can be casted to
JSFunction
type. For example:
if (value.isFunction()) { JSFunction function = value.asFunction(); }
true
when JavaScript value is a function.
当JavaScript值是一个函数时。
public boolean isNull()
true
when JavaScript value is NULL.
当JavaScript值为NULL时。
public boolean isUndefined()
true
when JavaScript value is undefined.
未定义JavaScript值时。
public boolean isNumberObject()
true
, then the value can be casted to
JSNumberObject
type. For example:
if (value.isNumberObject()) { JSNumberObject numberObject = value.asNumberObject(); }
true
when JavaScript value is a Number object.
当JavaScript值为Number对象时。
public boolean isStringObject()
true
, then the value can be casted to
JSStringObject
type. For example:
if (value.isStringObject()) { JSStringObject stringObject = value.asStringObject(); }
true
when JavaScript value is a String object.
当JavaScript值为String对象时。
public boolean isBooleanObject()
true
, then the value can be casted to
JSBooleanObject
type. For example:
if (value.isBooleanObject()) { JSBooleanObject booleanObject = value.asBooleanObject(); }
true
when JavaScript value is a Boolean object.
当JavaScript值为布尔对象时。
public boolean isJavaObject()
true
, then the value can be casted to
Object
type. For example:
if (value.isJavaObject()) { Object object = value.asJavaObject(); }
true
when JavaScript value is an object.
当JavaScript值是一个对象时。
public JSNumber asNumber()
JSNumber
type. If the current object doesn't represent a number value, the
IllegalStateException
error is thrown.
java.lang.IllegalStateException
- when current object doesn't represent a number value.
public JSBoolean asBoolean()
JSBoolean
type. If the current object doesn't represent a boolean value, the
IllegalStateException
error is thrown.
java.lang.IllegalStateException
- when current object doesn't represent a boolean value.
public JSString asString()
JSString
type. If the current object doesn't represent a string value, the
IllegalStateException
error is thrown.
java.lang.IllegalStateException
- when current object doesn't represent a string value.
public JSObject asObject()
JSObject
type. If the current object doesn't represent an object (e.g. it's a primitive value), the
IllegalStateException
error is thrown.
java.lang.IllegalStateException
- when current object doesn't represent an Object.
public java.lang.Object asJavaObject()
java.lang.Object
type. If the current object doesn't represent a Java object, the
IllegalStateException
error is thrown.
java.lang.IllegalStateException
- when current object doesn't represent
java.lang.Object
.
public JSFunction asFunction()
JSFunction
type. If the current object doesn't represent a function, the
IllegalStateException
error is thrown.
java.lang.IllegalStateException
- when current object doesn't represent a function.
public JSArray asArray()
JSArray
type. If the current object doesn't represent an array, the
IllegalStateException
error is thrown.
java.lang.IllegalStateException
- when current object doesn't represent an array.
public JSNumberObject asNumberObject()
JSNumberObject
type. If the current object doesn't represent a Number object, the
IllegalStateException
error is thrown.
java.lang.IllegalStateException
- when current object doesn't represent a Number object.
public JSBooleanObject asBooleanObject()
JSBooleanObject
type. If the current object doesn't represent a Boolean object, the
IllegalStateException
error is thrown.
java.lang.IllegalStateException
- when current object doesn't represent a Boolean object.
public JSStringObject asStringObject()
JSStringObject
type. If the current object doesn't represent a String object, the
IllegalStateException
error is thrown.
java.lang.IllegalStateException
- when current object doesn't represent a String object.