售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Groovy 2 Cookbook
Table of Contents
Groovy 2 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
The Groovy language
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with Groovy
Introduction
Installing Groovy on Windows
Getting ready
How to do it…
There's more...
Installing Groovy on Linux and OS X
How to do it...
How it works...
There's more...
See also
Executing Groovy code from the command line
How to do it...
How it works...
There's more...
See also
Using Groovy as a command-line text file editor
How to do it...
How it works...
There's more...
See also
Using Groovy to start a server on the command line
How to do it...
See also
Running Groovy with invokedynamic support
Getting ready
How to do it...
There's more...
See also
Building Groovy from source
Getting ready
How to do it...
How it works...
Managing multiple Groovy installations on Linux
Getting ready
How to do it...
How it works...
There's more...
See also
Using groovysh to try out Groovy commands
How to do it...
How it works...
There's more...
Starting groovyConsole to execute Groovy snippets
How to do it...
There's more...
Configuring Groovy in Eclipse
Getting ready
How to do it...
How it works...
There's more...
See also
Configuring Groovy in IntelliJ IDEA
Getting ready
How to do it...
There's more...
2. Using Groovy Ecosystem
Introduction
Using Java classes from Groovy
How to do it...
How it works...
There's more...
See also
Embedding Groovy into Java
Getting ready
How to do it...
How it works...
There's more...
See also
Compiling Groovy code
Getting ready
How to do it...
How it works...
See also
Simplifying dependency management with Grape
Getting ready
How to do it...
How it works...
There's more...
See also
Integrating Groovy into the build process using Ant
Getting ready
How to do it...
How it works...
There's more...
See also
Integrating Groovy into the build process using Maven
Getting ready
How to do it...
How it works...
There's more...
See also
Integrating Groovy into the build process using Gradle
Getting ready
How to do it...
How it works...
There's more...
See also
Generating documentation for Groovy code
Getting ready
How to do it...
How it works...
There's more...
See also
Checking Groovy code's quality with CodeNarc
Getting ready
How to do it...
How it works...
There's more...
See also
3. Using Groovy Language Features
Introduction
Searching strings with regular expressions
Getting ready
How to do it...
There's more...
See also
Writing less verbose Java Beans with Groovy Beans
Getting ready
How to do it...
How it works...
There's more...
Inheriting constructors in Groovy classes
How to do it...
How it works...
Adding the cloning functionality to Groovy Beans
How to do it...
How it works...
There's more...
Defining code as data in Groovy
Getting ready
How to do it...
There's more...
Defining data structures as code in Groovy
Getting ready
How to do it...
How it works...
See also
Implementing multiple inheritance in Groovy
Getting ready
How to do it...
How it works...
There's more...
See also
Adding a functionality to the existing Java/Groovy classes
Getting ready
How to do it...
How it works...
There's more...
See also
Defining type-checking rules for dynamic code
Getting ready
How to do it...
How it works...
There's more...
Adding automatic logging to Groovy classes
How to do it...
How it works...
There's more...
See also
4. Working with Files in Groovy
Introduction
Reading from a file
Getting ready
How to do it...
How it works...
There's more...
See also
Reading a text file line by line
Getting ready
How to do it...
There's more...
See also
Processing every word in a text file
Getting ready
How to do it...
How it works...
There's more...
See also
Writing to a file
Getting ready
How to do it...
How it works...
There's more...
See also
Replacing tabs with spaces in a text file
Getting ready
How to do it...
How it works...
There's more...
See also
Filtering a text file's content
Getting ready
How to do it...
How it works...
There's more...
See also
Deleting a file or directory
Getting ready
How to do it...
How it works...
There's more...
See also
Walking through a directory recursively
Getting ready
How to do it...
How it works...
There's more...
See also
Searching for files
Getting ready
How to do it...
How it works...
There's more...
See also
Changing file attributes on Windows
Getting ready
How to do it...
How it works...
There's more...
Reading data from a ZIP file
Getting ready
How to do it...
How it works...
There's more...
See also
Reading an Excel file
Getting ready
How to do it...
How it works...
See also
Extracting data from a PDF
Getting ready
How to do it...
How it works...
There's more...
See also
5. Working with XML in Groovy
Introduction
Reading XML using XmlSlurper
Getting ready
How to do it...
How it works...
See also
Reading XML using XmlParser
How to do it...
How it works...
See also
Reading XML content with namespaces
Getting ready
How to do it...
How it works...
There's more...
See also
Searching in XML with GPath
Getting ready
How to do it...
How it works...
There's more...
See also
Searching in XML with XPath
Getting ready
How to do it...
How it works...
There's more...
See also
Constructing XML content
How to do it...
How it works...
There's more...
See also
Modifying XML content
Getting ready
How to do it...
How it works...
See also
Sorting XML nodes
How to do it...
How it works...
There's more...
See also
Serializing Groovy Beans to XML
Getting ready
How to do it...
How it works...
There's more...
See also
6. Working with JSON in Groovy
Introduction
Parsing JSON messages with JsonSlurper
Getting ready
How to do it...
How it works...
There's more...
See also
Constructing JSON messages with JsonBuilder
How to do it...
How it works...
See also
Modifying JSON messages
How to do it...
How it works...
See also
Validating JSON messages
Getting ready
How to do it...
How it works...
There's more...
See also
Converting JSON message to XML
Getting ready
How to do it...
How it works...
There's more...
See also
Converting JSON message to Groovy Bean
Getting ready
How to do it...
How it works...
There's more...
See also
Using JSON to configure your scripts
Getting ready
How to do it...
How it works...
There's more...
See also
7. Working with Databases in Groovy
Introduction
Creating a database table
Getting ready
How to do it...
How it works...
See also
Connecting to an SQL database
Getting ready
How to do it...
How it works...
See also
Querying an SQL database
Getting ready
How to do it...
How it works...
There's more...
See also
Modifying data in an SQL database
Getting ready
How to do it...
How it works...
There's more...
See also
Calling a stored procedure
Getting ready
How to do it...
How it works...
There's more...
See also
Reading BLOB/CLOB from a database
Getting ready
How to do it...
How it works...
There's more...
See also
Building a simple ORM framework
Getting ready
How to do it...
How it works...
There's more...
See also
Using Groovy to access Redis
Getting ready
How to do it...
How it works...
There's more...
See also
Using Groovy to access MongoDB
Getting ready
How to do it...
How it works...
There's more...
See also
Using Groovy to access Apache Cassandra
Getting ready
How to do it...
How it works...
See also
8. Working with Web Services in Groovy
Introduction
Downloading content from the Internet
How to do it...
How it works...
There's more...
See also
Executing an HTTP GET request
How to do it...
How it works...
There's more...
See also
Executing an HTTP POST request
How to do it...
How it works...
There's more...
See also
Constructing and modifying complex URLs
How to do it...
How it works...
See also
Issuing a REST request and parsing a response
Getting ready
How to do it...
How it works...
See also
Issuing a SOAP request and parsing a response
Getting ready
How to do it...
How it works...
There's more...
See also
Consuming RSS and Atom feeds
Getting ready
How to do it...
How it works...
There's more...
See also
Using basic authentication for web service security
How to do it...
How it works...
See also
Using OAuth for web service security
Getting ready
How to do it...
How it works...
See also
9. Metaprogramming and DSLs in Groovy
Introduction
Querying methods and properties
Getting ready
How to do it...
How it works...
See also
Dynamically extending classes with new methods
How to do it...
How it works...
There's more...
See also
Overriding methods dynamically
Getting ready
How to do it...
How it works...
Adding performance logging to methods
Getting ready
How to do it...
How it works...
There's more...
See also
Adding a caching functionality around methods
Getting ready
How to do it...
How it works...
See also
Adding transparent imports to a script
Getting ready
How to do it...
How it works...
There's more...
See also
DSL for executing commands over SSH
Getting ready
How to do it...
How it works...
See also
DSL for generating reports from logfiles
Getting ready
How to do it...
How it works...
There's more...
10. Concurrent Programming in Groovy
Introduction
Processing collections concurrently
Getting ready
How to do it...
How it works...
There's more...
See also
Downloading files concurrently
Getting ready
How to do it...
How it works...
See also
Splitting a large task into smaller parallel jobs
How to do it...
How it works...
See also
Running tasks in parallel and asynchronously
Getting ready
How to do it...
How it works...
See also
Using actors to build message-based concurrency
How to do it...
How it works...
See also
Using STM to atomically update fields
Getting ready
How to do it...
How it works...
There's more...
See also
Using dataflow variables for lazy evaluation
Getting ready
How to do it...
How it works...
There's more...
See also
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