KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > python > modules > _jython


1
2 package org.python.modules;
3
4 import org.python.core.*;
5
6 class JythonInternalFunctions extends PyBuiltinFunctionSet
7 {
8     public JythonInternalFunctions(String JavaDoc name, int index, int argcount) {
9         super(name, index, argcount, argcount, false, null);
10     }
11
12     public PyObject __call__(PyObject arg) {
13         switch (index) {
14         case 0:
15             if (!(arg instanceof PyJavaClass))
16                 throw Py.TypeError("is_lazy(): arg is not a jclass");
17             return Py.newBoolean(((PyJavaClass)arg).isLazy());
18         default:
19             throw argCountError(1);
20         }
21     }
22 }
23
24 public class _jython implements ClassDictInit
25 {
26     public static void classDictInit(PyObject dict) {
27         dict.__setitem__("is_lazy",
28                          new JythonInternalFunctions("is_lazy", 0, 1));
29     }
30
31 }
32
Popular Tags