Get the scoop on typesafe enums and learn how to use them properly in switch statements, then get started with Java annotations and meta-annotations types like Target, which you can use to clarify the purpose and function of annotations in your Java code.
The first
article in my Java language evolution tour introduced assertions and
generics, concluding with a discussion about why the generics suite was a
particularly controversial addition to Java 5. Here I introduce typesafe enums and annotations, two more Java 5 language features designed to enhance the safety and productivity of Java programs.
An enumerated type specifies a set of related constants as its values.
Examples include a week of days, the standard north/south/east/west compass directions,
and a currency's coin denominations.