Class ScriptableMap

java.lang.Object
org.mozilla.javascript.NativeJavaObject
com.randomnoun.common.jessop.engine.rhino.ScriptableMap
All Implemented Interfaces:
Serializable, org.mozilla.javascript.Scriptable, 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:
  • Field Summary

    Fields inherited from class org.mozilla.javascript.NativeJavaObject

    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, Map map)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(int index)
     
    void
    delete(String name)
     
    get(int index, org.mozilla.javascript.Scriptable start)
     
    get(String name, org.mozilla.javascript.Scriptable start)
     
     
     
     
     
    boolean
    has(int index, org.mozilla.javascript.Scriptable start)
     
    boolean
    has(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, Object value)
     
    void
    put(String name, org.mozilla.javascript.Scriptable start, Object value)
     
     
     

    Methods inherited from class org.mozilla.javascript.NativeJavaObject

    canConvert, coerceType, getParentScope, getPrototype, hasInstance, initMembers, setParentScope, setPrototype, wrap

    Methods inherited from class java.lang.Object

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

    • ScriptableMap

      public ScriptableMap(org.mozilla.javascript.Scriptable scope, Map map)
  • Method Details

    • init

      public static void init(org.mozilla.javascript.Scriptable scope) throws NoSuchMethodException
      Throws:
      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 Object get(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 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(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(String name, org.mozilla.javascript.Scriptable start, 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, Object value)
      Specified by:
      put in interface org.mozilla.javascript.Scriptable
      Overrides:
      put in class org.mozilla.javascript.NativeJavaObject
    • delete

      public void delete(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 Object[] getIds()
      Specified by:
      getIds in interface org.mozilla.javascript.Scriptable
      Overrides:
      getIds in class org.mozilla.javascript.NativeJavaObject
    • toString

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

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

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

      public Map getMap()
    • getClassName

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