KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > python > core > PyStaticMethod


1 package org.python.core;
2
3 public class PyStaticMethod extends PyObject implements PyType.Newstyle {
4
5     /* type info */
6     public final static String JavaDoc exposed_name = "staticmethod";
7     
8     public static void typeSetup(PyObject dict, PyType.Newstyle marker) {
9         // xxx __get__
10
// xxx __init__
11

12         dict
13             .__setitem__(
14                 "__new__",
15                 new PyNewWrapper(PyStaticMethod.class, "__new__", 1, 1) {
16             public PyObject new_impl(
17                 boolean init,
18                 PyType subtype,
19                 PyObject[] args,
20                 String JavaDoc[] keywords) {
21                     if (keywords.length != 0 || args.length!=1) {
22                         throw info.unexpectedCall(args.length,keywords.length!=0);
23                     }
24                     return new PyStaticMethod(args[0]);
25             } // xxx subclassing
26
});
27     }
28     
29     protected PyObject callable;
30     
31     public PyStaticMethod(PyObject callable) {
32         this.callable = callable;
33     }
34     
35     /*
36      * @see org.python.core.PyObject#__get__(org.python.core.PyObject, org.python.core.PyObject)
37      */

38     public PyObject __get__(PyObject obj, PyObject type) {
39         return callable;
40     }
41
42 }
43
Popular Tags