Jakarta Commons Cookbook
暫譯: 雅加達共用庫食譜

Timothy M. O'Brien

  • 出版商: O'Reilly
  • 出版日期: 2004-12-07
  • 售價: $1,740
  • 貴賓價: 9.5$1,653
  • 語言: 英文
  • 頁數: 400
  • 裝訂: Paperback
  • ISBN: 059600706X
  • ISBN-13: 9780596007065
  • 已過版

買這商品的人也買了...

商品描述

Description:

As a Java developer, you're always looking for tools to help in your web and application development. Maybe you've heard of the Jakarta Commons open source Java tools. The Jakarta Commons is an open source Jakarta subproject where developers create and maintain a collection of twenty-plus independent Java components and utilities that serve useful purposes. Jakarta Commons packages include utilities for web, XML, networking, building and testing applications, and some that help other packages work better together. Jakarta Commons packages are designed to be reusable. Each one is a time saver by itself, and when used in combination the results can be very powerful.

But in searching for information on the Jakarta Commons tools, you find it hard to locate documentation relevant to your needs. You don't have lots of time to spend searching for information on a specific Jakarta Commons tool to determine what it does and how to incorporate it in your code. If you are looking for a single source for clear information and samples on how to use the Jakarta Commons tools, then the Jakarta Commons Cookbook is for you.

The Jakarta Commons Cookbook summarizes each of the available Jakarta Commons packages and contains practical and efficient recipes for making the most out of the Jakarta Commons open source Java tools. You don't have to be an expert, since the book explains how and why to use a utility, pitfalls to avoid, and where to look for additional information on Jakarta Commons utilities. It introduces design possibilities and explores combining Jakarta Commons utilities in novel assemblies to create complex applications. The book offers detailed code samples and insider tips--making it a valuable resource whether you are an expert Java developer or a novice. If you want to quickly learn how to use Jakarta Commons timing-saving utilities or have an invaluable resource for Jakarta Commons questions and techniques, then the Jakarta Commons Cookbook is for you.

 

Table of Contents:

Preface
1. Supplements to the Java 2 Platform
       1.1 Obtaining Commons Lang  
       1.2 Joining the Commons-User Mailing List  
       1.3 Getting the Commons Lang Source Code  
       1.4 Automating the Generation of toString(  ) Content  
       1.5 Customizing Generated toString(  ) Content  
       1.6 Automating hashCode(  ) and equals(  )  
       1.7 Automating compareTo(  )  
       1.8 Printing an Array  
       1.9 Cloning and Reversing Arrays  
       1.10 Transforming Between Object Arrays and Primitive Arrays  
       1.11 Finding Items in an Array  
       1.12 Creating a Map from a Multidimensional Array  
       1.13 Formatting Dates  
       1.14 Rounding Date Objects  
       1.15 Truncating Date Objects  
       1.16 Creating an Enum  
       1.17 Generating Unique Numeric Identifiers  
       1.18 Validation of Method Parameters  
       1.19 Measuring Time  
2. Manipulating Text
       2.1 Setting Up StringUtils and WordUtils  
       2.2 Checking for an Empty String  
       2.3 Abbreviating Strings  
       2.4 Splitting a String  
       2.5 Finding Nested Strings  
       2.6 Stripping and Trimming a String  
       2.7 Chomping a String  
       2.8 Creating an Emphasized Header  
       2.9 Reversing a String  
       2.10 Wrapping Words  
       2.11 Testing the Contents of a String  
       2.12 Measuring the Frequency of a String  
       2.13 Parsing Formatted Strings  
       2.14 Calculating String Difference  
       2.15 Using Commons Codec  
       2.16 Getting the Commons Codec Source Code  
       2.17 Calculating Soundex  
3. JavaBeans
       3.1 Representing Beans Graphically  
       3.2 Obtaining Commons BeanUtils  
       3.3 Getting the Commons BeanUtils Source Code  
       3.4 Accessing Simple Bean Properties  
       3.5 Accessing Nested Bean Properties  
       3.6 Accessing Indexed Bean Properties  
       3.7 Accessing Mapped Bean Properties  
       3.8 Accessing a Simple, Nested, Indexed, and Mapped Bean Property  
       3.9 Determining the Type of a Bean Property  
       3.10 Comparing Beans  
       3.11 Copying Bean Properties  
       3.12 Cloning a Bean  
       3.13 Setting a Bean Property  
       3.14 Testing Property Access  
       3.15 Validating Beans with Predicates  
       3.16 Creating a Map of Bean Properties  
       3.17 Wrapping a Bean with a Map  
       3.18 Creating a Dynamic Bean  
       3.19 Getting and Setting Properties as Strings  
