Ottimo libro per cominciare a capire cosa sia la Reflection in Java con esempi molto validi.
Leggermente confusionario nella parte relativa all'applicazione con il Design Pattern Proxy, ma tutto sommato un ottimo acquisto.
Have one to sell?

Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet or computer – no Kindle device required. Learn more
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera, scan the code below and download the Kindle app.

Flip to back Flip to front
Java Reflection in Action Paperback – Oct. 1 2004
by
Ira R Forman
(Author),
Nate Forman
(Author)
Amazon Price | New from | Used from |
Paperback
"Please retry" | $18.36 | — | $12.63 |
Mass Market Paperback
"Please retry" |
—
| — | $71.72 |
Explaining the Java Reflection API and providing techniques for using it effectively, this guide describes the capabilities that allow a program to examine and modify itself at runtime. The java.lang.reflect package and its uses are covered, including a detailed discussion of Java's dynamic proxy facility. Less obvious reflective capabilities, such as call stack introspection and the Java class loader, are addressed. In recognition of the limitations of Java Reflection, the various ways to use Reflection to generate code and surpass these limitations are detailed. A discussion of performance analysis techniques and a look ahead at what is new in JDK 1.5 is included.
- Print length273 pages
- LanguageEnglish
- PublisherManning Publications
- Publication dateOct. 1 2004
- Dimensions18.85 x 1.52 x 23.42 cm
- ISBN-101932394184
- ISBN-13978-1932394184
Customers who bought this item also bought
Page 1 of 1 Start overPage 1 of 1
Product description
Review
Exceptional coverage of an area . . . that is generally poorly covered and often misunderstood. -- JavaRanch.com
Well-written . . . presents a difficult topic in a clear and comprehensible fashion. -- Computing Review
Well-written . . . presents a difficult topic in a clear and comprehensible fashion. -- Computing Review
About the Author
<div><b>Ira R. Forman</b> is the author of <i>Interacting Processes</i> and <i>Putting Metaclasses to Work</i>. He was a member of IBM's Object Technology Products Group, which produced the SOMobjects Toolkit, and he designed and programmed the SOM Metaclass Framework. <b>Nate Forman</b> works for Ticom Geomatics where he designs and programs application frameworks. His specialties are patterns and object-oriented programming. They both live in Austin, Texas.<br></div>
Product details
- Publisher : Manning Publications (Oct. 1 2004)
- Language : English
- Paperback : 273 pages
- ISBN-10 : 1932394184
- ISBN-13 : 978-1932394184
- Item weight : 524 g
- Dimensions : 18.85 x 1.52 x 23.42 cm
- Customer Reviews:
About the author
Follow authors to get new release updates, plus improved recommendations.

Discover more of the author’s books, see similar authors, read author blogs and more
Customer reviews
4.5 out of 5 stars
4.5 out of 5
10 global ratings
How are ratings calculated?
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzes reviews to verify trustworthiness.
Top reviews from other countries

NeoEden
4.0 out of 5 stars
Ottimo libro
Reviewed in Italy 🇮🇹 on June 15, 2015Verified Purchase

wiredweird
4.0 out of 5 stars
Almost great
Reviewed in the United States 🇺🇸 on January 4, 2006Verified Purchase
This book presents an unusual but surprisingly important Java API, the one that underlies component technologies, dynamic loading, and more. Reflection isn't just for ubergeeks writing debuggers and similarly gutsy applications, it can help with everyday tasks of many kinds. The Formans show how, using many examples and a friendly but technically dense style.
The book covers all the basics. It starts with the whole idea of metaprogramming, writing programs about programs. Maybe it sounds involuted, but the first two chapters show how it works for handling the basic features of an application, the methods and fields. The next topics cover object creation: first, objects of classes that already exist, then classes created on the fly using Java's Proxy mechanism. A little later, they cover class loaders and custom loaders in the clearest, best-motivated discussion I've seen anywhere. The chapter on Design Patterns is, as in so many books, somewhat perfunctory. I've used reflection to analyze DPs in running programs, so I found that chapter disappointing. The last chapter begs to be rewritten. This book was in production when Java 5 was on the horizon, but issued after Java 5 hit the streets. Java 5 introduced many new features such as annotation, and new reflective APIs to support them. That last chapter looks forward to features that have since become real - not a fault of the authors', but enough reason for a second edition.
There are some real problems in this book, though. A minor one is that the reflection API isn't actually laid out entire anywhere in the discussion, but JavaDoc will take care of that for you. More importantly, serialization is a crucial part of the component technologies that reflection supports. This book largely disregards the standard APIs and SPIs in favor of an ad hoc, roll-your-own approach. Trust me, that's a bad idea. See Halloway's aging 'Component Development' book or old editions of 'Java in a Nutshell' for much more complete treatment of real serialization. Part of the problem in this treatment of serialization is its weak discussion of the inheritance hierarchy: when serializing a subclass, you have access to only half of an object. The superclass[es] is[are] the other half, and may have private data that the subclass can't serialize on its own. This weakness recurs in an otherwise interesting discussion on checking of invariants. The approach in this book seems to forget that the subclass invariants are only half of the object invariants, and the superclass is not handled. Also, as Szyperski notes, invariants interact subtly with callbacks, a discussion conspicuous by its absence.
This is an advanced book that Java newbies might not benefit from, and I don't mean that as a criticism. It's for experienced programmers with big, complex problems. It's for dynamic, extensible systems, the kind that we all want to work on. Even though it's Java-based, it's for anyone programming in any reflective language, at least until your language gets its own version of this book. Despite some significant problems, I recommend this book highly.
//wiredweird
The book covers all the basics. It starts with the whole idea of metaprogramming, writing programs about programs. Maybe it sounds involuted, but the first two chapters show how it works for handling the basic features of an application, the methods and fields. The next topics cover object creation: first, objects of classes that already exist, then classes created on the fly using Java's Proxy mechanism. A little later, they cover class loaders and custom loaders in the clearest, best-motivated discussion I've seen anywhere. The chapter on Design Patterns is, as in so many books, somewhat perfunctory. I've used reflection to analyze DPs in running programs, so I found that chapter disappointing. The last chapter begs to be rewritten. This book was in production when Java 5 was on the horizon, but issued after Java 5 hit the streets. Java 5 introduced many new features such as annotation, and new reflective APIs to support them. That last chapter looks forward to features that have since become real - not a fault of the authors', but enough reason for a second edition.
There are some real problems in this book, though. A minor one is that the reflection API isn't actually laid out entire anywhere in the discussion, but JavaDoc will take care of that for you. More importantly, serialization is a crucial part of the component technologies that reflection supports. This book largely disregards the standard APIs and SPIs in favor of an ad hoc, roll-your-own approach. Trust me, that's a bad idea. See Halloway's aging 'Component Development' book or old editions of 'Java in a Nutshell' for much more complete treatment of real serialization. Part of the problem in this treatment of serialization is its weak discussion of the inheritance hierarchy: when serializing a subclass, you have access to only half of an object. The superclass[es] is[are] the other half, and may have private data that the subclass can't serialize on its own. This weakness recurs in an otherwise interesting discussion on checking of invariants. The approach in this book seems to forget that the subclass invariants are only half of the object invariants, and the superclass is not handled. Also, as Szyperski notes, invariants interact subtly with callbacks, a discussion conspicuous by its absence.
This is an advanced book that Java newbies might not benefit from, and I don't mean that as a criticism. It's for experienced programmers with big, complex problems. It's for dynamic, extensible systems, the kind that we all want to work on. Even though it's Java-based, it's for anyone programming in any reflective language, at least until your language gets its own version of this book. Despite some significant problems, I recommend this book highly.
//wiredweird
14 people found this helpful
Report

