One of the JavaIdioms. Also known as the "PICA" technique.
- Create an interface and mark some combination of the interface itself, its methods, and its methods' parameters with annotations that serve to configure specific behaviors you want the methods to exhibit.
- Create an Invocation Handler that uses data from the annotations to direct the behaviors that should occur when the interface's methods are invoked.
- Using java.lang.reflect.Proxy.newProxyInstance(), create an instance of a dynamic proxy that implements the interface and uses the invocation handler.
http://www.devx.com/Java/Article/42492
CategoryJava