Class NativeWeakMap

  • All Implemented Interfaces:
    java.io.Serializable, ConstProperties, DebuggableObject, IdFunctionCall, Scriptable, SymbolScriptable

    public class NativeWeakMap
    extends IdScriptableObject
    This is an implementation of the ES6 WeakMap class. As per the spec, keys must be ordinary objects. Since there is no defined "equality" for objects, comparisions are done strictly by object equality. Both ES6 and the java.util.WeakHashMap class have the same basic structure -- entries are removed automatically when the sole remaining reference to the key is a weak reference. Therefore, we can use WeakHashMap as the basis of this implementation and preserve the same semantics.
    See Also:
    Serialized Form
    • Constructor Detail

      • NativeWeakMap

        public NativeWeakMap()
    • Method Detail

      • init

        static void init​(Scriptable scope,
                         boolean sealed)
      • getClassName

        public java.lang.String getClassName()
        Description copied from class: ScriptableObject
        Return the name of the class.

        This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.

        Specified by:
        getClassName in interface Scriptable
        Specified by:
        getClassName in class ScriptableObject
      • js_delete

        private java.lang.Object js_delete​(java.lang.Object key)
      • js_get

        private java.lang.Object js_get​(java.lang.Object key)
      • js_has

        private java.lang.Object js_has​(java.lang.Object key)
      • js_set

        private java.lang.Object js_set​(java.lang.Object key,
                                        java.lang.Object v)
      • readObject

        private void readObject​(java.io.ObjectInputStream stream)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException