Adding JADE Methods to Classes or Primitive Types

Before you define a method, you must select the class or primitive type to which the method is to be added.

To add a method to a class or primitive type

  1. In the Class List of the Class Browser or the Primitive Types list of the Primitive Types Browser, click on the class for which the method is to be added.

  2. Select the New JADE Method command from the Methods menu.

    The JADE Method Definition dialog, shown in the following image, is then displayed.

  3. Check the Reimplement Superclass Method check box if you want to reimplement an existing method in a superclass. This check box is displayed only when you access the dialog from the Class Browser.

    You can reimplement a method only if it is not final in the superclass. For details, see "final Option" under "Controlling the Use of Elements in Other Schemas", in Chapter 1. A drop‑down list containing all superclass methods that are not final is then displayed. Initially, all possible superclass methods are displayed. As the methods are listed by schema and prefixed with the class name, it can make selection of a method difficult.

    The combo box displaying the list of superclass method names is a Style_DropDown (0) type so that you can enter text. The first entry of <enter method name filter> displayed in the combo box drop‑down list is a prompt. It is disabled and cannot be selected.

    When you enter text in the Name combo box, only those entries that have the entered text (which is case‑insensitive) somewhere in the entries in the drop‑down list are displayed. (Those that do not contain the specified text are hidden.) As a result, the more text you enter, the shorter the list of possible methods, as shown in the following image.

    Select the method in the parent class that you want to reimplement in the current class. A message box then advises you that you are about to reimplement a superclass method, and prompts you to click the Yes button if you want to continue. The parent class and the method that you selected for reimplementation are then displayed in the Name text box.

  4. Specify the name of your new method in the Name text box if you do not want to reimplement an existing method in the parent class. (For details about reimplementing a method, see step 10, later in this process.)

    From version 2020.0.01 and higher, you can paste text into the Name text box so that the paste action displays the initial name in the text box as the name of the new method. The paste action strips all but the first identifier (alpha, numeric, and underscore characters) and inserts that text into the Name text box. For example, pasting get_Customer_Details(formatType : Integer): String; in the text box results in the following displayed as the method name.

    get_Customer_Details
  5. Check the Updating check box if the method can modify properties in the object to which it is sent.

    If you do not specify that the method is updating, the method does not modify the receiver object (that is, the object that is executing the method). Any instructions that attempt to update properties of the receiver or any calls to updating methods in the receiver are marked as errors at compile time.

  6. Check the Abstract check box if the selected class is abstract and the method is to be implemented in all concrete subclasses. An abstract method defines a signature with which all subclass implementations must comply.

  7. Check the Protected check box if you want the protected method option added to the signature of your method so that it can be referenced only by methods in the same class or its subclasses or in the same primitive type. (Protected methods are displayed in the browser Methods List with a padlock symbol to the left of the method name.)

    By default, your methods are not protected; that is, they are displayed in the Methods List of the Class Browser or Primitive Types Browser with the public access icon to the left.

  8. Check the Subschema Hidden check box if you want to specify that the method is available only in the local schema; that is, it is not available for use in any subschemas. For details, see "subschemaHidden Option" under "Controlling the Use of Elements in Other Schemas", in Chapter 1.

  9. Check the Type Method check box if you want the typeMethod method option added to the signature of your method so that the method is a type method.

    Type methods provide a way of calling a method declared on a type (class, primitive, or interface) without having to have an instance of the type. For more details, see "Type Methods", under "JADE Language Notation" in Chapter 1 of the JADE Developer’s Reference.

  10. If you are defining a method for a subclass of the JadeWebService class or one of its subclasses, uncheck the Web Services check box if you do not want the method defined as a Web services method. This check box is enabled only when a Web services class is selected in the Class List and it is selected by default. When this check box is checked, the Web Services Options command in the Methods menu is enabled.

    For details about Web services methods, see "Creating Web Service Methods", in Chapter 11 of the JADE Developer's Reference.

  11. In the Final Settings group box, select one of the following option buttons for the appropriate final setting, if required.

    • Final, if you want to specify that the method cannot be reimplemented in a subclass. The final method option makes methods available to other schemas but prevents those schemas from modifying, reimplementing, or circumventing the defined method behavior. For details, see "final Option" under "Controlling the Use of Elements in Other Schemas", in Chapter 1.

    • Subschema Final, if you want to specify that the method can be extended or reimplemented in its local schema but not in a subschema. The subschemaFinal method option makes methods available to other schemas but prevents those schemas from modifying, reimplementing, or circumventing the defined method behavior. For details and an example, see "subschemaFinal Option" under "Controlling the Use of Elements in Other Schemas", in Chapter 1.

    • Subschema Copy Final (displayed only when you access the dialog from the Class Browser), if you want to specify that the method cannot be reimplemented in a subschema copy class. For details and an example, see "subschemaCopyFinal Option" under "Controlling the Use of Elements in Other Schemas", in Chapter 1.

  12. In the Execution Location group box, select the Server or Client option button if you want the serverExecution or clientExecution method option added to the signature of your method so that the method and all methods subsequently called by this method are executed on the server node or client node, respectively. By default, no execution option is added to the method signature and the node in which the method executes is determined by the location of the calling method. For more details, see "Method Options", in Chapter 1 of the JADE Developer’s Reference.

  13. Click the Enter Text button if you want to specify or maintain descriptive text for the JADE method as part of the definition or maintenance of the method. For details, see "Specifying Text for a Schema Element", in Chapter 3.

    You can also specify descriptive text for the JADE method at any time, by selecting the Text command from the Methods menu. For details, see "Using the Free-Standing Editor Window to Define Text", in Chapter 3.

  14. Click the OK button or the Next button.

    If the schema is versioned and a method with the specified name added in one schema context (for example, the current version) exists in the other context (for example, the latest version), a message box advises you that the method exists in the other context and that the methods in both contexts will be linked. If linking, you have the option of copying the existing source from the corresponding method in the other context or of starting with an empty method template.

    Click the:

    • Cancel button, to abort creation of the method in the context to which you added it.

    • Yes button, to create the method, copying the method source from the other context.

    • No button, to create the method without copying the existing method source from the other context.

