Class NativeJavaMethod
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.IdScriptableObject
org.mozilla.javascript.BaseFunction
org.mozilla.javascript.NativeJavaMethod
- All Implemented Interfaces:
Serializable, Callable, ConstProperties, Constructable, DebuggableObject, Function, IdFunctionCall, Scriptable, SymbolScriptable
- Direct Known Subclasses:
FieldAndMethods
This class reflects Java methods into the JavaScript environment and handles overloading of
methods.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ScriptableObject
ScriptableObject.KeyComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final booleanprivate String(package private) MemberBox[]private final CopyOnWriteArrayList<ResolvedOverload> private static final intNo clear "easy" conversionprivate static final intTypes are equalprivate static final intprivate static final intprivate static final longFields inherited from class BaseFunction
GENERATOR_FUNCTION_CLASSFields inherited from class ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface Scriptable
NOT_FOUND -
Constructor Summary
ConstructorsConstructorDescriptionNativeJavaMethod(Method method, String name) NativeJavaMethod(MemberBox[] methods) NativeJavaMethod(MemberBox[] methods, String name) NativeJavaMethod(MemberBox method, String name) -
Method Summary
Modifier and TypeMethodDescriptioncall(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) Should be overridden.(package private) Stringdecompile(int indent, int flags) Decompile the source information associated with this js function/script back into a string.(package private) intfindCachedFunction(Context cx, Object[] args) (package private) static intfindFunction(Context cx, MemberBox[] methodsOrCtors, Object[] args) Find the index of the correct function to call given the set of methods or constructors and the arguments.private static intpreferSignature(Object[] args, Class<?>[] sig1, boolean vararg1, Class<?>[] sig2, boolean vararg2) Determine which of two signatures is the closer fit.private static voidprintDebug(String msg, MemberBox member, Object[] args) (package private) static StringscriptSignature(Object[] values) toString()Methods inherited from class BaseFunction
construct, createObject, execIdCall, fillConstructorProperties, findInstanceIdInfo, findPrototypeId, getArity, getClassName, getClassPrototype, getInstanceIdName, getInstanceIdValue, getLength, getMaxInstanceId, getPrototypeProperty, getTypeOf, hasInstance, hasPrototypeProperty, init, initAsGeneratorFunction, initPrototypeId, isApply, isApplyOrCall, isGeneratorFunction, setImmunePrototypeProperty, setInstanceIdAttributes, setInstanceIdValue, setPrototypeProperty, setPrototypePropertyAttributes, setStandardPropertyAttributes, setupDefaultPrototypeMethods inherited from class IdScriptableObject
activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, defineOwnProperty, delete, delete, ensureType, exportAsJSClass, findInstanceIdInfo, findPrototypeId, get, get, getAttributes, getAttributes, getIds, getOwnPropertyDescriptor, has, has, hasPrototypeMap, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, put, put, setAttributesMethods inherited from class ScriptableObject
addLazilyInitializedValue, applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildClassCtor, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, checkValidAttributes, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, sizeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Scriptable
delete, delete, get, get, getDefaultValue, getIds, getParentScope, getPrototype, has, has, put, put, setParentScope, setPrototype
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
PREFERENCE_EQUAL
private static final int PREFERENCE_EQUALTypes are equal- See Also:
-
PREFERENCE_FIRST_ARG
private static final int PREFERENCE_FIRST_ARG- See Also:
-
PREFERENCE_SECOND_ARG
private static final int PREFERENCE_SECOND_ARG- See Also:
-
PREFERENCE_AMBIGUOUS
private static final int PREFERENCE_AMBIGUOUSNo clear "easy" conversion- See Also:
-
debug
private static final boolean debug- See Also:
-
methods
MemberBox[] methods -
functionName
-
overloadCache
-
-
Constructor Details
-
NativeJavaMethod
NativeJavaMethod(MemberBox[] methods) -
NativeJavaMethod
-
NativeJavaMethod
-
NativeJavaMethod
-
-
Method Details
-
getFunctionName
- Overrides:
getFunctionNamein classBaseFunction
-
scriptSignature
-
decompile
Description copied from class:BaseFunctionDecompile the source information associated with this js function/script back into a string.- Overrides:
decompilein classBaseFunction- Parameters:
indent- How much to indent the decompiled result.flags- Flags specifying format of decompilation output.
-
toString
-
call
Description copied from class:BaseFunctionShould be overridden.- Specified by:
callin interfaceCallable- Specified by:
callin interfaceFunction- Overrides:
callin classBaseFunction- Parameters:
cx- the current Context for this threadscope- the scope to execute the function relative to. This is set to the value returned by getParentScope() except when the function is called from a closure.thisObj- the JavaScriptthisobjectargs- the array of arguments- Returns:
- the result of the call
-
findCachedFunction
-
findFunction
-
preferSignature
-
printDebug
-