libcats.org
Главная

Java Reflection in Action

Обложка книги Java Reflection in Action

Java Reflection in Action

,
I first ran across the concept of reflection in Java in Cornell's Core Java book back when I was first learning the Java programming language in 1998. However, that book just treated reflection as a set of cute pet tricks of which Java is capable. Interested in a particular aspect of a class? Use this or that method and inquire. Only thing was, as a developer of code and not of tools, I found this aspect of Java interesting but not particularly useful. This book gave me a whole new respect for the tool of reflection. In a large multimedia application, my main program was going through a long series of if statements and looking for matching strings and then calling the matching sub-application. It worked, but it was large, clunky, and not very maintainable. I read this book and got the idea for a much more elegant solution. Rather than enumerate each class, I build the class name of the object I need from my list of options to construct and instantiate using reflection at runtime. Mind you, I didn't read or buy this book with that solution in mind, the author was just so clear in talking about the usefulness of reflection that the idea came to me. That's just one of the uses I've found for reflection in reading this book. Trust me, you don't have to be a software tool developer to get good mileage from it. I highly recommend it. I list the table of contents just because the product description does not have it listed:



1 A few basics 1

2 Accessing fields reflectively 27

3 Dynamic loading and reflective construction 49

4 Using Java's dynamic proxy 73

5 Call stack introspection 107

6 Using the class loader 121

7 Reflective code generation 143

8 Design patterns 179

9 Evaluating performance 207

10 Reflecting on the future 225

appendix A Reflection and metaobject protocols 241

appendix B Handling compilation errors in the "Hello world!" program 253

appendix C UML 256



I subtract one star because this book was written before Java 1.5 came out, and new features have been added. However, it is still a good place to start when you want to see just what reflection in Java can do for you.
Ссылка удалена правообладателем
----
The book removed at the request of the copyright holder.
Популярные книги за неделю:
Только что пользователи скачали эти книги: