The Art of Metaprogramming in Java

Java & JVM
Location: Portland 255 Level: Intermediate
Average rating: **...
(2.42, 19 ratings)

The Art of Metaprogramming in Java

Metaprograming is the dirty little secret behind the success of many Java frameworks such as Spring and Struts2, and constitutes the backbone of many of the most fundamental APIs across the JEE technology stack. This session aims introduce the topic and highlight, with code examples, the different mechanisms and techniques to take advantage of this underused feature of the Java Programming Language.

This session will adopt a learn-by-example approach that combines the philosophy and theory behind metaprogramming with concrete code examples. The audience will be walked real-life scenarios to highlight the benefits of this technique such as minimizing the number of lines of code, reduced development time, and greater flexibility, etc… Design patterns, and best practices will be picked up along the way.

No previous knowledge or exposure to the topic is required, but an intermediate understanding of Java SE is expected.



  • What is Metaprogramming?
  • Metadata Formats?
  • Benefit?
  • Example: (Spring, etc…)

Metaprgamming In Java

  • Java Annotations – JSR 175
  • Annotation Processing
  • Compile time:
  • APT (Annotation Processing Tool) and Pluggable Annotation Processing API (JSR 269)
  • Runtime:
  • Java Reflection API
  • Libraries: Reflections, FEST-Reflect, etc…

Byte Code manipulation

  • ASM, CGLib, and Javassist
  • Project Averroes

Best Practices and Design Patterns

  • A step-by-step code example
  • The metadata
  • Metadata processing
  • Constructing a metamodel
  • Making sense of the metamodel
Photo of Abdelmonaim Remani

Abdelmonaim Remani

The NorCal Java User Group

A software developer and technology enthusiast at heart and by profession. Particularly interested in technology evangelism and enterprise software development and architecture. Experienced in Java Enterprise Applications and RIA technologies. President and Founder of a number of organizations namely The Silicon Valley Spring User Group, and The NorCal Java User Group. Abdel is a frequent speaker at a numner of developer conferences including JavaOne and many user groups and community events.

Comments on this page are now closed.


Grant Musick
07/19/2012 7:36am PDT

The speaker laid out the groundwork for something really interesting, but just ran out of time. If the presentation had had another 20-30 minutes, could have been really good.


For information on exhibition and sponsorship opportunities at the conference, contact Sharon Cordesse at (707) 827-7065 or

View a complete list of OSCON contacts