Programming Groovy dynamic productivity for the java developer phần 4 doc
... expression you created before to print the quote for these companies as well. So, you iterate over the stocks map—within the closure you have the company as the key and the price as the value. However, ... 5, "moon" ) println text The output from the previous code is as follows: The cow jumped over the fence The cow jumped over the moon The GString (tex...
Ngày tải lên: 12/08/2014, 23:22
... friendly java. lang.Integer chirping dynamic behavior in Groovy, as you’ll learn later in this book. Programming Groovy Dynamic Productivity for the Java Developer Venkat Subrama niam The P ragmatic ... more performant. To reap the benefit of the platform and to tackle the inher- ent complexities of your applications, you need another tool—one with a dynamic and m...
Ngày tải lên: 12/08/2014, 23:22
... II Using Groovy OBJECT EXTENSIONS 144 How does the identity( ) method know to route calls within the closure to the context object? The magic happens because of the dele gate prop- erty of the closure ... This extension is called the Groovy JDK or the GDK. 1 The relationship between the JDK and the GDK is shown in Figure 8.1, on the following page. The GDK sits...
Ngày tải lên: 12/08/2014, 23:22
Programming Groovy dynamic productivity for the java developer phần 2 potx
... (the traditional Java main( ) method). JAVABEANS 46 Download GroovyForJavaEyes/Car .java / /Java code public class Car { private int miles; private int year; public Car(int theYear) { year = theYear; ... print "$it " } The output from the previous code is as follows: 0 2 4 6 8 1. http:/ /groovy. codehaus.org/Looping JAVABEANS 48 Download GroovyForJavaEyes/GroovyCar2 ....
Ngày tải lên: 12/08/2014, 23:22
Programming Groovy dynamic productivity for the java developer phần 3 ppsx
... UsingCollection .groovy, and run groovy 9. Thanks to Neal Ford for this Java example. OPTIONAL TYPING 86 4. 5 Optional Typing Groovy is dynamically typed but is also optionally typed; you can adjust the dial ... 1 println x int y = 1 println y SUPPOR T OF JAVA 5 LANGUAGE FEATURES 64 Let’s look at a Groovy example for these two ways: Download GroovyForJavaEyes/VarArgs .groovy...
Ngày tải lên: 12/08/2014, 23:22
Programming Groovy dynamic productivity for the java developer phần 6 pot
... command groovyc -j AJava- Class .java UseJavaClass .groovy -Jsource 1.6. The option -Jsource 1.6 sends the optional option source = 1.6 to the Java compiler. Examine the byte- code generated using javap. ... Using Groovy Classes from Java If the Groovy classes are precompiled, then you can use the .class files or JARs readily in Java. Java sees no difference between t...
Ngày tải lên: 12/08/2014, 23:22
Programming Groovy dynamic productivity for the java developer phần 7 pot
... implement the before or after advice (or both), implement your before/after logic, and route the call to the actual method at the appropriate time. To route the call, use the MetaMethod for the method ... the arguments for a method you’re lookin g for to these meth- ods. They don’t insist on an array of Class of the arguments like the get- Method( ) method i n Java...
Ngày tải lên: 12/08/2014, 23:22
Programming Groovy dynamic productivity for the java developer phần 8 potx
... ${car.ampy()}" The output from the previous code is as follows: miles year make Avg. MPY 42 451 2003 Acura 849 0.2 240 31 2003 Chevy 48 06.2 142 33 2006 Honda 7116.5 42 451 2003 Acura 849 0.2 Chapter 15 MOPping ... now. UNIT TESTING JAVA AND GROOVY CODE 239 Car.class resides in the classes/com/agiledeveloper directory. Download UnitTestingWithGroovy/src/Car .java // Java...
Ngày tải lên: 12/08/2014, 23:22
Programming Groovy dynamic productivity for the java developer phần 9 potx
... USING THE GROOVY MOCK LIBRARY 256 for the collaborator and verifies the state. To verif y behavior, you have to use a mock (see the sidebar on page 243 ), specifically, the MockFor class. Using MockFor Let’s ... of stubs. Then we’ll take a look at the advantage mocks offer by using MockFor. Using StubFor Let’s use Groovy s StubFor to create stubs for the File class: Downloa...
Ngày tải lên: 12/08/2014, 23:22
Programming Groovy dynamic productivity for the java developer phần 10 pptx
... on the bleeding edge. Groovy API Javadoc http:/ /groovy. codehaus.org/api Javadoc for the Groovy API. The GDK http:/ /groovy. codehaus.org /groovy- jdk List of the methods that are part of the Groovy ... line, 35f, 34 35 community forums for, 18 compiler, 71, 72 defined, 19–20 downloading, 30 dynamic languages and, 16–19 Exception handling, 43 44 GDK, 40 42 , 142 f gr...
Ngày tải lên: 12/08/2014, 23:22