Package jp.vmi.script

Class JSMap<K,​V>

java.lang.Object
java.util.AbstractMap<K,​V>
jp.vmi.script.JSMap<K,​V>
Type Parameters:
K - the type of key.
V - the type of value.
All Implemented Interfaces:
Map<K,​V>

public class JSMap<K,​V>
extends AbstractMap<K,​V>
Wrapper for JavaScript map.
  • Constructor Details

    • JSMap

      public JSMap​(ScriptEngine engine, Object object)
      Constructor.
      Parameters:
      engine - script engine.
      object - JavaScript object.
  • Method Details

    • get

      public V get​(Object key)
      Specified by:
      get in interface Map<K,​V>
      Overrides:
      get in class AbstractMap<K,​V>
    • entrySet

      public Set<Map.Entry<K,​V>> entrySet()
      Specified by:
      entrySet in interface Map<K,​V>
      Specified by:
      entrySet in class AbstractMap<K,​V>
    • unwrap

      public Object unwrap()
      Unwrap object.
      Returns:
      unwrapped object.
    • toMap

      public static <K,​ V> Map<K,​V> toMap​(ScriptEngine engine, Object object)
      JavaScript object to Map.
      Type Parameters:
      K - the type of key.
      V - the type of value.
      Parameters:
      engine - Script engine.
      object - JavaScript object.
      Returns:
      Map object.