background preloader

Reflection

Facebook Twitter

Fluent

Developing A Simple Pluggable Java Application. Most of the applications we use on daily basis are pluggable.

Developing A Simple Pluggable Java Application

Popular applications like Firefox, Eclipse, NetBeans, JEdit, WordPress, Hudson are all pluggable. In fact, pluggability has played a major part in the success of most of these applications. Why not make the Java applications we develop pluggable as well? Fluent Interface and Reflection for Object Building in Java at S. A post by Randy Patterson on creating fluent interfaces in C# got me thinking.

Fluent Interface and Reflection for Object Building in Java at S

Randy shows how to create a Fluent Interface to build an object. He uses a Person class (POJO) with setFirstName and a PersonFluentInterface class with firstName. Creating an object and setting some attributes needs quite a lot of code: Person person = new Person(); person.setFirstName("Pat"); person.setLastName("Frank"); person.setAge(30); person.setActive(true); Make reflection as fast as direct calls. Java Reflection Tutorial: Introduction.