When editing a JADE method, you can generate a method stub (whose logic must be filled in later) from a call statement.
To generate a method stub from the editor pane
Specify a method call with all of the required parameters.
Position the cursor over the new method name and then select the Generate Method Stub command from the Refactor submenu of the Edit menu.
A new method stub is then defined on the receiver of the method call. The types of the parameters are determined from the call statement. If the method call is assigned, the method return type is the type of the assignment variable.
If the receiver of the method is not in the current schema, a dialog is displayed, asking you to select the schema in which to add the method. For a class, the schema of the root of the class is selected by default. For a primitive method, the current browser schema is selected by default.
An example of an undefined method call is:
bool := cust.anewMethod(custName, bank.id, descStr);
This method call results in the creation of the anewMethod method stub on the Customer class, as follows.
anewMethod(custName: String; integer1: Integer; descStr: String): Boolean; vars begin return null; end;
When generating a method stub from the editor pane, note that:
The AutoComplete feature must be turned on.
The parameter can be an identifier or dot (.) expression only.
The Unable to determine the required method signature for <method name>. The type of a parameter cannot be determined. message is displayed if the expression is invalid or an identifier is unknown.
The method name must begin with a lowercase character.
If successful, a message box displays the schema, class, and name of the method that was created. If rejected, a message box displays the reason why the method stub generation was not performed.
All of the elements in the call statement, apart from the method name, must be known elements.
Any template defined for methods in your user preferences is invoked.
The JADE development security library is called, to ensure that you have access to the schema in which the method will be defined when it is not the currently selected schema.
The generated method compilation could fail, and a warning message be displayed; for example, if the parameter types are not visible in a superschema.
If the method is defined on a superclass or subclass, the generation will be rejected if the signature of the method does not match. A warning will also be displayed, advising you that the new method will be a re-implementation or superclass instance.
If the method is defined on a superclass or subclass, the parameter names and return type is taken from the existing method.
If the parameter of the method call is a local variable, parameter, or local constant, the name will be used as the parameter name in the method (with a numeric postscript, if the same variable is used more than once).
Other types of parameters will use the type name of the parameter with a numeric postscript; for example, integer1.
If the current unary expression selected in the editor pane is preceded by the
write accountToReportOn.toString();
The current unary expression preceded by unary-expression := also handles the type of the expression.