org.mozilla.javascript

Class NativeJavaClass

public class NativeJavaClass extends NativeJavaObject implements Function

This class reflects Java classes into the JavaScript environment, mainly for constructors and static members. We lazily reflect properties, and currently do not guarantee that a single j.l.Class is only reflected once into the JS environment, although we should. The only known case where multiple reflections are possible occurs when a j.l.Class is wrapped as part of a method return or property access, rather than by walking the Packages/java tree.

Author: Mike Shaver

See Also: NativeJavaArray NativeJavaObject NativeJavaPackage

Constructor Summary
NativeJavaClass()
NativeJavaClass(Scriptable scope, Class cl)
Method Summary
Objectcall(Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
Scriptableconstruct(Context cx, Scriptable scope, Object[] args)
Objectget(String name, Scriptable start)
StringgetClassName()
ClassgetClassObject()
ObjectgetDefaultValue(Class hint)
Object[]getIds()
booleanhas(String name, Scriptable start)
booleanhasInstance(Scriptable value)
Determines if prototype is a wrapped Java object and performs a Java "instanceof".
protected voidinitMembers()
voidput(String name, Scriptable start, Object value)
StringtoString()

Constructor Detail

NativeJavaClass

public NativeJavaClass()

NativeJavaClass

public NativeJavaClass(Scriptable scope, Class cl)

Method Detail

call

public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args)

construct

public Scriptable construct(Context cx, Scriptable scope, Object[] args)

get

public Object get(String name, Scriptable start)

getClassName

public String getClassName()

getClassObject

public Class getClassObject()

getDefaultValue

public Object getDefaultValue(Class hint)

getIds

public Object[] getIds()

has

public boolean has(String name, Scriptable start)

hasInstance

public boolean hasInstance(Scriptable value)
Determines if prototype is a wrapped Java object and performs a Java "instanceof". Exception: if value is an instance of NativeJavaClass, it isn't considered an instance of the Java class; this forestalls any name conflicts between java.lang.Class's methods and the static methods exposed by a JavaNativeClass.

initMembers

protected void initMembers()

put

public void put(String name, Scriptable start, Object value)

toString

public String toString()