Groovy Recipes: Greasing the Wheels of Java

Overview

Each recipe in Groovy Recipes begins with a concise code example for a quick start, followed by in-depth explanation in plain English. These recipes will get you to-to-speed in a Groovy environment quickly.

You'll see how to speed up nearly every aspect of the development process using Groovy. Groovy makes mundane file management tasks like copying and renaming files trivial. Reading and writing XML has never been easier with XmlParsers and XmlBuilders. Breathe new life into ...

See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (7) from $14.98   
  • New (2) from $96.50   
  • Used (5) from $14.98   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$96.50
Seller since 2014

Feedback rating:

(227)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
Brand New Item.

Ships from: Chatham, NJ

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$105.00
Seller since 2014

Feedback rating:

(113)

Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Close
Sort by
Sending request ...

Overview

Each recipe in Groovy Recipes begins with a concise code example for a quick start, followed by in-depth explanation in plain English. These recipes will get you to-to-speed in a Groovy environment quickly.

You'll see how to speed up nearly every aspect of the development process using Groovy. Groovy makes mundane file management tasks like copying and renaming files trivial. Reading and writing XML has never been easier with XmlParsers and XmlBuilders. Breathe new life into Arrays, Maps, and Lists with a number of convenience methods. But Groovy does more than just ease traditional Java development: it brings modern programming features to the Java platform like closures, duck-typing, and metaprogramming.

As an added bonus, this book also covers Grails. You'll be amazed at how quickly you can have a first-class web application up and running from ground zero. Grails includes everything you need in a single zip file—a web server (Jetty), a database (HSQLDB), Spring, Hibernate, even a Groovy version of Ant called GANT. We cover everything from getting a basic website in place to advanced features that take you beyond HTML into the world of Web Services: REST, JSON, Atom, Podcasting, and much much more.

Read More Show Less

Product Details

  • ISBN-13: 9780978739294
  • Publisher: Pragmatic Bookshelf
  • Publication date: 5/1/2008
  • Series: Pragmatic Programmers Series
  • Pages: 250
  • Product dimensions: 7.58 (w) x 8.92 (h) x 0.77 (d)

Meet the Author

