KickJava   Java API By Example, From Geeks To Geeks.

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


1 // Copyright (c) Corporation for National Research Initiatives
2
package org.python.core;
3
4 /**
5  * A class representing the singleton None object,
6  */

7 public class PyNone extends PySingleton
8 {
9     PyNone() {
10         super("None");
11     }
12
13     public boolean __nonzero__() {
14         return false;
15     }
16
17     public Object JavaDoc __tojava__(Class JavaDoc c) {
18         //Danger here. java.lang.Object gets null not None
19
if (c == PyObject.class)
20             return this;
21         if (c.isPrimitive())
22             return Py.NoConversion;
23         return null;
24     }
25
26     public String JavaDoc safeRepr() throws PyIgnoreMethodTag {
27         return "'None' object";
28     }
29
30     public boolean isMappingType() { return false; }
31     public boolean isSequenceType() { return false; }
32     public boolean isNumberType() { return false; }
33     public String JavaDoc asStringOrNull(int index) { return null; }
34 }
35
Popular Tags