OLD | NEW |
1 /* Generated file, do not modify. See jython/src/templates/gderived.py. */ | 1 /* Generated file, do not modify. See jython/src/templates/gderived.py. */ |
2 package org.python.modules.collections; | 2 package org.python.modules.collections; |
3 | 3 |
4 import org.python.core.*; | 4 import org.python.core.*; |
5 | 5 |
6 public class PyDefaultDictDerived extends PyDefaultDict implements Slotted { | 6 public class PyDefaultDictDerived extends PyDefaultDict implements Slotted { |
7 | 7 |
8 public PyObject getSlot(int index) { | 8 public PyObject getSlot(int index) { |
9 return slots[index]; | 9 return slots[index]; |
10 } | 10 } |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 return this; | 1106 return this; |
1107 } | 1107 } |
1108 // Otherwise, we call the derived __tojava__, if it exists: | 1108 // Otherwise, we call the derived __tojava__, if it exists: |
1109 PyType self_type=getType(); | 1109 PyType self_type=getType(); |
1110 PyObject impl=self_type.lookup("__tojava__"); | 1110 PyObject impl=self_type.lookup("__tojava__"); |
1111 if (impl!=null) | 1111 if (impl!=null) |
1112 return impl.__get__(this,self_type).__call__(Py.java2py(c)).__tojava
__(Object.class); | 1112 return impl.__get__(this,self_type).__call__(Py.java2py(c)).__tojava
__(Object.class); |
1113 return super.__tojava__(c); | 1113 return super.__tojava__(c); |
1114 } | 1114 } |
1115 | 1115 |
| 1116 public Object __coerce_ex__(PyObject o) { |
| 1117 PyType self_type=getType(); |
| 1118 PyObject impl=self_type.lookup("__coerce__"); |
| 1119 if (impl!=null) { |
| 1120 PyObject res=impl.__get__(this,self_type).__call__(o); |
| 1121 if (res==null||res==Py.None) |
| 1122 return res; |
| 1123 if (!(res instanceof PyTuple)) |
| 1124 throw Py.TypeError("coercion should return None or 2-tuple"); |
| 1125 return((PyTuple)res).getArray(); |
| 1126 } |
| 1127 return super.__coerce_ex__(o); |
| 1128 } |
| 1129 |
1116 public String toString() { | 1130 public String toString() { |
1117 PyType self_type=getType(); | 1131 PyType self_type=getType(); |
1118 PyObject impl=self_type.lookup("__repr__"); | 1132 PyObject impl=self_type.lookup("__repr__"); |
1119 if (impl!=null) { | 1133 if (impl!=null) { |
1120 PyObject res=impl.__get__(this,self_type).__call__(); | 1134 PyObject res=impl.__get__(this,self_type).__call__(); |
1121 if (!(res instanceof PyString)) | 1135 if (!(res instanceof PyString)) |
1122 throw Py.TypeError("__repr__ returned non-string (type "+res.get
Type().fastGetName()+")"); | 1136 throw Py.TypeError("__repr__ returned non-string (type "+res.get
Type().fastGetName()+")"); |
1123 return((PyString)res).toString(); | 1137 return((PyString)res).toString(); |
1124 } | 1138 } |
1125 return super.toString(); | 1139 return super.toString(); |
1126 } | 1140 } |
1127 | 1141 |
1128 } | 1142 } |
OLD | NEW |