Constructor and Description |
---|
JSValue(JSContext ctx)
Creates a new undefined JavaScript value
|
JSValue(JSContext ctx,
java.lang.Object val)
Creates a new JavaScript value from a Java value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
JSContext |
getContext()
Gets the JSContext of this value
|
int |
hashCode() |
java.lang.Boolean |
isArray()
Tests whether the value is an array
|
java.lang.Boolean |
isBoolean()
Tests whether the value is boolean
|
java.lang.Boolean |
isDate()
Tests whether the value is a date object
|
boolean |
isEqual(java.lang.Object other)
JavaScript definition of equality (==).
|
java.lang.Boolean |
isInstanceOfConstructor(JSObject constructor)
Tests whether a value in an instance of a constructor object
|
java.lang.Boolean |
isNull()
Tests whether the value is null
|
java.lang.Boolean |
isNumber()
Tests whether the value is a number
|
java.lang.Boolean |
isObject()
Tests whether the value is an object
|
boolean |
isStrictEqual(java.lang.Object other)
Tests whether two values are strict equal.
|
java.lang.Boolean |
isString()
Tests whether the value is a string
|
java.lang.Boolean |
isUndefined()
Tests whether the value is undefined
|
java.lang.Boolean |
toBoolean()
Gets the Boolean value of this JS value
|
JSFunction |
toFunction()
If the JS value is a function, gets the JSFunction
|
JSBaseArray |
toJSArray()
If the JS value is an array, gets the JSArray
|
java.lang.String |
toJSON()
Gets the JSON of this JS value
|
java.lang.String |
toJSON(int indent)
Gets the JSON of this JS value
|
java.lang.Double |
toNumber()
Gets the numeric value of this JS value
|
JSObject |
toObject()
If the JS value is an object, gets the JSObject
|
java.lang.String |
toString() |
java.lang.Long |
valueRef()
Gets the JavaScriptCore value reference
|
public JSValue(JSContext ctx)
ctx
- The context in which to create the valuepublic JSValue(JSContext ctx, java.lang.Object val)
ctx
- The context in which to create the valueval
- The Java valuepublic java.lang.Boolean isUndefined()
public java.lang.Boolean isNull()
public java.lang.Boolean isBoolean()
public java.lang.Boolean isNumber()
public java.lang.Boolean isString()
public java.lang.Boolean isArray()
public java.lang.Boolean isDate()
public java.lang.Boolean isObject()
public java.lang.Boolean isInstanceOfConstructor(JSObject constructor) throws JSException
constructor
- The constructor object to testJSException
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public boolean isEqual(java.lang.Object other)
other
- the value to compare for equalitypublic boolean isStrictEqual(java.lang.Object other)
other
- The value to test againstpublic java.lang.Boolean toBoolean()
public java.lang.Double toNumber() throws JSException
JSException
public java.lang.String toString()
toString
in class java.lang.Object
public JSObject toObject() throws JSException
JSException
- if not an objectpublic JSFunction toFunction() throws JSException
JSException
- if not a functionpublic JSBaseArray toJSArray() throws JSException
JSException
- if not an arraypublic java.lang.String toJSON(int indent) throws JSException
indent
- number of spaces to indentJSException
public java.lang.String toJSON() throws JSException
JSException
public int hashCode()
hashCode
in class java.lang.Object
public JSContext getContext()
public java.lang.Long valueRef()