예제 #1
0
def _javaGetAttr(self, name):
    try:
        r = object.__getattribute__(self, name)
    except AttributeError as ex:
        if name in dir(self.__class__.__metaclass__):
            r = object.__getattribute__(self.__class__, name)
        else:
            raise ex

    if isinstance(r, _jpype._JavaMethod):
        return _jpype._JavaBoundMethod(r, self)
    return r
예제 #2
0
파일: _jclass.py 프로젝트: Sunyifan/jpype
def _javaGetAttr(self, name):
    try:
        r = object.__getattribute__(self, name)
    except AttributeError as ex:
        if name in dir(self.__class__.__metaclass__):
            r = object.__getattribute__(self.__class__, name)
        else:
            raise ex

    if isinstance(r, _jpype._JavaMethod):
        return _jpype._JavaBoundMethod(r, self)
    return r
	if len(args) == 1 and isinstance(args[0], tuple) and args[0][0] is _SPECIAL_CONSTRUCTOR_KEY :
		self.__javaobject__ = args[0][1]
	else:
		self.__javaobject__ = self.__class__.__javaclass__.newClassInstance(*args)
	
def _javaGetAttr(self, name) :
	try :
		r = object.__getattribute__(self, name)
	except AttributeError, ex :
		if name in dir(self.__class__.__metaclass__) :
			r = object.__getattribute__(self.__class__, name)
		else:
			raise ex
		
	if isinstance(r, _jpype._JavaMethod) :
		return _jpype._JavaBoundMethod(r, self) 
	return r

class _JavaClass(type) :  
	def __new__(mcs, jc) :
		bases = []
		name = jc.getName()
		
		static_fields = {}
		constants = []
		members = {
			"__javaclass__" : jc,
			"__init__" : _javaInit,
			"__str__" : lambda self : self.toString(),
			"__hash__" : lambda self : self.hashCode(),
			"__eq__" : lambda self, o : self.equals(o),
예제 #4
0
	if len(args) == 1 and isinstance(args[0], tuple) and args[0][0] is _SPECIAL_CONSTRUCTOR_KEY :
		self.__javaobject__ = args[0][1]
	else:
		self.__javaobject__ = self.__class__.__javaclass__.newClassInstance(*args)
	
def _javaGetAttr(self, name) :
	try :
		r = object.__getattribute__(self, name)
	except AttributeError, ex :
		if name in dir(self.__class__.__metaclass__) :
			r = object.__getattribute__(self.__class__, name)
		else:
			raise ex
		
	if isinstance(r, _jpype._JavaMethod) :
		return _jpype._JavaBoundMethod(r, self) 
	return r

class _JavaClass(type) :  
	def __new__(mcs, jc) :
		bases = []
		name = jc.getName()
		
		static_fields = {}
		constants = []
		members = {
			"__javaclass__" : jc,
			"__init__" : _javaInit,
			"__str__" : lambda self : self.toString(),
			"__hash__" : lambda self : self.hashCode(),
			"__eq__" : lambda self, o : self.equals(o),