org.jpy

## Class PyDictWrapper

- java.lang.Object
- - org.jpy.PyDictWrapper

- All Implemented Interfaces:
    AutoCloseable, Map<PyObject,PyObject>

      public class PyDictWrapper
      extends Object
      implements Map<PyObject,PyObject>, AutoCloseable

  A simple wrapper around PyObjects that are actually Python dictionaries, to present the most useful parts of a Map interface.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `Map.Entry<K,V>`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()`
    `void` | `close()`
    `boolean` | `containsKey(Object key)`
    `boolean` | `containsKey(PyObject key)`
    `boolean` | `containsKey(String key)` An extension to the Map interface that allows the use of String keys without generating warnings.
    `boolean` | `containsValue(Object value)`
    `PyDictWrapper` | `copy()` Copy this dictionary into a new dictionary.
    `void` | `delItem(Object key)`
    `Set<Map.Entry<PyObject,PyObject>>` | `entrySet()` Note: we are returning a COPY not a VIEW of the entries
    `PyObject` | `get(Object key)`
    `PyObject` | `get(String key)` An extension to the Map interface that allows the use of String keys without generating warnings.
    `PyObject` | `getItem(Object key)`
    `boolean` | `isEmpty()`
    `Set<PyObject>` | `keySet()` Note: we are returning a COPY not a VIEW of the keys
    `PyObject` | `put(PyObject key, PyObject value)`
    `void` | `putAll(Map<? extends PyObject,? extends PyObject> m)`
    `void` | `putObject(Object key, Object value)`
    `PyObject` | `remove(Object key)`
    `PyObject` | `remove(String key)`
    `void` | `setItem(Object key, Object value)`
    `int` | `size()`
    `PyObject` | `unwrap()` Gets the underlying PyObject.
    `Collection<PyObject>` | `values()` Note: we are returning a COPY not a VIEW of the values

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Map

      `compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll`

- - ### Method Detail

    - #### close

          public void close()

      Specified by:
        `close` in interface `AutoCloseable`

    - #### size

          public int size()

      Specified by:
        `size` in interface `Map<PyObject,PyObject>`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `Map<PyObject,PyObject>`

    - #### containsKey

          public boolean containsKey(Object key)

      Specified by:
        `containsKey` in interface `Map<PyObject,PyObject>`

    - #### containsKey

          public boolean containsKey(String key)

      An extension to the Map interface that allows the use of String keys without generating warnings.

    - #### containsKey

          public boolean containsKey(PyObject key)

    - #### containsValue

          public boolean containsValue(Object value)

      Specified by:
        `containsValue` in interface `Map<PyObject,PyObject>`

    - #### get

          public PyObject get(Object key)

      Specified by:
        `get` in interface `Map<PyObject,PyObject>`

    - #### get

          public PyObject get(String key)

      An extension to the Map interface that allows the use of String keys without generating warnings.

    - #### put

          public PyObject put(PyObject key,
                              PyObject value)

      Specified by:
        `put` in interface `Map<PyObject,PyObject>`

    - #### getItem

          public PyObject getItem(Object key)
                           throws KeyError

      Throws:
        `KeyError`

    - #### setItem

          public void setItem(Object key,
                              Object value)

    - #### putObject

          public void putObject(Object key,
                                Object value)

    - #### delItem

          public void delItem(Object key)

    - #### remove

          public PyObject remove(Object key)

      Specified by:
        `remove` in interface `Map<PyObject,PyObject>`

    - #### remove

          public PyObject remove(String key)

    - #### putAll

          public void putAll(Map<? extends PyObject,? extends PyObject> m)

      Specified by:
        `putAll` in interface `Map<PyObject,PyObject>`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `Map<PyObject,PyObject>`

    - #### keySet

          public Set<PyObject> keySet()

      Note: we are returning a COPY not a VIEW of the keys
      Specified by:
        `keySet` in interface `Map<PyObject,PyObject>`

    - #### values

          public Collection<PyObject> values()

      Note: we are returning a COPY not a VIEW of the values
      Specified by:
        `values` in interface `Map<PyObject,PyObject>`

    - #### entrySet

          public Set<Map.Entry<PyObject,PyObject>> entrySet()

      Note: we are returning a COPY not a VIEW of the entries
      Specified by:
        `entrySet` in interface `Map<PyObject,PyObject>`

    - #### unwrap

          public PyObject unwrap()

      Gets the underlying PyObject.
      Returns:
        the PyObject wrapped by this dictionary.

    - #### copy

          public PyDictWrapper copy()

      Copy this dictionary into a new dictionary.
      Returns:
        a wrapped copy of this Python dictionary.

Copyright © 2014–2022 Brockmann Consult GmbH. All rights reserved.