Show TOC

Creating an Enumeration TypeLocate this document in the navigation structure

Context

An enumeration type allows you to define an abstract type that holds a list of values of the same primitive Java type that are logically related in a given context.

Example

You can create an enumeration type called Days of the Week and enter corresponding values for it such as:

  • Mon

  • Tue

  • Wed

  • Thur

  • Fri

  • Sat

  • Sun

Procedure

  1. Locate the Project Resources node and double-click the node.

    For more information, see Locating the Project Resources Node

  2. In the Project Resources editor, choose the Enumeration Types tab.
  3. In the enumeration type editor that appears, choose the Add button.
  4. In the dialog box that appears, enter a valid name for the enumeration type in the relevant field.
  5. In the drop down menu, choose a Java type.
  6. In the space provided, enter the corresponding values for the enumeration type.
    Note
    • You can enter values one after the other

    • You can enter values in the form : Value = Alias Name

      Example
      • 12 = 12 PM

      • 1 = 1 Day

    • If the imported Java classes have pre defined constants, you can reuse them as values for an enumeration type.

      • In the Enumeration Types editor select the enumeration type name and choose the Add Java Constants button.

      • In the dialog box that appears, press Ctrl and select the constants and choose OK .

  7. Choose OK .