You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
print(list(byteArray)) # Java arrays can act like Python lists
63
63
```
64
64
65
+
In addition to the `type` builtin method, the `java` module, exposes the following
66
+
methods as well:
67
+
68
+
Builtin | Specification
69
+
--- | ---
70
+
`instanceof(obj, class)` | returns `True` if `obj` is an instance of `class` (`class` must be a foreign object class)
71
+
`is_function(obj)` | returns `True` if `obj` is a Java host language function wrapped using Truffle interop
72
+
`is_object(obj)` | returns `True` if `obj` if the argument is Java host language object wrapped using Truffle interop
73
+
`is_symbol(obj)` | returns `True` if `obj` if the argument is a Java host symbol, representing the constructor and static members of a Java class, as obtained by `java.type`
74
+
75
+
```python
76
+
import java
77
+
ArrayList = java.type('java.util.ArrayList')
78
+
my_list = ArrayList()
79
+
print(java.is_symbol(ArrayList)) # prints True
80
+
print(java.is_symbol(my_list)) # prints False, my_list is not a Java host symbol
81
+
print(java.is_object(ArrayList)) # prints True, symbols are also host objects
82
+
print(java.is_function(my_list.add))# prints True, the add method of ArrayList
83
+
print(java.instanceof(my_list, ArrayList)) # prints True
0 commit comments