Skip to content

Commit 6a7c4d8

Browse files
committed
Support Integer and Boolean class types
1 parent 1dc4427 commit 6a7c4d8

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

javaobj/core.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,6 +1709,35 @@ def __extra_loading__(self, unmarshaller, ident=0):
17091709
# Lists have their content in there annotations
17101710
self.extend(self.annotations[1:])
17111711

1712+
class JavaBool(JavaObject):
1713+
def __init__(self, unmarshaller):
1714+
JavaObject.__init__(self)
1715+
self.value = None
1716+
pass
1717+
1718+
def __str__(self):
1719+
return self.value.__str__()
1720+
1721+
def __repr__(self):
1722+
return self.value.__repr__()
1723+
1724+
def __bool__(self):
1725+
return self.value
1726+
1727+
class JavaInt(JavaObject):
1728+
def __init__(self, unmarshaller):
1729+
self.value = None
1730+
JavaObject.__init__(self)
1731+
1732+
def __str__(self):
1733+
return self.value.__str__()
1734+
1735+
def __repr__(self):
1736+
return self.value.__repr__()
1737+
1738+
def __int__(self):
1739+
return self.value
1740+
17121741
class JavaMap(dict, JavaObject):
17131742
"""
17141743
Python-Java dictionary/map bridge type
@@ -1955,6 +1984,8 @@ def do_period(self, unmarshaller, data):
19551984
"java.util.HashSet": JavaSet,
19561985
"java.util.TreeSet": JavaTreeSet,
19571986
"java.time.Ser": JavaTime,
1987+
"java.lang.Boolean": JavaBool,
1988+
"java.lang.Integer": JavaInt,
19581989
}
19591990

19601991
def create(self, classdesc, unmarshaller=None):

0 commit comments

Comments
 (0)