Extract Method

When reviewing code, you may encounter a situation where a defined method is extremely long and performing many actions. JBuilder lets you select portions of the code and extract them into a separate method. JBuilder determines parameters, local variables, and the return type.

JBuilder also determines whether the selected lines of code can be refactored. For example, if more than one variable is written to or read after the selected code, the method cannot be refactored automatically.

Figure 7.15 selected some code for the extract method. Notice how the selected code fills in the Statements field in the Extract Method dialog box.

Figure 7.15. The Extract method.

Figure 7.15 resulted in a new method being added to the code ...

Get Borland® JBuilder™ Developer’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.