File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,16 @@ function listmethods(obj::JavaObject)
79
79
jcall (cls, " getMethods" , Vector{JMethod}, ())
80
80
end
81
81
82
+ function listmethods {C} (:: Type{JavaObject{C}} )
83
+ cls = classforname (string (C))
84
+ jcall (cls, " getMethods" , Vector{JMethod}, ())
85
+ end
86
+
87
+ function listmethods (cls:: JClass )
88
+ jcall (cls, " getMethods" , Vector{JMethod}, ())
89
+ end
90
+
91
+
82
92
"""
83
93
```
84
94
listmethods(obj::JavaObject, name::AbstractString)
@@ -92,7 +102,7 @@ Lists the methods that are available on the java object passed. The methods are
92
102
### Returns
93
103
List of methods available on the java object and matching the name passed
94
104
"""
95
- function listmethods (obj:: JavaObject , name:: AbstractString )
105
+ function listmethods {C} (obj:: Union{ JavaObject{C}, Type{JavaObject{C}}} , name:: AbstractString )
96
106
allmethods = listmethods (obj)
97
107
filter (m -> getname (m) == name, allmethods)
98
108
end
Original file line number Diff line number Diff line change 142
142
143
143
@test length (listmethods (JString (" test" ))) >= 72
144
144
@test length (listmethods (JString (" test" ), " indexOf" )) >= 3
145
+ # the same for the type
146
+ @test length (listmethods (JString)) >= 72
147
+ @test length (listmethods (JString, " indexOf" )) >= 3
148
+ # the same for class
149
+ @test length (listmethods (getclass (JString (" test" )))) >= 72
150
+ @test length (listmethods (getclass (JString (" test" )), " indexOf" )) >= 3
145
151
m = listmethods (JString (" test" ), " indexOf" )[1 ]
146
152
@test getname (getreturntype (m)) == " int"
147
153
@test [getname (typ) for typ in getparametertypes (m)] == [" java.lang.String" , " int" ]
You can’t perform that action at this time.
0 commit comments