Java : Runtime annotations

This page last changed on Aug 21, 2006 by Kees de Kooter

Intro

The task is to create annotations that can be used to annotate classes that need to be marshalled to XML. These annotations are going to be processed at runtime.

My first annotation

We add the retention annotation so the compiler keeps it available at runtime

@Retention(RetentionPolicy.RUNTIME)
public @interface XmlElement {
    String namespace() default "duh";
}