Option |
Description |
Default |
Source folder |
Enter a source folder for the new class. Either
type a valid source folder path or click Browse to select
a source folder via a dialog. |
The source folder of the element that was
selected when the wizard was started. |
Package |
Enter a package to contain the new class. You
can select either this option or the Enclosing Type option, below. Either type a valid
package name or click Browse to select a package via a
dialog. |
The package of the element that was selected
when the wizard was started. |
Enclosing type |
Select this option to choose a type in which to
enclose the new class. You can select either this option or the Package option, above.
Either type a valid name in the field or click Browse to select a type via a dialog. |
The type or the primary type of the compilation
unit that was selected when the wizard was started or <blank> |
Class name |
Type a name for the new enumeration class. |
<blank> |
Modifiers |
Select one or more access modifiers for the new class.
- Either public, default, private, or protected (private and protected are
only available if you specify an enclosing type)
|
public |
Class comment |
Enter the description of the class |
<blank> |
Generate default comment |
Determines whether a default comment will be generated. The
default comment is of the form:
Type Safe Enumeration: {class name} elements: {element list} |
<true> |
Enumeration elements should be ordered and comparable |
Determines whether the enumeration class will implement the
Comparable interface |
<true> |
Enumeration elements should be serializable |
Determines whether the enumeration class will implement the
Serializable interface |
<false> |
Generate sequencing methods |
Determines whether the enumeration class will implement
first(), last(), predecessor() and successor() methods |
<false> |
Generate enumeration element name lookup
support |
Determines whether enumeration elements
can be looked up by name |
<false> |
So if you needed an "color" enumeration with elements red, yellow, blue, and
green you would create a typesafe enumeration class Color and use it like the following
Note that since red, yellow, blue, green are represented by distinct instances of the
class Color they can only be assigned to variables declared as type Color. That's why
they're called typesafe.