Scott Davis is the Editor in Chief of aboutGroovy.com. He is also an author and independent consultant. He is passionate about open source solutions and agile development. He has worked on a variety of Java platforms, from JEE to JSE to JME
(sometimes all on the same project).
He is the co-author of JBoss At Work (O'Reilly), and author of
Google Maps API (Pragmatic Bookshelf) and GIS for Web
Developers: Adding Where to Your Web Applications
(Pragmatic Bookshelf).

Read More Show Less

Table of Contents

Preface     1
Introduction     3
Groovy, the Way Java Should Be     5
Stripping Away the Verbosity     7
Groovy: The Blue Pill or the Red Pill?     8
Road Map     10
Acknowledgments     11
Getting Started     13
Installing Groovy     13
Running a Groovy Script (groovy)     16
Compiling Groovy (groovyc)     17
Running the Groovy Shell (groovysh)     17
Running the Groovy Console (groovyConsole)     22
Running Groovy on a Web Server (Groovlets)     22
Groovy + Eclipse     26
Groovy + IntelliJ IDEA     27
Groovy + TextMate     28
Groovy + [Insert Your IDE or Text Editor Here]     29
New to Groovy     31
Automatic Imports     32
Optional Semicolons     32
Optional Parentheses     34
Optional Return Statements     36
Optional Datatype Declaration (Duck Typing)     37
Optional Exception Handling     38
Operator Overloading     40
Safe Dereferencing (?)     42
Autoboxing     43
Groovy Truth     44
Embedded Quotes     46
Heredocs (Triple Quotes)     46
GStrings     47
List Shortcuts     48
Map Shortcuts     52
Ranges     55
Closures and Blocks     57
Java and Groovy Integration     59
GroovyBeans (aka POGOs)     59
Autogenerated Getters and Setters     61
getProperty and SetProperty     64
Making Attributes Read-Only     65
Constructor Shortcut Syntax     66
Optional Parameters/Default Values     67
Private Methods     68
Calling Groovy from Java     69
Calling Java from Groovy     71
Interfaces in Groovy and Java     71
The Groovy Joint Compiler     72
Compiling Your Project with Ant     74
Compiling Your Project with Maven     75
Groovy from the Command Line     77
Running Uncompiled Groovy Scripts     77
Shebanging Groovy     78
Accepting Command-Line Arguments     79
Running a Shell Command     80
Using Shell Wildcards in Groovy Scripts     81
Running Multiple Shell Commands at Once     82
Waiting for a Shell Command to Finish Before Continuing     82
Getting System Properties     83
Getting Environment Variables     85
Evaluating a String     86
Calling Another Groovy Script     87
Groovy on the Fly (groovy -e)     89
Including JARs at the Command Line     89
File Tricks     91
Listing All Files in a Directory     91
Reading the Contents of a File     95
Writing Text to a File     96
Copying Files     99
Using AntBuilder to Copy a File     100
Using AntBuilder to Copy a Directory     101
Moving/Renaming Files     103
Deleting Files     103
Creating a ZIP File/Tarball     104
Unzipping/Untarring Files     105
Parsing XML     107
The "I'm in a Hurry" Guide to Parsing XML     107
Understanding the Difference Between XmlParser and XmlSlurper     108
Parsing XML Documents     112
Dealing with XML Attributes     112
Getting the Body of an XML Element     115
Dealing with Mixed-Case Element Names     116
Dealing with Hyphenated Element Names     117
Navigating Deeply Nested XML      118
Parsing an XML Document with Namespaces     123
Populating a GroovyBean from XML     125
Writing XML     127
The "I'm in a Hurry" Guide to Creating an XML Document     127
Creating Mixed-Case Element Names     128
Creating Hyphenated Element Names     129
Creating Namespaced XML Using MarkupBuilder     129
Understanding the Difference Between MarkupBuilder and StreamingMarkupBuilder     130
Creating Parts of the XML Document Separately     131
Creating Namespaced XML Using StreamingMarkupBuilder     133
Printing Out the XML Declaration     133
Printing Out Processing Instructions     134
Printing Arbitrary Strings (Comments, CDATA)     134
Writing StreamingMarkupBuilder Output to a File     136
StreamingMarkupBuilder at a Glance     136
Creating HTML on the Fly     137
Converting CSV to XML     139
Converting JDBC ResultSets to XML     142
Web Services     143
Finding Your Local IP Address and Name     143
Finding a Remote IP Address and Domain Name     145
Making an HTTP GET Request     146
Working with Query Strings     150
Making an HTTP POST Request     155
Making an HTTP PUT Request     158
Making an HTTP DELETE Request     160
Making a RESTful Request     161
Making a CSV Request     163
Making a SOAP Request     163
Making an XML-RPC Request     165
Parsing Yahoo Search Results as XML     167
Parsing an Atom Feed     168
Parsing an RSS Feed     169
Metaprogramming     173
Discovering the Class     174
Discovering the Fields of a Class     175
Checking for the Existence of a Field     177
Discovering the Methods of a Class     180
Checking for the Existence of a Method     182
Creating a Field Pointer     184
Creating a Method Pointer     185
Calling Methods That Don't Exist (invokeMethod)     185
Creating an Expando     186
Adding Methods to a Class Dynamically (Categories)     188
Adding Methods to a Class Dynamically (ExpandoMetaClass)     190
Working with Grails     193
Installing Grails     194
Creating Your First Grails App     197
Understanding Grails Environments     205
Running Grails on a Different Port      206
Generating a WAR     207
Changing Databases     208
Changing the Home Page     211
Understanding Controllers and Views     212
Dynamic Scaffolding     214
Validating Your Data     217
Managing Table Relationships     220
Mapping Classes to Legacy Databases     225
Grails and Web Services     227
Returning XML     227
Returning JSON     229
Returning an Excel Spreadsheet     231
Setting Up an Atom Feed     233
Setting Up an RSS Feed for Podcasts     237
Installing Plug-Ins     241
Index     243
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Posted February 1, 2010

    I Also Recommend:

    Must Have Reference Book

    Whether you're new to Groovy or you're an experienced Groovy programmer, Groovy Recipes, is a must have reference book. Groovy Recipes, is good at giving a basic explanation on Groovy core concepts. But, its real strength is in providing a plethora of examples, that keep you coming back to this book, again and again, to learn the simple elegance of writing Groovy code.

    Even if you're an experienced Java or Groovy programmer, you'll want this book in your programming tool box. I often reference Chapters 6,7 and 8, "File Tricks," "Parsing XML" and "Writing XML," respectively.

    The last two chapters of the book, which cover Grails, are OK, if you want a general understanding of what Grails is and how to use it. However, if Grails is your greater interest, there are better books that you will want to have on your shelf to reference (e.g. Groovy and Grails Recipes and The Definitive Guide to Grails).

    Bottom line, if Groovy is your primary programming language, this is an excellent book to have in your arsenal.
    Comment

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)