4. Functors
       4.1 Obtaining Commons Collections  
       4.2 Getting the Commons Collections Source Code  
       4.3 Reversing a Comparator  
       4.4 Chaining Comparators  
       4.5 Comparing Nulls  
       4.6 Fixed-Order Comparison  
       4.7 Using Simple Predicates  
       4.8 Writing a Custom Predicate  
       4.9 Creating Composite Predicates  
       4.10 Transforming Objects  
       4.11 Creating a Chain of Transformations  
       4.12 Applying Conditional Transformations  
       4.13 Writing a Closure  
       4.14 Chaining Closures  
       4.15 Modeling Conditional Statements with Closures  
       4.16 Modeling Loops with Closures  
5. Collections
       5.1 Obtaining Commons Collections  
       5.2 Using a Looping Iterator  
       5.3 Iterating Over an ArrayList  
       5.4 Filtering a Collection with a Predicate  
       5.5 Iterating Through Distinct Elements  
       5.6 Using a Bag  
       5.7 Using a Buffer  
       5.8 Creating a Priority Queue  
       5.9 Using a Blocking Buffer  
       5.10 Storing Multiple Values in a Map  
       5.11 Retrieving a Key by a Value  
       5.12 Using a Case-Insensitive Map  
       5.13 Creating Typed Collections and Maps  
       5.14 Constraining Map Values  
       5.15 Constraining List Contents  
       5.16 Transforming Collections  
       5.17 Creating a Least Recently Used Cache  
       5.18 Using a Lazy Map  
       5.19 Counting Objects in a Collection  
       5.20 Performing Set Operations  
       5.21 Retrieving Map Values Without Casting  
6. XML
       6.1 Obtaining Jakarta Commons Digester  
       6.2 Turning XML Documents into Objects  
       6.3 Namespace-Aware Parsing  
       6.4 Creating a Simple XML Command Language  
       6.5 Variable Substitution and XML Parsing  
       6.6 Obtaining Jakarta Commons Betwixt  
       6.7 Turning Beans into XML Documents  
       6.8 Customizing XML Generated from an Object  
       6.9 Turning XML Documents into Beans  
7. Application Infrastructure
       7.1 Obtaining Commons CLI  
       7.2 Parsing a Simple Command Line  
       7.3 Parsing a Complex Command Line  
       7.4 Printing Usage Information  
       7.5 Obtaining Commons Configuration  
       7.6 Configuring Applications with Properties Files  
       7.7 Configuring Applications with XML  
       7.8 Using Composite Configuration  
       7.9 Obtaining Commons Logging  
       7.10 Using an Abstract Logging Interface  
       7.11 Specifying a Logging Implementation  
       7.12 Obtaining Apache Log4J  
       7.13 Configuring Log4J with a Properties File  
       7.14 Configuring Log4J with XML  
8. Math
       8.1 Using Fractions  
       8.2 Finding the Maximum and Minimum in an Array  
       8.3 Using Number Ranges  
       8.4 Generating Random Variables  
       8.5 Obtaining Commons Math  
       8.6 Calculating Simple Univariate Statistics  
       8.7 Solving a System of Linear Equations  
       8.8 Arithmetic with Complex Numbers  
       8.9 Establishing Relationships Between Variables  
       8.10 Estimating the Amount of Time Left in a Process  
9. Templating
       9.1 Obtaining Commons JEXL  
       9.2 Using an Expression Language  
       9.3 Invoking Methods in an Expression  
       9.4 Externalizing Logic with an Expression Language  
       9.5 Obtaining Jakarta Velocity  
       9.6 Using a Simple Templating Language  
       9.7 Writing Templates with Conditionals and Loops  
       9.8 Using Macros in a Templating Engine  
       9.9 Invoking Methods in a Template  
       9.10 Obtaining FreeMarker  
       9.11 Using a Complex Scripting Engine  
       9.12 Accessing XML Documents from a Templating Engine  
       9.13 Using Velocity in a Web Application  
       9.14 Using FreeMarker in a Web Application  
       9.15 Writing Templates in Eclipse  
