javaclass

Change of javaclass/classfile.py

141:c05daf6bcace
javaclass/classfile.py
     1.1 --- a/javaclass/classfile.py	Sat Jan 22 23:34:27 2005 +0100
     1.2 +++ b/javaclass/classfile.py	Sat Jan 22 23:34:57 2005 +0100
     1.3 @@ -48,6 +48,19 @@
     1.4      "[" : "list"
     1.5      }
     1.6  
     1.7 +type_names_to_default_values = {
     1.8 +    "int" : 0,
     1.9 +    "str" : u"",
    1.10 +    "float" : 0.0,
    1.11 +    "object" : None,
    1.12 +    "bool" : 0, # NOTE: Should be False.
    1.13 +    "list" : []
    1.14 +    }
    1.15 +
    1.16 +def get_default_for_type(type_name):
    1.17 +    global type_names_to_default_values
    1.18 +    return type_names_to_default_values.get(type_name)
    1.19 +
    1.20  PUBLIC, PRIVATE, PROTECTED, STATIC, FINAL,  SUPER,  SYNCHRONIZED, VOLATILE, TRANSIENT, NATIVE, INTERFACE, ABSTRACT, STRICT = \
    1.21  0x0001, 0x0002,  0x0004,    0x0008, 0x0010, 0x0020, 0x0020,       0x0040,   0x0080,    0x0100, 0x0200,    0x0400,   0x0800
    1.22