Show TOC

Procedure documentationCreating an Enumeration Type Locate this document in the navigation structure

 

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 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

End of the example.

Procedure

  1. Locate the Project Resources node ( Where is the Project Resources node?) and double-click the 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 Note

    • You can enter values one after the other

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

      Example Example

      • 12 = 12 PM

      • 1 = 1 Day

      End of the example.
    • 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.

    End of the note.
  7. Choose OK.