10. I/O and Networking
       10.1 Obtaining Commons IO  
       10.2 Copying Streams, byte[ ], Readers, and Writers  
       10.3 Closing Streams, Readers, and Writers  
       10.4 Printing a Human-Readable File Size  
       10.5 Copying Files, Strings, and URLs  
       10.6 Deleting Directories Recursively  
       10.7 Obtaining the Size of a Directory  
       10.8 Touching a File  
       10.9 Filtering Files  
       10.10 Measuring Stream Traffic  
       10.11 Splitting an OutputStream  
       10.12 Obtaining Jakarta ORO  
       10.13 Using Globs and Perl5 Regular Expressions to List Files  
       10.14 Obtaining Commons Net  
       10.15 Writing an FTP Client  
       10.16 Sending Mail with SMTP  
       10.17 Checking a POP3 Mailbox  
11. HTTP and WebDAV
       11.1 Obtaining Jakarta HttpClient  
       11.2 Getting Jakarta HttpClient Source Code  
       11.3 Performing an HTTP GET  
       11.4 Sending Parameters in a Query String  
       11.5 Retrieving Content with a Conditional GET  
       11.6 Debugging HTTP Communications  
       11.7 Making an HTTP POST Request  
       11.8 Sending POST Data from a File  
       11.9 Uploading Files with a Multipart POST  
       11.10 Basic Authentication  
       11.11 NTLM Authentication  
       11.12 Working with Cookies  
       11.13 Handling Redirects  
       11.14 SSL  
       11.15 Accepting a Self-Signed Certificate  
       11.16 Obtaining Jakarta Slide  
       11.17 Connecting to WebDAV Resources  
       11.18 Modifying a WebDAV Resource  
12. Searching and Filtering
       12.1 Obtaining Commons JXPath  
       12.2 Querying an Object Graph with XPath  
       12.3 Search a Collection of Simple Objects  
       12.4 Applying XPath Queries to Complex Object Graphs  
       12.5 Obtaining Jakarta Lucene  
       12.6 Creating an Index of XML Documents  
       12.7 Searching for a Specific Term in a Document Index  
       12.8 Finding the Frequency of Terms in an Index  
Index

商品描述(中文翻譯)

**描述:**
作為一名 Java 開發者,您總是在尋找能幫助您進行網頁和應用程式開發的工具。也許您聽說過 Jakarta Commons 開源 Java 工具。Jakarta Commons 是一個開源的 Jakarta 子專案,開發者在此創建和維護二十多個獨立的 Java 元件和工具,這些元件和工具具有實用的功能。Jakarta Commons 套件包括用於網頁、XML、網路、構建和測試應用程式的工具,以及一些幫助其他套件更好協作的工具。Jakarta Commons 套件旨在可重用。每個套件本身都是節省時間的工具,當它們結合使用時,效果可以非常強大。

但在尋找有關 Jakarta Commons 工具的信息時,您發現很難找到與您需求相關的文檔。您沒有很多時間去尋找特定 Jakarta Commons 工具的信息,以確定它的功能以及如何將其納入您的代碼中。如果您正在尋找一個清晰的信息和範例的單一來源,來了解如何使用 Jakarta Commons 工具,那麼《Jakarta Commons Cookbook》就是為您而設。

《Jakarta Commons Cookbook》總結了每個可用的 Jakarta Commons 套件,並包含實用且高效的食譜,以充分利用 Jakarta Commons 開源 Java 工具。您不必成為專家,因為本書解釋了如何以及為什麼使用某個工具,避免的陷阱,以及在何處尋找有關 Jakarta Commons 工具的額外信息。它介紹了設計可能性,並探索將 Jakarta Commons 工具以新穎的方式組合在一起,以創建複雜的應用程式。本書提供詳細的代碼範例和內部提示,無論您是專業的 Java 開發者還是新手,都是一個寶貴的資源。如果您想快速學習如何使用 Jakarta Commons 節省時間的工具,或擁有一個無價的資源來解決 Jakarta Commons 的問題和技術,那麼《Jakarta Commons Cookbook》就是為您而設。

