1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
/* Copyright (c) 2008 Jython Developers */
package org.python.core;
import org.python.expose.ExposedMethod;
import org.python.expose.ExposedType;
import org.python.expose.MethodType;
/**
* Readonly proxy for dictionaries (actually any mapping).
*
*/
@ExposedType(name = "dictproxy", isBaseType = false)
public class PyDictProxy extends PyObject {
/** The dict proxied to. */
PyObject dict;
public PyDictProxy(PyObject dict) {
super();
this.dict = dict;
}
@Override
public PyObject __iter__() {
return dict.__iter__();
}
@Override
public PyObject __finditem__(PyObject key) {
return dict.__finditem__(key);
}
@Override
public int __len__() {
return dict.__len__();
}
@ExposedMethod
public PyObject dictproxy___getitem__(PyObject key) {
return dict.__getitem__(key);
}
@ExposedMethod
public boolean dictproxy___contains__(PyObject value) {
return dict.__contains__(value);
}
@ExposedMethod
public boolean dictproxy_has_key(PyObject key) {
return dict.__contains__(key);
}
@ExposedMethod(defaults = "Py.None")
public PyObject dictproxy_get(PyObject key, PyObject default_object) {
return dict.invoke("get", key, default_object);
}
@ExposedMethod
public PyObject dictproxy_keys() {
return dict.invoke("keys");
}
@ExposedMethod
public PyObject dictproxy_values() {
return dict.invoke("values");
}
@ExposedMethod
public PyObject dictproxy_items() {
return dict.invoke("items");
}
@ExposedMethod
public PyObject dictproxy_iterkeys() {
return dict.invoke("iterkeys");
}
@ExposedMethod
public PyObject dictproxy_itervalues() {
return dict.invoke("itervalues");
}
@ExposedMethod
public PyObject dictproxy_iteritems() {
return dict.invoke("iteritems");
}
@ExposedMethod
public PyObject dictproxy_copy() {
return dict.invoke("copy");
}
@Override
public int __cmp__(PyObject other) {
return dictproxy___cmp__(other);
}
@ExposedMethod(type = MethodType.CMP)
public int dictproxy___cmp__(PyObject other) {
return dict._cmp(other);
}
@ExposedMethod(type = MethodType.BINARY)
public PyObject dictproxy___lt__(PyObject other) {
return dict.__lt__(other);
}
@ExposedMethod(type = MethodType.BINARY)
public PyObject dictproxy___le__(PyObject other) {
return dict.__le__(other);
}
@ExposedMethod(type = MethodType.BINARY)
public PyObject dictproxy___eq__(PyObject other) {
return dict.__eq__(other);
}
@ExposedMethod(type = MethodType.BINARY)
public PyObject dictproxy___ne__(PyObject other) {
return dict.__ne__(other);
}
@ExposedMethod(type = MethodType.BINARY)
public PyObject dictproxy___gt__(PyObject other) {
return dict.__gt__(other);
}
@ExposedMethod(type = MethodType.BINARY)
public PyObject dictproxy___ge__(PyObject other) {
return dict.__ge__(other);
}
@Override
@ExposedMethod
public PyString __str__() {
return dict.__str__();
}
@Override
public boolean isMappingType() {
return true;
}
@Override
public boolean isSequenceType() {
return false;
}
}
|