Package org.mozilla.javascript
Class NativeJavaPackage
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.NativeJavaPackage
- All Implemented Interfaces:
Serializable,ConstProperties,DebuggableObject,Scriptable,SymbolScriptable
- Direct Known Subclasses:
NativeJavaTopPackage
This class reflects Java packages into the JavaScript environment. We lazily reflect classes and
subpackages, and use a caching/sharing system to ensure that members reflected into one
JavaPackage appear in all other references to the same package (as with Packages.java.lang and
java.lang).
- Author:
- Mike Shaver
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject
ScriptableObject.KeyComparator -
Field Summary
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND -
Constructor Summary
ConstructorsConstructorDescriptionNativeJavaPackage(String packageName) Deprecated.NativeJavaPackage is an internal class, do not use it directly.NativeJavaPackage(String packageName, ClassLoader classLoader) Deprecated.NativeJavaPackage is an internal class, do not use it directly. -
Method Summary
Modifier and TypeMethodDescriptionbooleanget(int index, Scriptable start) Returns the value of the indexed property or NOT_FOUND.get(String id, Scriptable start) Returns the value of the named property or NOT_FOUND.Return the name of the class.getDefaultValue(Class<?> ignored) Implements the [[DefaultValue]] internal method.booleanhas(int index, Scriptable start) Returns true if the property index is defined.booleanhas(String id, Scriptable start) Returns true if the named property is defined.inthashCode()voidput(int index, Scriptable start, Object value) Sets the value of the indexed property, creating it if need be.voidput(String id, Scriptable start, Object value) Sets the value of the named property, creating it if need be.toString()Methods inherited from class org.mozilla.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasInstance, 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, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
Constructor Details
-
NativeJavaPackage
Deprecated.NativeJavaPackage is an internal class, do not use it directly. -
NativeJavaPackage
Deprecated.NativeJavaPackage is an internal class, do not use it directly.
-
-
Method Details
-
getClassName
Description copied from class:ScriptableObjectReturn the name of the class.This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.
- Specified by:
getClassNamein interfaceScriptable- Specified by:
getClassNamein classScriptableObject
-
has
Description copied from class:ScriptableObjectReturns true if the named property is defined.- Specified by:
hasin interfaceScriptable- Overrides:
hasin classScriptableObject- Parameters:
id- the name of the propertystart- the object in which the lookup began- Returns:
- true if and only if the property was found in the object
- See Also:
-
has
Description copied from class:ScriptableObjectReturns true if the property index is defined.- Specified by:
hasin interfaceScriptable- Overrides:
hasin classScriptableObject- Parameters:
index- the numeric index for the propertystart- the object in which the lookup began- Returns:
- true if and only if the property was found in the object
- See Also:
-
put
Description copied from class:ScriptableObjectSets the value of the named property, creating it if need be.If the property was created using defineProperty, the appropriate setter method is called.
If the property's attributes include READONLY, no action is taken. This method will actually set the property in the start object.
- Specified by:
putin interfaceScriptable- Overrides:
putin classScriptableObject- Parameters:
id- the name of the propertystart- the object whose property is being setvalue- value to set the property to- See Also:
-
put
Description copied from class:ScriptableObjectSets the value of the indexed property, creating it if need be.- Specified by:
putin interfaceScriptable- Overrides:
putin classScriptableObject- Parameters:
index- the numeric index for the propertystart- the object whose property is being setvalue- value to set the property to- See Also:
-
get
Description copied from class:ScriptableObjectReturns the value of the named property or NOT_FOUND.If the property was created using defineProperty, the appropriate getter method is called.
- Specified by:
getin interfaceScriptable- Overrides:
getin classScriptableObject- Parameters:
id- the name of the propertystart- the object in which the lookup began- Returns:
- the value of the property (may be null), or NOT_FOUND
- See Also:
-
get
Description copied from class:ScriptableObjectReturns the value of the indexed property or NOT_FOUND.- Specified by:
getin interfaceScriptable- Overrides:
getin classScriptableObject- Parameters:
index- the numeric index for the propertystart- the object in which the lookup began- Returns:
- the value of the property (may be null), or NOT_FOUND
- See Also:
-
getDefaultValue
Description copied from class:ScriptableObjectImplements the [[DefaultValue]] internal method.Note that the toPrimitive conversion is a no-op for every type other than Object, for which [[DefaultValue]] is called. See ECMA 9.1.
A
hintof null means "no hint".- Specified by:
getDefaultValuein interfaceScriptable- Overrides:
getDefaultValuein classScriptableObject- Parameters:
ignored- the type hint- Returns:
- the default value for the object
See ECMA 8.6.2.6.
-
toString
-
equals
-
hashCode
public int hashCode()
-