
The Typesafe Enum Generator Plug-in is a wizard for generating Java source
code for the Typesafe Enumeration design pattern. The generated source
code is based on a JET template file included in the Plug-in and can be
customized by editing the template. JET (Java Emitter Templates) is a
generic template engine that uses a JSP-like syntax (actually a subset
of the JSP syntax) to generate any type of text and is part of the Eclipse
Modeling Framework (
EMF) project.
This plugin is written to demonstrate the capabilities of JET. To find out more about Java Emitter Templates, the JET syntax, and how to use JET in your own applications, please refer to the JET tutorial articles on the Eclipse web site:
The Typesafe Enum Generator Plug-in is release under the
Common
Public License. The Plug-in is free of charge and the source code
is included in the distribution archive file.
The Typesafe Enum Generation wizard has three pages. The first page, shown below, looks like a simplified version of the New Class wizard. In this page, enter the package name and the class name of the typesafe enum, and the location where the result should be saved.

The second page collects information on the attributes of the typesafe enum class to generate. Every attribute has a name and a type, and may be one of the key attributes. Key attributes are the attributes used in the lookup method of the typesafe enumeration to find an instance for one ore more attribute values. The second wizard page is shown below:

The third and last wizard page, shown below, collects information on the instances of the typesafe enum. Enter the instance name, and for each instance provide values for all attributes. One of the instances may be the "default" instance, which is the instance returned by the lookup method if no instance was found for the specified key attribute values.

You need to install
EMF
before installing the Typesafe Enum Generator Plug-in. The Plug-in
has been tested with EMF release version 1.1.0 build 20030620_1105VL,
but later versions (eg. stable build version 1.1.1 build 20030819_0612SL)
should also work.
After installing EMF, unzip the distribution archive into the plugins directory in your installation and restart Eclipse.
The Typesafe Enum Generator wizard is activated by selecting File > New > Other > Java > Typesafe Enum from the workbench, as shown in the image below.

The wizard will also show up as an action on the toolbar in the Java Perspective, as shown in the image below.
