@Exported public abstract class AbstractJSObject extends Object implements JSObject
| Constructor and Description |
|---|
AbstractJSObject()
The default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
call(Object thiz,
Object... args)
Call this object as a JavaScript function.
|
Object |
eval(String s)
Evaluate a JavaScript expression.
|
String |
getClassName()
ECMA [[Class]] property
|
Object |
getDefaultValue(Class<?> hint)
Implements this object's
[[DefaultValue]] method. |
static Object |
getDefaultValue(JSObject jsobj,
Class<?> hint)
When passed an
AbstractJSObject, invokes its getDefaultValue(Class) method. |
Object |
getMember(String name)
Retrieves a named member of this JavaScript object.
|
Object |
getSlot(int index)
Retrieves an indexed member of this JavaScript object.
|
boolean |
hasMember(String name)
Does this object have a named member?
|
boolean |
hasSlot(int slot)
Does this object have a indexed property?
|
boolean |
isArray()
Is this an array object?
|
boolean |
isFunction()
Is this a function object?
|
boolean |
isInstance(Object instance)
Checking whether the given object is an instance of 'this' object.
|
boolean |
isInstanceOf(Object clazz)
Checking whether this object is an instance of the given 'clazz' object.
|
boolean |
isStrictFunction()
Is this a 'use strict' function object?
|
Set<String> |
keySet()
Returns the set of all property names of this object.
|
Object |
newObject(Object... args)
Call this 'constructor' JavaScript function to create a new object.
|
void |
removeMember(String name)
Remove a named member from this JavaScript object
|
void |
setMember(String name,
Object value)
Set a named member in this JavaScript object
|
void |
setSlot(int index,
Object value)
Set an indexed member in this JavaScript object
|
double |
toNumber()
Deprecated.
use
getDefaultValue(Class) with Number hint instead. |
Collection<Object> |
values()
Returns the set of all property values of this object.
|
public Object call(Object thiz, Object... args)
JSObjectpublic Object newObject(Object... args)
JSObjectpublic Object eval(String s)
JSObjectpublic Object getMember(String name)
JSObjectpublic Object getSlot(int index)
JSObjectpublic boolean hasMember(String name)
JSObjectpublic boolean hasSlot(int slot)
JSObjectpublic void removeMember(String name)
JSObjectremoveMember in interface JSObjectname - name of the memberpublic void setMember(String name, Object value)
JSObjectpublic void setSlot(int index,
Object value)
JSObjectpublic Set<String> keySet()
JSObjectpublic Collection<Object> values()
JSObjectpublic boolean isInstance(Object instance)
JSObjectisInstance in interface JSObjectinstance - instance to checkpublic boolean isInstanceOf(Object clazz)
JSObjectisInstanceOf in interface JSObjectclazz - clazz to checkpublic String getClassName()
JSObjectgetClassName in interface JSObjectpublic boolean isFunction()
JSObjectisFunction in interface JSObjectpublic boolean isStrictFunction()
JSObjectisStrictFunction in interface JSObjectpublic boolean isArray()
JSObject@Deprecated public double toNumber()
getDefaultValue(Class) with Number hint instead.public Object getDefaultValue(Class<?> hint)
[[DefaultValue]] method. The default implementation follows ECMAScript 5.1
section 8.6.2 but subclasses are free to provide their own implementations.hint - the type hint. Should be either null, Number.class or String.class.UnsupportedOperationException - if the conversion can't be performed. The engine will convert this
exception into a JavaScript TypeError.public static Object getDefaultValue(JSObject jsobj, Class<?> hint)
AbstractJSObject, invokes its getDefaultValue(Class) method. When passed any
other JSObject, it will obtain its [[DefaultValue]] method as per ECMAScript 5.1 section
8.6.2.jsobj - the JSObject whose [[DefaultValue]] is obtained.hint - the type hint. Should be either null, Number.class or String.class.UnsupportedOperationException - if the conversion can't be performed. The engine will convert this
exception into a JavaScript TypeError.
Copyright © 2014, 2017, Oracle and/or its affiliates. All rights reserved.