AspectJ Cookbook
暫譯: AspectJ 食譜
Russ Miles
- 出版商: O'Reilly
- 出版日期: 2005-01-25
- 售價: $1,730
- 貴賓價: 9.5 折 $1,644
- 語言: 英文
- 頁數: 356
- 裝訂: Paperback
- ISBN: 0596006543
- ISBN-13: 9780596006549
已過版
買這商品的人也買了...
-
$980$774 -
$490$441 -
$880$695 -
$690$587 -
$590$466 -
$680$537 -
$560$476 -
$490$417 -
$480$379 -
$750$593 -
$780$616 -
$580$199 -
$490$382 -
$990$782 -
$780$616 -
$580$493 -
$890$703 -
$650$553 -
$480$408 -
$650$507 -
$620$484 -
$620$527 -
$490$417 -
$720$569 -
$650$553
相關主題
商品描述
Description:
When Object Oriented programming (OO) first appeared, it was a revelation. OO gave developers the ability to create software that was more flexible and robust, but as time went on and applications became more sophisticated, too, certain areas of "traditional" OO architectures were found wanting. Aspect-oriented programming (AOP) addresses those issues by extending the OO approach even further.
Many developers are interested in AOP--especially in AspectJ, the open source extension of the Java programming language that explicitly supports the AOP approach. Yet, although AspectJ is included with Eclipse, the increasingly popular open source IDE for Java, finding a practical and non-theoretical way to learn this language and other AOP tools and techniques has been a real problem.
Until now. The AspectJ Cookbook offers a hands-on solution--in fact, several--with a wide variety of code recipes for solving day-to-day design and coding problems using AOP's unique approach.
AOP allows the global properties of a program to determine how it's compiled into an executable program. Before AOP, important program design decisions were difficult to capture in actual code. Instead, the implementation of those design decisions--known as "aspects"--were scattered throughout, resulting in "tangled" code that was hard to develop and maintain. AOP has been compared to the manufacturing of cloth, in which threads are automatically interwoven. Without AOP, programmers must stitch the threads by hand.
The AspectJ Cookbook shows readers why, and how, common Java development problems can be solved by using AOP techniques. With our popular problem-solution-discussion format, the book presents real world examples to demonstrate that AOP is more than just a concept; it's a development process that will benefit users in an immediate and visible manner.
If you're interested in how AOP is changing the way software is developed, and how you can use AspectJ to make code more modular, easier to develop, maintain, evolve and deploy, this is the book that really delivers.
Table of Contents:
Preface
1. Aspect Orientation Overview
1.1 AspectJ
1.2 A Definition Of Aspect Orientation
1.3 Where To Go For More Information
2. Getting Started With AspectJ
2.1 Installing AspectJ
2.2 Developing A Simple Aspect
2.3 Compiling an Aspect and Multiple Java Files
2.4 Weaving Aspects into Jars
2.5 Weaving Aspects at Load-Time
2.6 Generating Javadoc Documentation
2.7 Compiling an AspectJ Project using Eclipse
2.8 Selecting the Aspects that are Woven in a Build within Eclipse
2.9 Building an AspectJ Project using Ant
3. Deploying AspectJ Applications
3.1 Deploying a Command Line AspectJ Application
3.2 Deploying an AspectJ Application as a fully contained Executable .Jar file
3.3 Deploying a Java Servlet that uses AspectJ
3.4 Deploying a JSP that uses AspectJ
3.5 Deploying an Axis Web Service that uses AspectJ
4. Capturing Join Points on Methods
4.1 Capturing a Method Call
4.2 Capturing the Parameter Values passed on a Method Call
4.3 Capturing the Target of a Method Call
4.4 Capturing a Method when it is Executing
4.5 Capturing the Value of the "this" Reference when a Method is Executing
5. Capturing Join Points on Exception Handling
5.1 Capturing when an Exception is Caught
5.2 Capturing the Thrown Exception
5.3 Capturing the Object Handling the Exception
6. Capturing Join Points on Advice
6.1 Capturing when Advice is Executing
6.2 Excluding Join Points that are a Result of Advice Execution
6.3 Exposing the original Join Point when Advice is being Advised
7. Capturing Join Points on Class and Object Construction
7.1 Capturing a Call to a Constructor
7.2 Capturing a Constructor when it is Executing
7.3 Capturing when an Object is Initialized
7.4 Capturing when an Object is about to be Initialized
7.5 Capturing when a Class is Initialized
8. Capturing Join Points on Attributes
8.1 Capturing when an Object's Attribute is Accessed
8.2 Capturing the Value of the Field being Accessed
8.3 Capturing when an Object's Field is Modified
8.4 Capturing the Value of a Field when it is Modified
9. Capturing Join Points within Programmatic Scope
9.1 Capturing all Join Points within a particular Class
9.2 Capturing all Join Points within a particular Package
9.3 Capturing all Join Points within a particular Method
10. Capturing Join Points based on Control Flow
10.1 Capturing all Join Points within a Program's Control Flow initiated by an Initial Join Point
10.2 Capturing all Join Points within a Program's Control Flow, Excluding the Initial Join Point
11. Capturing Join Points based on Object Type
11.1 Capturing when the "this" reference is a specific Type
11.2 Capturing when a Join Point's Target Object is a specific Type
11.3 Capturing when the Arguments to a Join Point are a certain Number, Type and Ordering
12. Capturing Join Points based on a Boolean or Combined Expression
12.1 Capturing when a Runtime Condition evaluates to True on a Join Point
12.2 Combining Pointcuts Using a Logical AND (&&)
12.3 Combining Pointcuts Using a Logical OR (||)
12.4 Capturing all Join Points NOT specified by a Pointcut Definition
12.5 Declaring Anonymous Pointcuts
12.6 Reusing Pointcuts
13. Defining Advice
13.1 Accessing Class Members
13.2 Accessing the Join Point Context
13.3 Executing Advice Before a Join Point
13.4 Executing Advice Around a Join Point
13.5 Executing Advice Unconditionally After a Join Point
13.6 Executing Advice Only After a Normal Return from a Join Point
13.7 Executing Advice Only After an Exception has been raised in a Join Point
13.8 Controlling Advice Precedence
13.9 Advising Aspects
14. Defining Aspect Instantiation
14.1 Defining Singleton Aspects
14.2 Defining an Aspect Per-Instance
14.3 Defining an Aspect Per-Control Flow
15. Defining Aspect Relationships
15.1 Inheriting Pointcut Definitions
15.2 Implementing Abstract Pointcuts
15.3 Inheriting Classes into Aspects
15.4 Declaring Aspects Inside Classes
16. Enhancing Classes and the Compiler
16.1 Extending An Existing Class
16.2 Declaring Inheritance between Classes
16.3 Implementing Interfaces using Aspects
16.4 Declaring a Default Interface Implementation
16.5 Softening Exceptions
16.6 Extending Compilation
17. Implementing Creational Object-Oriented Design Patterns
17.1 Implementing the Singleton Pattern
17.2 Implementing the Prototype Pattern
17.3 Implementing the Abstract Factory Pattern
17.4 Implementing the Factory Method Pattern
17.5 Implementing the Builder Pattern
18. Implementing Structural Object-Oriented Design Patterns
18.1 Implementing the Composite Pattern
18.2 Implementing the Flyweight Pattern
18.3 Implementing the Adapter Pattern
18.4 Implementing the Bridge Pattern
18.5 Implementing the Decorator Pattern
18.6 Implementing the Proxy Pattern
19. Implementing Behavioral Object-Oriented Design Patterns
19.1 Implementing the Observer Pattern
19.2 Implementing the Command Pattern
19.3 Implementing the Iterator Pattern
19.4 Implementing the Mediator Pattern
19.5 Implementing the Chain of Responsibility Pattern
19.6 Implementing the Memento Pattern
19.7 Implementing the Strategy Pattern
19.8 Implementing the Visitor Pattern
19.9 Implementing the Template Method Pattern
19.10 Implementing the State Pattern
19.11 Implementing the Interpreter Pattern
20. Applying Class and Component Scale Aspects
20.1 Validating Parameters Passed to a Method
20.2 Overriding the Class Instantiated on a Call to a Constructor
20.3 Adding Persistence to a Class
20.4 Applying Mock Components to Support Unit Testing
21. Applying Application Scale Aspects
21.1 Applying Aspect-Oriented Tracing
21.2 Applying Aspect-Oriented Logging
21.3 Applying Lazy Loading
21.4 Managing Application Properties
22. Applying Enterprise Scale Aspects
22.1 Applying Development Guidelines and Rules
22.2 Applying Transactions
22.3 Applying Resource Pooling
22.4 Remoting a Class Transparently using RMI
22.5 Applying a Security Policy
23. Applying Aspect-Oriented Design Patterns
23.1 Applying the Cuckoo's Egg Design Pattern
23.2 Applying the Director Design Pattern
23.3 Applying the Border Control Design Pattern
23.4 Applying the Policy Design Pattern
A. The AspectJ Runtime API
Index
商品描述(中文翻譯)
**描述:**
當物件導向程式設計(Object Oriented programming, OO)首次出現時,這是一個重大的突破。OO 使開發者能夠創建更靈活和穩健的軟體,但隨著時間的推移,應用程式變得越來越複雜,某些「傳統」OO 架構的某些領域顯得不足。面向方面程式設計(Aspect-oriented programming, AOP)通過進一步擴展 OO 方法來解決這些問題。
許多開發者對 AOP 感興趣,特別是 AspectJ,這是 Java 程式語言的開源擴展,明確支持 AOP 方法。然而,儘管 AspectJ 隨著 Eclipse 一起提供,Eclipse 是一個越來越受歡迎的 Java 開源 IDE,但找到一種實用且非理論化的方式來學習這種語言及其他 AOP 工具和技術一直是一個真正的問題。
直到現在。《AspectJ 食譜》提供了一個實用的解決方案——事實上,有幾個解決方案,提供了各種代碼食譜,以使用 AOP 的獨特方法解決日常設計和編碼問題。
AOP 允許程式的全局屬性決定它如何被編譯成可執行的程式。在 AOP 出現之前,重要的程式設計決策很難在實際代碼中捕捉到。相反,這些設計決策的實現——稱為「方面」——分散在整個程式中,導致「糾結」的代碼,難以開發和維護。AOP 被比作布料的製造,其中線條自動交織。沒有 AOP,程式設計師必須手動縫合這些線條。
《AspectJ 食譜》向讀者展示了為什麼以及如何使用 AOP 技術解決常見的 Java 開發問題。通過我們受歡迎的問題-解決-討論格式,本書提供了現實世界的範例,證明 AOP 不僅僅是一個概念;它是一個開發過程,將立即和明顯地使使用者受益。
如果您對 AOP 如何改變軟體開發方式感興趣,以及如何使用 AspectJ 使代碼更模組化、更易於開發、維護、演進和部署,那麼這本書將真正提供幫助。
**目錄:**
**前言**
**1. 面向方面概述**
1.1 AspectJ
1.2 面向方面的定義
1.3 獲取更多資訊的地方
**2. 開始使用 AspectJ**
2.1 安裝 AspectJ
2.2 開發一個簡單的方面
2.3 編譯一個方面和多個 Java 檔案
2.4 將方面編織到 JAR 檔中
2.5 在載入時編織方面
2.6 生成 Javadoc 文檔
2.7 使用 Eclipse 編譯 AspectJ 專案
2.8 在 Eclipse 中選擇要編織的方面
2.9 使用 Ant 建立 AspectJ 專案
**3. 部署 AspectJ 應用程式**
3.1 部署命令行 AspectJ 應用程式
3.2 將 AspectJ 應用程式部署為完全獨立的可執行 JAR 檔
3.3 部署使用 AspectJ 的 Java Servlet
3.4 部署使用 AspectJ 的 JSP
3.5 部署使用 AspectJ 的 Axis Web 服務
**4. 捕捉方法的連接點**
4.1 捕捉方法調用
4.2 捕捉方法調用中傳遞的參數值
4.3 捕捉方法調用的目標
4.4 捕捉方法執行時
4.5 捕捉方法執行時的 'this' 引用的值
**5. 捕捉異常處理的連接點**
5.1 捕捉異常被捕獲時
5.2 捕捉拋出的異常
5.3 捕捉處理異常的物件
**6. 捕捉建議的連接點**
6.1 捕捉建議執行時
6.2 排除由建議執行產生的連接點
6.3 在建議被建議時暴露原始連接點
**7. 捕捉類別和物件建構的連接點**
7.1 捕捉對建構子的調用
7.2 捕捉建構子執行時
7.3 捕捉物件初始化時
7.4 捕捉物件即將初始化時
7.5 捕捉類別初始化時
**8. 捕捉屬性的連接點**
8.1 捕捉物件屬性被訪問時
8.2 捕捉被訪問的欄位的值
8.3 捕捉物件欄位被修改時
8.4 捕捉欄位被修改時的值
**9. 捕捉程式範圍內的連接點**
9.1 捕捉特定類別內的所有連接點
9.2 捕捉特定包內的所有連接點
9.3 捕捉特定方法內的所有連接點
**10. 根據控制流捕捉連接點**
10.1 捕捉由初始連接點啟動的程式控制流內的所有連接點
10.2 捕捉程式控制流內的所有連接點,排除初始連接點
**11. 根據物件類型捕捉連接點**
11.1 捕捉 'this' 引用為特定類型時
11.2 捕捉連接點的目標物件為特定類型時
11.3 捕捉連接點的參數為特定數量、類型和順序時
**12. 根據布林或組合表達式捕捉連接點**
12.1 捕捉在連接點上運行時條件評估為真時
12.2 使用邏輯 AND (&&) 組合切入點
12.3 使用邏輯 OR (||) 組合切入點
12.4 捕捉所有未由切入點定義指定的連接點
12.5 宣告匿名切入點
12.6 重用切入點
**13. 定義建議**
13.1 訪問類別成員
13.2 訪問連接點上下文
13.3 在連接點之前執行建議
13.4 在連接點周圍執行建議
13.5 在連接點之後無條件執行建議
13.6 只有在連接點正常返回後執行建議
13.7 只有在連接點中引發異常後執行建議
13.8 控制建議的優先順序
13.9 建議方面
**14. 定義方面實例化**
14.1 定義單例方面
14.2 定義每個實例的方面
14.3 定義每個控制流的方面
**15. 定義方面關係**
15.1 繼承切入點定義
15.2 實現抽象切入點
15.3 將類別繼承到方面
15.4 在類別內宣告方面
**16. 增強類別和編譯器**
16.1 擴展現有類別
16.2 宣告類別之間的繼承
16.3 使用方面實現介面
16.4 宣告預設介面實現
16.5 軟化異常
16.6 擴展編譯
**17. 實現創建型物件導向設計模式**
17.1 實現單例模式
17.2 實現原型模式
17.3 實現抽象工廠模式
17.4 實現工廠方法模式
17.5 實現建造者模式
**18. 實現結構型物件導向設計模式**
18.1 實現組合模式
18.2 實現享元模式
18.3 實現適配器模式
18.4 實現橋接模式
18.5 實現裝飾者模式
18.6 實現代理模式
**19. 實現行為型物件導向設計模式**
19.1 實現觀察者模式
19.2 實現命令模式
19.3 實現迭代器模式
19.4 實現中介者模式
19.5 實現責任鏈模式
19.6 實現備忘錄模式
19.7 實現策略模式
19.8 實現訪問者模式
19.9 實現模板方法模式
19.10 實現狀態模式
19.11 實現解釋器模式
**20. 應用類別和元件規模方面**
20.1 驗證傳遞給方法的參數
20.2 在對建構子的調用中覆蓋實例化的類別
20.3 為類別添加持久性
20.4 應用模擬元件以支持單元測試
**21. 應用應用程式規模方面**
21.1 應用面向方面的追蹤
21.2 應用面向方面的日誌記錄