|
1 This directory contains samples for Dynalink API (http://openjdk.java.net/jeps/276). |
|
2 These samples require a jar file to be built and such jars be placed in the |
|
3 classpath of the jjs tool. Linker samples are named with the naming pattern |
|
4 "xyz_linker.js". These scripts build dynalink linker jar from java code and exec |
|
5 another jjs process with appropriate classpath set. |
|
6 |
|
7 Note: you need to build jdk9 forest and put "images/jdk/bin" in your PATH to use |
|
8 these scripts. This is because these scripts use javac to build dynalink jar and |
|
9 exec another jjs with classpath set! Alternatively, you can also manually build |
|
10 dynalink linker jars and invoke sample scripts by putting linker jar in jjs tool's |
|
11 classpath as well. |
|
12 |
|
13 Dynalink samples: |
|
14 |
|
15 * array_stream_linker.js |
|
16 |
|
17 This sample builds ArrayStreamLinkerExporter.java and uses it in a sample script |
|
18 called "array_stream.js". This linker adds "stream" property to Java array |
|
19 objects. The "stream" property returns appropriate Stream type for the given |
|
20 Java array (IntStream, DoubleStream ...). |
|
21 |
|
22 * buffer_indexing_linker.js |
|
23 |
|
24 This sample builds BufferIndexingLinkerExporter.java and uses it in a sample script |
|
25 called "buffer_index.js". This linker adds array-like indexed access, indexed assignment |
|
26 and "length" property to Java NIO Buffer objects. Script can treat NIO Buffer objects |
|
27 as if those are just array objects. |
|
28 |
|
29 * dom_linker.js |
|
30 |
|
31 This sample builds DOMLinkerExporter.java and uses it in a sample script |
|
32 called "dom_linker_gutenberg.js". This linker handles DOM Element objects to add |
|
33 properties to access child elements of a given element by child element tag name. |
|
34 This simplifies script access of parsed XML DOM Documents. |
|
35 |
|
36 * missing_method_linker.js |
|
37 |
|
38 This sample builds MissingMethodLinkerExporter.java and uses it in a sample script |
|
39 called "missing_method.js". This linker supports Smalltalk-style "doesNotUnderstand" |
|
40 calls on Java objects. i.e., A Java class can implement MissingMethodHandler interface |
|
41 with one method named "doesNotUnderstand". When script accesses a method on such |
|
42 object and if that method does not exist in the Java class (or any of it's supertypes), |
|
43 then "doesNotUnderstand" method is invoked. |
|
44 |
|
45 * underscore_linker.js |
|
46 |
|
47 This sample builds UnderscoreNameLinkerExporter.java and uses it in a sample script |
|
48 called "underscore.js". This linker converts underscore separated names to Camel Case |
|
49 names (as used in Java APIs). You can call Java APIs using Ruby-like naming convention |
|
50 and this linker converts method names to CamelCase! |
|
51 |