Class ScriptableMap

  • All Implemented Interfaces:
    java.io.Serializable, org.mozilla.javascript.Scriptable, org.mozilla.javascript.SymbolScriptable, org.mozilla.javascript.Wrapper

    public class ScriptableMap
    extends org.mozilla.javascript.NativeJavaObject
    ScriptableMap is a wrapper for java.util.Map instances that allows developers to interact with them as if it were a native JavaScript object.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class org.mozilla.javascript.NativeJavaObject

        isAdapter, javaObject, members, parent, prototype, staticType
      • Fields inherited from interface org.mozilla.javascript.Scriptable

        NOT_FOUND
    • Constructor Summary

      Constructors 
      Constructor Description
      ScriptableMap​(org.mozilla.javascript.Scriptable scope, java.util.Map map)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void delete​(int index)  
      void delete​(java.lang.String name)  
      java.lang.Object get​(int index, org.mozilla.javascript.Scriptable start)  
      java.lang.Object get​(java.lang.String name, org.mozilla.javascript.Scriptable start)  
      java.lang.String getClassName()  
      java.lang.Object getDefaultValue​(java.lang.Class typeHint)  
      java.lang.Object[] getIds()  
      java.util.Map getMap()  
      boolean has​(int index, org.mozilla.javascript.Scriptable start)  
      boolean has​(java.lang.String name, org.mozilla.javascript.Scriptable start)  
      static void init​(org.mozilla.javascript.Scriptable scope)  
      protected void initPrototype​(org.mozilla.javascript.Scriptable scope)
      Set the prototype to the Object prototype so we can use object methods such as getOwnPropertyNames, hasOwnProperty, keys etc.
      void put​(int index, org.mozilla.javascript.Scriptable start, java.lang.Object value)  
      void put​(java.lang.String name, org.mozilla.javascript.Scriptable start, java.lang.Object value)  
      java.lang.String toString()  
      java.lang.Object unwrap()  
      • Methods inherited from class org.mozilla.javascript.NativeJavaObject

        canConvert, coerceType, createInterfaceAdapter, delete, get, getParentScope, getPrototype, has, hasInstance, initMembers, put, setParentScope, setPrototype, wrap
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ScriptableMap

        public ScriptableMap​(org.mozilla.javascript.Scriptable scope,
                             java.util.Map map)
    • Method Detail

      • init

        public static void init​(org.mozilla.javascript.Scriptable scope)
                         throws java.lang.NoSuchMethodException
        Throws:
        java.lang.NoSuchMethodException
      • initPrototype

        protected void initPrototype​(org.mozilla.javascript.Scriptable scope)
        Set the prototype to the Object prototype so we can use object methods such as getOwnPropertyNames, hasOwnProperty, keys etc.
        Parameters:
        scope - the global scope for looking up the Object constructor
      • get

        public java.lang.Object get​(java.lang.String name,
                                    org.mozilla.javascript.Scriptable start)
        Specified by:
        get in interface org.mozilla.javascript.Scriptable
        Overrides:
        get in class org.mozilla.javascript.NativeJavaObject
      • get

        public java.lang.Object get​(int index,
                                    org.mozilla.javascript.Scriptable start)
        Specified by:
        get in interface org.mozilla.javascript.Scriptable
        Overrides:
        get in class org.mozilla.javascript.NativeJavaObject
      • has

        public boolean has​(java.lang.String name,
                           org.mozilla.javascript.Scriptable start)
        Specified by:
        has in interface org.mozilla.javascript.Scriptable
        Overrides:
        has in class org.mozilla.javascript.NativeJavaObject
      • has

        public boolean has​(int index,
                           org.mozilla.javascript.Scriptable start)
        Specified by:
        has in interface org.mozilla.javascript.Scriptable
        Overrides:
        has in class org.mozilla.javascript.NativeJavaObject
      • put

        public void put​(java.lang.String name,
                        org.mozilla.javascript.Scriptable start,
                        java.lang.Object value)
        Specified by:
        put in interface org.mozilla.javascript.Scriptable
        Overrides:
        put in class org.mozilla.javascript.NativeJavaObject
      • put

        public void put​(int index,
                        org.mozilla.javascript.Scriptable start,
                        java.lang.Object value)
        Specified by:
        put in interface org.mozilla.javascript.Scriptable
        Overrides:
        put in class org.mozilla.javascript.NativeJavaObject
      • delete

        public void delete​(java.lang.String name)
        Specified by:
        delete in interface org.mozilla.javascript.Scriptable
        Overrides:
        delete in class org.mozilla.javascript.NativeJavaObject
      • delete

        public void delete​(int index)
        Specified by:
        delete in interface org.mozilla.javascript.Scriptable
        Overrides:
        delete in class org.mozilla.javascript.NativeJavaObject
      • getIds

        public java.lang.Object[] getIds()
        Specified by:
        getIds in interface org.mozilla.javascript.Scriptable
        Overrides:
        getIds in class org.mozilla.javascript.NativeJavaObject
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getDefaultValue

        public java.lang.Object getDefaultValue​(java.lang.Class typeHint)
        Specified by:
        getDefaultValue in interface org.mozilla.javascript.Scriptable
        Overrides:
        getDefaultValue in class org.mozilla.javascript.NativeJavaObject
      • unwrap

        public java.lang.Object unwrap()
        Specified by:
        unwrap in interface org.mozilla.javascript.Wrapper
        Overrides:
        unwrap in class org.mozilla.javascript.NativeJavaObject
      • getMap

        public java.util.Map getMap()
      • getClassName

        public java.lang.String getClassName()
        Specified by:
        getClassName in interface org.mozilla.javascript.Scriptable
        Overrides:
        getClassName in class org.mozilla.javascript.NativeJavaObject