Component Development for the Java Platform / Edition 1

Component Development for the Java Platform / Edition 1

Pub. Date:

Paperback - Rent for

Select a Purchase Option (New Edition)
  • purchase options

Temporarily Out of Stock Online


Component Development for the Java Platform / Edition 1

Java™ is an object-oriented language, but it is also a component-oriented platform. Java's class-loading model and rich type information makes it possible to build flexible and reusable binary components. COMPONENT DEVELOPMENT FOR THE JAVA™ PLATFORM reveals both the potential and pitfalls of developing components using the Java platform.

As a platform, Java defines the services needed to connect binary components at runtime safely and reliably. To truly take advantage of all that Java has to offer, you must consider not just development but also deployment, and not just objects but also components. COMPONENT DEVELOPMENT FOR THE JAVA™ PLATFORM delves into the component-oriented features of the Java platform, thoroughly discussing class loading, reflection, serialization, native interoperation, and code generation.


  • Use and troubleshoot Class Loaders
  • Build dynamic and generic services through reflection
  • Control an object's serialized representation
  • Load and use native code components
  • Extend the Java class format to add custom services
  • Automate development with code generation

This is a cutting-edge approach to Java programming: An emphasis on deployment can be the best way to take advantage of some of the most valuable, yet less heralded, aspects of Java technology.


Product Details

ISBN-13: 9780201753066
Publisher: Addison-Wesley
Publication date: 12/28/2001
Series: DevelopMentor Series
Edition description: New Edition
Pages: 368
Product dimensions: 7.30(w) x 9.00(h) x 0.90(d)

Table of Contents


1. From Objects to Components.

2. The Class Loader Architecture.

Assembling an Application.

Goals of the Class Loader Architecture.



Capability @


Handling Name and Version Conflicts.


Explicit and Implicit Class Loading.

Explicit Loading with URLClassLoader.

Implicit Class Loading.

Reference Type vs. Referenced Class.

ClassLoader.loadClass vs. Class.forName.

Loading Nonclass Resources.

The Class Loader Rules.

The Consistency Rule.

The Delegation Rule.

The Visibility Rule.

Delegations as Namespaces.

Static Fields are Not Singletons.

Implicit Loading Hides Most Details.

Hot Deployment.

Using Hot Deployment.

Unloading Classes.

Making Sure Classes are Collectable.

Bootclasspath, Extensions Path, and Classpath.

The Classpath.

The Extensions Path.

The Bootstrap Loader.

Debugging Class Loading.

Instrumenting an Application.

Using -verbose:class.

Instrumenting the Core API.

Inversion and the Context Class Loader.



3. Type Information and Reflection.

The Binary Class Format.

Binary Compatibility.

Binary Class Metadata.

From Binary Classes to Reflection.


Reflecting on Fields.

The Difference between get and getDeclared.

Type Errors Occur at Runtime.

Reflecting on Methods.

Reflective Invocation.

A Reflective Launcher.

Wrapping Primitive Types.

Bypassing Language Access Rules.

Exceptions Caused by Reflective Invocation.

Dynamic Proxies.

Delegation Instead of Implementation Inheritance.

Dynamic Proxies Make Delegation Generic.

Implementing InvocationHandler.

Implementing a Forwarding Handler.

The InvocationHandler as Generic Service.

Handling Exceptions in an InvocationHandler.

Either Client or Server can Install a Proxy.

Advantages of Dynamic Proxies.

Reflection Performance.

Package Reflection.

Setting Package Metadata.

Accessing Package Metadata.

Sealing Packages.

Weaknesses of the Versioning Mechanism.

Custom Metadata.



4. Serialization.

Serialization and Metadata.

Serialization Basics.

Serialization Skips Some Fields.

Serialization And Class Constructors.

Using readObject and writeObject.

Matching Streams With Classes.

The serialVersionUID.

Overriding the Default SUID.

Compatible and Incompatible Changes.

Explicitly Managing Serializable Fields.

ObjectInputStream.GetField Caveats.

Writer Makes Right.

Overriding Class Metadata.

Performance Problems.

Custom Class Descriptors.

Abandoning Metadata.

Writing Custom Data After defaultWriteObject.


Using writeObject to Write Raw Data Only: Bad Idea.

Object Graphs.

Pruning Graphs with Transient.

Preserving Identity.

Encouraging the Garbage Collector with Reset.

Object Replacement.

Stream-Controlled Replacement.

Class-Controlled Replacement.

Ordering Rules for Replacement.

Taking Control of Graph Ordering.

Finding Class Code.

Annotation in RMI.

RMI MarshalledObjects.



5. Customizing Class Loading.

Java 2 Security.

The Role of Class Loaders.

Custom Class Loaders.

Pre-Java 2 Custom Class Loaders.

Class Loading Since SDK 1.2.

A Transforming Class Loader.

Protocol Handlers.

Implementing a Handler.

Installing a Custom Handler.

Choosing Between Loaders and Handlers.

Getting Past Security to the Loader You Need.

Reading Custom Metadata.

Example: Version Attributes.

Serializable Classes as Attributes.

Reading Attributes During Class Loading.

Debugging Support.



6. Interop 1: JNI.

Why Interoperate?

The Dangers of Native Code.

Finding and Loading Native Code.

Name Mappings.

Type Mappings.

Overloaded Names.

Loading Native Libraries.

Class Loaders and JNI.

Common Errors Loading Native Libraries.

Troubleshooting Native Loading.

Calling Java from C++.

Minimizing Round Trips.

Performance Comparisons.

Differences Between JNI and Reflective Invocation.

Error Handling in JNI.

Failures in Native Code.

Handling C++ Exceptions.

Handling Java Exceptions from Native Code.

Throwing Java Exceptions from Native Code.

Resource Management.

Interacting with the Garbage Collector.

Managing Native Resources.

Managing Arrays.

Managing Strings.



7. Generative Programming.

Why Generate Code?

Object Oriented Approaches to Modeling Variabilities.

Thinking in Terms of Bind Time.

Separating Specification From Bind Time.

Choosing a Specification Language.

Reuse Requires More than One Use.

A Little Domain Analysis is a Dangerous Thing.

Why Generate Code with Java?

Type Information Acts As a Free Specification Document.

Class Loading Supports Flexible Binding Modes.

Java Source is Easy To Generate.

Java Binary Classes are Easy To Generate.

Code Generation Boosts Performance.

Levels of Commitment to Code Generation.

A Taxonomy of Bind Times and Modes.

Code Generation in RMI.

Code Generation in JSP.

Code Generation in EJB.

The Deployment Descriptor.

Alternate Implementations.

Generating Strongly Typed Collections.

Code Generation Language versus Target Language.

Generating Custom Serialization Code.



8. Onward.

Where We Are.

Where We Are Going.


Appendix—Interop 2: Bridging Java and Win32/COM.

Index. 0201753065T11262001

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews