File tree 2 files changed +7
-0
lines changed
2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,12 @@ var Nashorn2 = Java.type('com.winterbe.java8.Nashorn2');
2
2
var result = Nashorn2 . fun ( 'John Doe' ) ;
3
3
print ( '\n' + result ) ;
4
4
5
+ Nashorn2 . fun2 ( 123 ) ;
6
+ Nashorn2 . fun2 ( 49.99 ) ;
7
+ Nashorn2 . fun2 ( true ) ;
8
+ Nashorn2 . fun2 ( "hi there" )
9
+ Nashorn2 . fun2 ( String ( "bam" ) )
10
+ Nashorn2 . fun2 ( new Number ( 23 ) ) ;
5
11
Nashorn2 . fun2 ( new Date ( ) ) ;
6
12
Nashorn2 . fun2 ( new RegExp ( ) ) ;
7
13
Nashorn2 . fun2 ( { foo : 'bar' } ) ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ public static void main(String[] args) throws Exception {
21
21
Invocable invocable = (Invocable ) engine ;
22
22
Object result = invocable .invokeFunction ("fun1" , "Peter Parker" );
23
23
System .out .println (result );
24
+ System .out .println (result .getClass ());
24
25
25
26
invocable .invokeFunction ("fun2" , new Date ());
26
27
invocable .invokeFunction ("fun2" , LocalDateTime .now ());
You can’t perform that action at this time.
0 commit comments