Intro
Voyage of Discovery
Background - Who is Heinz?
Introduction to Topic
Design Patterns
Vintage Wines
Proxy Pattern
Proxy Structure
Types of Proxies in GoF
Approaches to writing proxies
Model for example
public class Company
public class Company
public interface MoralFibre
public interface MoralFibre
public class MoralFibreImpl
Handcoded Proxy
public class MoralFibreProxy
import static ...
Dynamic Proxies
Defining a Dynamic Proxy
import java.lang.reflect.*;
import java.lang.reflect.*;
import java.lang.reflect.*;
private Object realSubject()
import java.lang.reflect.*;
private Object realSubject()
A word about synchronization
Casting without Unchecked Warnings
Casting without Unchecked Warnings
Proxy Factory
Proxy Factory
import static ...
import static ...
Performance of Dynamic Proxies
Analysis of Performance Results
Virtual Proxy Gotchas
Checkpoint
Road Signs
References (Strong, Soft, Weak)
Strong, Soft and Weak References
Object Adapter Pattern - Pointers
Strong Pointer
Reference Pointer
Soft and Weak Reference Pointers
Using Turbocharged enums
public enum PointerType
PointerTest Example
PointerTest Example
Danger - References
Combining Pointers and Proxies
import java.lang.reflect.*;
private Object realSubject() throws Throwable
Weak Pointer is cleared ...
Weak Pointer is cleared ...
Soft Pointer more appropriate
Soft Pointer more appropriate
Further uses of Dynamic Proxy
Dynamic Object Adapter
Object Adapter Structure (GoF)
We delegate the call if ...
The ProxyFactory now gets a new method:
Client can now adapt interfaces very easily
Benefits of Dynamic Proxies
Conclusion
"How can I become a Java Specialist?"
Java allows the experienced developer to write highly flexible code, especially when using dynamic features like proxies and references. In this talk, Heinz brings these together with generics and enums. He will demonstrate some approaches of using Java's dynamic proxies to create virtual proxies, protection proxies, dynamic object adapters and dynamic decorators. A part of the talk will also explore the performance implications and compare it with the benefits gained. P.S. If you are wondering why "enum" is listed under "advanced features" you should definitely attend this talk.
Dr. Heinz Kabutz is a Java guru living in Crete. He consults, holds courses, programs, and - writes a weekly newsletter in which he shares some rather unconventional insights about Java. Things that push the envelope; make Java do things you thought it could not; dirty tricks and such. In other words, stuff you do not usually find in Java periodicals or newsletters.