@Exported public abstract class AbstractJSObject extends Object implements JSObject
| Constructor and Description |
|---|
AbstractJSObject() |
| 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)
public Object newObject(Object... args)
public Object getSlot(int index)
public boolean hasMember(String name)
public boolean hasSlot(int slot)
public void removeMember(String name)
removeMember in interface JSObjectname - name of the memberpublic void setMember(String name, Object value)
public void setSlot(int index,
Object value)
public Collection<Object> values()
public boolean isInstance(Object instance)
isInstance in interface JSObjectinstance - instance to checkpublic boolean isInstanceOf(Object clazz)
isInstanceOf in interface JSObjectclazz - clazz to checkpublic String getClassName()
getClassName in interface JSObjectpublic boolean isFunction()
isFunction in interface JSObjectpublic boolean isStrictFunction()
isStrictFunction in interface JSObjectpublic boolean isArray()
@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, 2016, Oracle and/or its affiliates. All rights reserved.