A method template is then displayed in the editor pane of the Class or Primitive Types Browser.

If a method template has been defined for all new methods in your JADE development database or for your own JADE methods, the defined method template is displayed in the editor pane. For details, see "Maintaining Text Templates", in Chapter 2.

Modify the template by adding JADE code to perform the required operations, and then compile it. (For more details, see "Compiling Methods", later in this section, and "Method Options", in Chapter 1 of the JADE Developer’s Reference.)

If you are unsure of the syntax of a JADE instruction, specify the instruction in the appropriate place in your method and then press Ctrl+S. The syntax for that instruction is then displayed in the method, to enable you to specify the appropriate values. For example, if you specify foreach; and then press Ctrl+S, the following is displayed:

foreach identifier in (collection | expression to expression
    [step expression]) [reversed] [where expression] do
    [ : label]
    optionalStatementList;
endforeach [label];

Alternatively, to obtain online help for a JADE-supplied class, method, property, primitive type, instruction, or method option on which the caret is positioned in the editor pane, press F1. The online help topic for that element is then displayed. (See also "Using Bubble Help in the Editor Pane", later in this section and "Displaying Bubble Help in Browser Lists" under "Using the Class, Primitive Types, or Interface Browser", in Chapter 3.)

For details about creating a mapping method for a property selected in the Properties List of a hierarchy browser, see "Adding a Method Mapping for a Property", later in this chapter.

To define a JADE event method

  1. In the Properties list of the Class Browser window, click on the form or control for which the event method is to be defined. A list of valid events for the selected control is then displayed.

  2. Click on the required event in the Event list.

A template for that method is then displayed in the editor pane of the Class Browser.

The following image shows an example of an event method.

Modify the template by adding JADE code to perform the required operations, and then compile it. (For more details, see "Compiling Methods", later in this subsection and to "JADE Language Reference", in Chapter 1 of the JADE Developer’s Reference.)

Event methods are valid only for forms or controls. For controls, the concatenation of the property name and method name cannot exceed 100 characters. When this maximum length is exceeded, the event method is not displayed and a warning is displayed on the status line.

If a method template has been defined for all new methods in your JADE development database or for your own JADE methods, the defined method template is displayed in the editor pane. For details, see "Maintaining Text Templates", in Chapter 2.