javaclass

java/_object.py

180:08f709115552
2006-08-16 Paul Boddie Added packaging information.
     1 #!/usr/bin/env python     2      3 "Special module used to avoid circular imports."     4      5 class Object(object):     6     def getClass(self):     7         import java.lang.reflect     8         return java.lang.reflect.Class(self)     9     getClass___ = getClass    10     11 # NOTE: Establish a better exception hierarchy.    12     13 class Error(Object):    14     def __init__(self, *args):    15         self.args = args    16     17 setattr(Error, "__init_____", Error.__init__)    18 setattr(Error, "__init_____java__lang__String", Error.__init__)    19     20 class Exception(Object):    21     def __init__(self, *args):    22         self.args = args    23     24 setattr(Exception, "__init_____", Exception.__init__)    25 setattr(Exception, "__init_____java__lang__String", Exception.__init__)    26     27 class IndexOutOfBoundsException(Exception):    28     pass    29     30 setattr(IndexOutOfBoundsException, "__init_____", IndexOutOfBoundsException.__init__)    31 setattr(IndexOutOfBoundsException, "__init_____java__lang__String", IndexOutOfBoundsException.__init__)    32     33 class IllegalArgumentException(Exception):    34     pass    35     36 setattr(IllegalArgumentException, "__init_____", IllegalArgumentException.__init__)    37 setattr(IllegalArgumentException, "__init_____java__lang__String", IllegalArgumentException.__init__)    38     39 class NoSuchMethodException(Exception):    40     pass    41     42 setattr(NoSuchMethodException, "__init_____", NoSuchMethodException.__init__)    43 setattr(NoSuchMethodException, "__init_____java__lang__String", NoSuchMethodException.__init__)    44     45 class NullPointerException(Exception):    46     pass    47     48 setattr(NullPointerException, "__init_____", NullPointerException.__init__)    49 setattr(NullPointerException, "__init_____java__lang__String", NullPointerException.__init__)    50     51 class SecurityException(Exception):    52     pass    53     54 setattr(SecurityException, "__init_____", SecurityException.__init__)    55 setattr(SecurityException, "__init_____java__lang__String", SecurityException.__init__)    56     57 # vim: tabstop=4 expandtab shiftwidth=4