DictionaryAdapter

public class DictionaryAdapter extends PythonAdapter

Object that is represented by a python dictionary (or OrderedDict) and usually obtained as a row from database. Each of the classes should implement static method create(PyObject) which returns null if underlying Python object is None. There should be no public constructor in child classes.

Constructors

DictionaryAdapter

public DictionaryAdapter(PyObject object)

Methods

asMap

public SortedMap asMap()

Map python dictionary to java map. Motivation: Binding for MATLAB.

get

public PyObject get(String key)

Get dictionary value indexed by key as python object.

getDictKeys

public String[] getDictKeys()

Get list of dictionary keys. Motivation: Binding for IDL.

Returns:Array of keys in the order they are stored in by Python.

getDictValue

public Object getDictValue(String key)

Get dictionary value indexed by key as “Java native” object. Motivation: Binding for IDL.

See also: PythonUtils.asNative(org.python.core.PyObject)

getDictValueAsDouble

public double getDictValueAsDouble(String key)

Get dictionary value indexed by key as double. Motivation: Binding for IDL.

getDictValueAsLong

public long getDictValueAsLong(String key)

Get dictionary value indexed by key as long. Motivation: Binding for IDL.

getDictValueAsString

public String getDictValueAsString(String key)

Get dictionary value indexed by key as string. Motivation: Binding for IDL.