Programming Groovy dynamic productivity for the java developer phần 3 ppsx

Programming Groovy dynamic productivity for the java developer phần 3 ppsx

Programming Groovy dynamic productivity for the java developer phần 3 ppsx

... code, use groovyc (Section 11.2, Running Groovy, on page 1 73) . 18. Visit http:/ /groovy. codehaus.org/Differences+from +Java for a nice list of Groovy- Java differences. DESIGN BY CAPABILITY 82 Then Human, ... applicable for argument types: () values: {} How’s that? The iterator (for loop) tr eat ed the elements as objects, so there was no error on line number 16 Groovy took...

Ngày tải lên: 12/08/2014, 23:22

31 404 0
Programming Groovy dynamic productivity for the java developer phần 1 docx

Programming Groovy dynamic productivity for the java developer phần 1 docx

... . . . . . 35 3 Groovy for the Java Eyes 37 3. 1 From Java to Groovy . . . . . . . . . . . . . . . . . . . . 37 3. 2 JavaBeans . . . . . . . . . . . . . . . . . . . . . . . . . . 45 3. 3 Optional ... friendly java. lang.Integer chirping dynamic behavior in Groovy, as you’ll learn later in this book. Programming Groovy Dynamic Productivity for the Java Dev...

Ngày tải lên: 12/08/2014, 23:22

31 262 0
Programming Groovy dynamic productivity for the java developer phần 2 potx

Programming Groovy dynamic productivity for the java developer phần 2 potx

... true. If the object reference is not-null, then the truth depends on the type of the object. For example, if th e object is a collection (like java. util.ArrayList), then Groovy checks whether the ... familiar Java code, isn’t it? The output from the previous code is as follows: Year: 2008 Miles: 0 Setting miles Miles: 25 Let’s rewrite the code in Groovy: Download Gro...

Ngày tải lên: 12/08/2014, 23:22

31 310 0
Programming Groovy dynamic productivity for the java developer phần 4 doc

Programming Groovy dynamic productivity for the java developer phần 4 doc

... 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 (text) contains the variable what. The expression is ... 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. H...

Ngày tải lên: 12/08/2014, 23:22

31 326 0
Programming Groovy dynamic productivity for the java developer phần 5 docx

Programming Groovy dynamic productivity for the java developer phần 5 docx

... use the getClass( ) method instead of the class pr ope rty on ins tances. USING MAP 133 The first call to size( ) is on the list, so it returns 4, the current number of elements in the list. The ... is, split the collection into individual objects using the * operator (the spread oper- ator), as shown next. For th i s to work correctly, the size of the ArrayList must b...

Ngày tải lên: 12/08/2014, 23:22

31 368 0
Programming Groovy dynamic productivity for the java developer phần 6 pot

Programming Groovy dynamic productivity for the java developer phần 6 pot

... JSR 2 23 with Java 5. It is included in Java 6. JSR 2 23 currently works only wi th Groovy 1.0 and not with Groovy 1.5. JSR 2 23 is an option more suited for other languages on the JVM than for Groovy. ... 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 betwee...

Ngày tải lên: 12/08/2014, 23:22

31 271 0
Programming Groovy dynamic productivity for the java developer phần 7 pot

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

31 316 0
Programming Groovy dynamic productivity for the java developer phần 8 potx

Programming Groovy dynamic productivity for the java developer phần 8 potx

... now. UNIT TESTING JAVA AND GROOVY CODE 239 Car.class resides in the classes/com/agiledeveloper directory. Download UnitTestingWithGroovy/src/Car .java // Java code package com.agiledeveloper; public ... modify the class source, you can implement the methodMissing( ) method on the class for wh i ch you want to synthe- size meth ods. You can improve performance by injecting t...

Ngày tải lên: 12/08/2014, 23:22

31 220 0
Programming Groovy dynamic productivity for the java developer phần 9 potx

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 2 43) , specifically, the MockFor class. Using MockFor Let’s ... fileMock = new groovy. mock.interceptor.MockFor (java. io.FileWriter) You replaced StubFor with MockFor—that’s the only change. When you run the test now, it fails,...

Ngày tải lên: 12/08/2014, 23:22

31 255 0
Programming Groovy dynamic productivity for the java developer phần 10 pptx

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 ... downloading Groovy, 30 for Eclipse plug-in, 35 for GDK enhancements, 141n for Groovy s mailing list, 18n for Groovy- Java diffe rences, 67n for IntelliJ I...

Ngày tải lên: 12/08/2014, 23:22

24 335 0
w