Manning Logo
Home | Ordering Info | Shopping Cart | Manage My Account | Login
Attention customers: online shopping is now available exclusively through our main website: http://www.manning.com. Thank you.
Java Reflection in Action

Inside the book

About this Book Sample Chapters Table of Contents Index Preface Book Reviews Source Code Author Online

Manning Blog

Why small is sweet?

Author Blogs

Dave Crane more...

Author Calendar

Upcoming Events

Catalog

Java .NET Perl XML All by Subject All by Title

About...

Manning Contact Us Ordering FAQs ebooks Covers Sandbox Forums Distributors Manning Early Access Program (MEAP) Affiliate Program Academia/Publicity User Group Program Press Releases Jobs

Manning Publications Co.
209 Bruce Park Avenue
Greenwich, CT 06830

Java Reflection in Action
Ira R. Forman and Nate Forman

2004 | 300 pages
ISBN: 1932394184
$22.50 PDF ebook  
$44.95 Softbound print book  

About this Book

About this book

How this book is organized

The ten chapters of this book are organized as follows:

Chapters 1, 2, and 3 introduce the basics of Java reflection: how to access class objects; how to dynamically examine classes, methods, fields, and constructors; and how to dynamically load classes.

Chapter 4 introduces the first advanced reflective feature: dynamic proxies. The chapter covers the facilities of the Proxy class and how to use them. There are several useful examples, including how to add properties to objects and how to create a test stub generator.

Chapter 5 covers the topic of examining the call stack. This is important for reflectively solving problems related to what a running program is doing.

Chapter 6 delves into customizing class loaders. This topic is necessary to reflective programming because some problems require the collection of metadata that is available only when classes are loaded.

Chapter 7 begins a two-chapter sequence on reflective code generation. This chapter introduces a framework for class-to-class transformations, a particular kind of code generator that starts with a compiled class and produces a new compiled class, which usually has some additional property.

Chapter 8 continues the sequence by using the framework for class-to-class transformations to support implementation of designs that use patterns.

Chapter 9 presents performance-measurement techniques for making design decisions among reflective features.

Chapter 10 takes a look at the future of reflection in Java. This includes an overview of the impact of Java 1.5 on reflective programming, which other production languages will influence the future of reflection in Java, and the influence of Aspect-Oriented Programming.

Appendix A is a reprise of the introduction to reflection but with a more academic point of view. The appendix presents a brief history of reflection and the terminology that you are likely to encounter when reading advanced papers.

Appendix B explains how to handle compilation errors in the program that dynamically compiles the "Hello World!" program.

Appendix C summarizes the UML conventions used to diagram reflective programs.

Who should read this book

This book is a practical guide for intermediate programmers. The book has one goal: to make your programming job easier. We accomplish this in two ways:

  • Teach Java reflection-The book concentrates on small teachable examples, mainly in the area of software development and test tools, a problem area common to all programmers. We describe the reflective facilities and also prescribe effective ways to use them.
  • Convey an understanding of reflection in general-Reflection is much broader than what is incorporated in Java. We discuss the limitations of Java reflection and show techniques for working around them. This discussion furthers your understanding of Java reflection by using it in the techniques. It also motivates ideas about next-generation features, preparing you to use them.

This book is prescriptive. That is, it advocates techniques for using Java reflection that we have used and profited from in our jobs.

Source code

The examples in this book have all been compiled and minimally tested. Source code examples are available online from the publisher's web site: www.manning.com/forman. No warranty is implied as to the total correctness of the source code in this book.

A note about Java programming style

In order to make this book as readable as possible, we have adopted a style of Java programming that suits the static line size of the printed page rather than the dynamic interface of the program editor. With this style, we have succeeded in limiting almost all classes to no more than two pages. This style tends to reduce whitespace. We do not recommend this style, but we do hope you appreciate the readability of the book.

Author online

Purchase of Java Reflection in Action includes free access to a private web forum where you can make comments about the book, ask technical questions, and receive help from the authos and from other users. To access the forum and subscribe to it, point your web browser to www.manning.com/forman. This page provides information on how to get on the forum once you are registered, what kind of help is available, and the rules of conduct on the forum. It also provides links to the source code for the examples in the book, errata, and other downloads.

Manning's commitment to our readers is to provide a venue where a meaningful dialog between individual readers and between readers and the authors can take place. It is not a commitment to any specific amount of participation on the part of the authors, whose contribution to the AO remains voluntary (and unpaid). We suggest you try asking the authors some challenging questions lest their interest stray!

DESCRIPTION

You are a Java developer. You are asked to add a simple feature to your application. But "simple" can be deceiving: you have to make many changes, in locations which can be difficult to find.

If this sounds familiar, you want to know about Java reflection. With reflection, you can work smarter by designing flexible applications to which you can easily add likely new requirements. Then, with a few code changes in easy-to-find places, you've got the job done. Reflection adds a new dimension to your programming skills. It will boost your effectiveness.

Java Reflection in Action starts from the basics. It gradually builds a complete understanding, adding as it goes reflective concepts illustrated with many small examples that are useful in real applications.

In a subplot, the book follows a programmer, George, as he tackles common but difficult tasks. In each case, George finds flexible, reflective solutions that replace the usual hard-coded ones. The power of reflection becomes clear through his story.

What's Inside

  • Introduction to reflective programming
  • How reflective code generation can address common cross-cutting concerns
  • How to load new classes dynamically into a running application
  • How to decide when reflection is the best solution

WHAT THE EXPERTS SAY ABOUT THIS BOOK...

"Contains the best description of Java's dynamic proxies that I've ever come across, and also has notes on the relevant new features in Java 1.5. ...required reading for anyone who's serious about making Java work for them."
-- Dr. Dobb's Journal

"Valuable, both for the professional software developer, and for academics and students who wish to better understand this aspect of object-oriented programming."
-- Computing Reviews

"Exceptional coverage of an area of Java programming that is generally poorly covered and often misunderstood. 10 horseshoes."
-- JavaRanch.com

ABOUT THE AUTHORS...

Dr. Ira Forman is a senior software engineer at IBM. He started working on reflection in the early 1990s when he developed IBM's SOM Metaclass Framework. Nate Forman works for Ticom Geomatics where he uses reflection in day-to-day problems. Ira and Nate are father and son. They live in Austin, Texas.

Home | Catalog | Privacy Policy | About Manning

© 2003-2006 Manning Publications Co.