**目錄:**
前言
1. Java 2 平台的補充
       1.1 獲取 Commons Lang
       1.2 加入 Commons-User 郵件列表
       1.3 獲取 Commons Lang 原始碼
       1.4 自動生成 toString() 內容
       1.5 自定義生成的 toString() 內容
       1.6 自動化 hashCode() 和 equals()
       1.7 自動化 compareTo()
       1.8 打印陣列
       1.9 克隆和反轉陣列
       1.10 在物件陣列和原始陣列之間轉換
       1.11 在陣列中查找項目
       1.12 從多維陣列創建映射
       1.13 格式化日期
       1.14 四捨五入日期物件
       1.15 截斷日期物件
       1.16 創建枚舉
       1.17 生成唯一的數字標識符
       1.18 驗證方法參數
       1.19 測量時間
2. 操作文本
       2.1 設置 StringUtils 和 WordUtils
       2.2 檢查空字符串
       2.3 縮寫字符串
       2.4 拆分字符串
       2.5 查找嵌套字符串
       2.6 剝離和修剪字符串
       2.7 剪切字符串
       2.8 創建強調標題
       2.9 反轉字符串
       2.10 包裝單詞
       2.11 測試字符串內容
       2.12 測量字符串頻率
       2.13 解析格式化字符串
       2.14 計算字符串差異
       2.15 使用 Commons Codec
       2.16 獲取 Commons Codec 原始碼
       2.17 計算 Soundex
3. JavaBeans
       3.1 以圖形方式表示 Beans
       3.2 獲取 Commons BeanUtils
       3.3 獲取 Commons BeanUtils 原始碼
       3.4 訪問簡單 Bean 屬性
       3.5 訪問嵌套 Bean 屬性
       3.6 訪問索引 Bean 屬性
       3.7 訪問映射 Bean 屬性
       3.8 訪問簡單、嵌套、索引和映射的 Bean 屬性
       3.9 確定 Bean 屬性的類型
       3.10 比較 Beans
       3.11 複製 Bean 屬性
       3.12 克隆 Bean
       3.13 設置 Bean 屬性
       3.14 測試屬性訪問
       3.15 使用謂詞驗證 Beans
       3.16 創建 Bean 屬性映射
       3.17 用映射包裝 Bean
       3.18 創建動態 Bean
       3.19 將屬性作為字符串獲取和設置
4. 函數
       4.1 獲取 Commons Collections
       4.2 獲取 Commons Collections 原始碼
       4.3 反轉比較器
       4.4 鏈接比較器
       4.5 比較 Null
       4.6 固定順序比較
       4.7 使用簡單謂詞
       4.8 編寫自定義謂詞
       4.9 創建復合謂詞
       4.10 轉換物件
       4.11 創建轉換鏈
       4.12 應用條件轉換
       4.13 編寫閉包
       4.14 鏈接閉包
       4.15 使用閉包建模條件語句
       4.16 使用閉包建模循環
5. 集合
       5.1 獲取 Commons Collections
       5.2 使用循環迭代器
       5.3 遍歷 ArrayList
       5.4 使用謂詞過濾集合
       5.5 遍歷不同元素
       5.6 使用袋子
       5.7 使用緩衝區
       5.8 創建優先隊列
       5.9 使用阻塞緩衝區
       5.10 在映射中存儲多個值
       5.11 通過值檢索鍵
       5.12 使用不區分大小寫的映射
       5.13 創建類型化集合和映射
       5.14 限制映射值
       5.15 限制列表內容
       5.16 轉換集合
       5.17 創建最近最少使用的快取
       5.18 使用懶映射
       5.19 計算集合中的物件
       5.20 執行集合操作
       5.21 在不進行類型轉換的情況下檢索映射值
6. XML
       6.1 獲取 Jakarta Commons Digester
       6.2 將 XML 文檔轉換為物件
       6.3 支援命名空間的解析
       6.4 創建簡單的 XML 命令語言
       6.5 變數替換和 XML 解析
       6.6 獲取 Jakarta Commons Betwixt
       6.7 將 Beans 轉換為 XML 文檔
       6.8 自定義從物件生成的 XML
       6.9 將 XML 文檔轉換為 Beans
7. 應用基礎設施
       7.1 獲取 Commons CLI