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