docs/JavaScriptingProgrammersGuide.html

changeset 409
29b2b2ed954c
parent 377
26a345c26e62
child 952
6d5471a497fb
     1.1 --- a/docs/JavaScriptingProgrammersGuide.html	Wed Jul 03 19:20:29 2013 +0530
     1.2 +++ b/docs/JavaScriptingProgrammersGuide.html	Wed Jul 03 18:10:12 2013 +0200
     1.3 @@ -501,14 +501,19 @@
     1.4   var anArrayListWithSize = new ArrayList(16)
     1.5  </code></pre> 
     1.6  
     1.7 -In the special case of inner classes, you need to use the JVM fully qualified name, meaning using $ sign in the class name:
     1.8 +In the special case of inner classes, you can either use the JVM fully qualified name, meaning using the dollar sign in the class name, or you can use the dot:
     1.9  
    1.10  <pre><code>
    1.11   var ftype = Java.type("java.awt.geom.Arc2D$Float")
    1.12  </code></pre> 
    1.13   
    1.14 +and
    1.15 + 
    1.16 +<pre><code>
    1.17 + var ftype = Java.type("java.awt.geom.Arc2D.Float")
    1.18 +</code></pre> 
    1.19  
    1.20 -However, once you retrieved the outer class, you can access the inner class as a property on it:
    1.21 +both work. Note however that using the dollar sign is faster, as Java.type first tries to resolve the class name as it is originally specified, and the internal JVM names for inner classes use the dollar sign. If you use the dot, Java.type will internally get a ClassNotFoundException and subsequently retry by changing the last dot to dollar sign. As a matter of fact, it'll keep replacing dots with dollar signs until it either successfully loads the class or runs out of all dots in the name. This way it can correctly resolve and load even multiply nested inner classes with the dot notation. Again, this will be slower than using the dollar signs in the name. An alternative way to access the inner class is as a property of the outer class:
    1.22  
    1.23  <pre><code>
    1.24   var arctype = Java.type("java.awt.geom.Arc2D")

mercurial