convert camel case to snake case and vice versa
import re
-import warnings
first_cap_re = re.compile('(.)([A-Z][a-z]+)')
all_cap_re = re.compile('([a-z0-9])([A-Z])')
@@ -14,11 +13,10 @@ class JavaObjectWrapper:
def __getattr__(self, k):
python_name = JavaObjectWrapper.__get_python_name(k)
- if python_name in self.__dict__:
- return self.__dict__[python_name]
+ if python_name in self.__class__.__dict__:
+ return getattr(self, python_name)
java_name = JavaObjectWrapper.__get_java_name(k)
- warnings.warn("A python wrapper for {} does not exist so it may return a Java Object".format(java_name))
return self.unwrap().__getattr__(java_name)
def unwrap(self):
@@ -49,16 +47,6 @@ class JavaList(JavaObjectWrapper):
def __init__(self, java_list):
super(JavaList, self).__init__(java_list)
- def contains(self, py_element):
- return self.unwrap().contains(py_element.unwrap())
-
- def get(self, index):
- return JavaObjectWrapper(self.unwrap().get(index))
-
-
class JavaSet(JavaObjectWrapper):
def __init__(self, java_set):
super(JavaSet, self).__init__(java_set)
-
- def contains(self, py_element):
- return self.unwrap().contains(py_element.unwrap())