Andriy Fomenko
4.0 out of 5 stars
Great introduction, flimsy second part
Reviewed in the United States 🇺🇸 on February 28, 2013Verified Purchase
First of all: this is a GREAT INTRODUCTION to Reflection, definite MUST READ for any Java developer who did not use Reflection before.
Overall: I would recommend buying after I've read the book.
Now, a less glorious side... This book is OLD. It is based on Java 1.4 and Java 5 was only in works when it was published, so annotations and generics are not really covered: they are mentioned as "well... let's wait until it gets finalized and then Reflection would be likely expanded to cover these topics"...
The second part of the book (starting from "code generation") is perceived by me as a collection on hacks which authors put into this book just to make up the volume...
Anyway: book is definitely worth reading :)
Overall: I would recommend buying after I've read the book.
Now, a less glorious side... This book is OLD. It is based on Java 1.4 and Java 5 was only in works when it was published, so annotations and generics are not really covered: they are mentioned as "well... let's wait until it gets finalized and then Reflection would be likely expanded to cover these topics"...
The second part of the book (starting from "code generation") is perceived by me as a collection on hacks which authors put into this book just to make up the volume...
Anyway: book is definitely worth reading :)

Riccardo Audano
3.0 out of 5 stars
Nice Firework
Reviewed in the United States 🇺🇸 on December 9, 2006Verified Purchase
This book starts great, brilliant and clear, and then crushes and burns to a cold, dark, inglorious end. The first six chapters are very well written and informative. Thanks to them some pieces that were still missing from my java puzzle clicked into place nicely. Any reasonably experienced java programmer will find interesting material on the basics of reflection, manipulating fields and methods, dynamic object construction, stack trace reflection and the uses of a dynamic proxy.
I liked the choice of introducing new material with a very simple and self contained example before attempting a more complex "put it all together" example. Also, yes, the examples are quite contrieved, but that can be justified because while it's true that little bits and pieces of the reflection API can be useful in most programs, it's definitely hard to come up with an example program that gains real advantage by using ALL of the reflection API.
Starting with chapter 7 on code generation, this book takes the very sorry road of an overly academical, obscure style that is only about introducing unnecessary complications. My bet is the real reason for introducing these last chapters was to fatten up a book that even like that is quite slim. In fact it's certainly not easy to produce a 200+ pages book on reflection alone, but still the author's would have been better off introducing more examples, or even treating another subject besides reflection, than introducing these bogus chapters. Still a worthy buy though, for a java programmer that has digested the basics and is curious to find out what is possible with the apparently arcane features of reflection.
I liked the choice of introducing new material with a very simple and self contained example before attempting a more complex "put it all together" example. Also, yes, the examples are quite contrieved, but that can be justified because while it's true that little bits and pieces of the reflection API can be useful in most programs, it's definitely hard to come up with an example program that gains real advantage by using ALL of the reflection API.
Starting with chapter 7 on code generation, this book takes the very sorry road of an overly academical, obscure style that is only about introducing unnecessary complications. My bet is the real reason for introducing these last chapters was to fatten up a book that even like that is quite slim. In fact it's certainly not easy to produce a 200+ pages book on reflection alone, but still the author's would have been better off introducing more examples, or even treating another subject besides reflection, than introducing these bogus chapters. Still a worthy buy though, for a java programmer that has digested the basics and is curious to find out what is possible with the apparently arcane features of reflection.
2 people found this helpful
Report

rdf
5.0 out of 5 stars
Excellent guide to reflection and reflection in java
Reviewed in the United States 🇺🇸 on December 17, 2005Verified Purchase
The authors know a great deal about reflection in general and use it to ground a clear, detailed explanation of how to use reflection in Java.
My only qualm about the book is their discussion of the use of microbenchmarks to evaluate the impact of reflection upon execution speed. My experience is that microbenchmarks such as these, give you a best case lower bound on execution speed.
Echoing the other reviews, every Java programmer should know this. It will make your code cleaner, better and more maintainable. The book also contains an excellent set of references to help the reader explore the general topic of reflection in greater depth.
My only qualm about the book is their discussion of the use of microbenchmarks to evaluate the impact of reflection upon execution speed. My experience is that microbenchmarks such as these, give you a best case lower bound on execution speed.
Echoing the other reviews, every Java programmer should know this. It will make your code cleaner, better and more maintainable. The book also contains an excellent set of references to help the reader explore the general topic of reflection in greater depth.