Rename Refactor

The rename refactor method allows you to rename a package, class, method, field, variable, and property in your project. The rename refactor method is a sophisticated search and replace mechanism. The renaming has to be done based on what is being renamed, its scope, and its visibility.

For example, suppose that you are reviewing the code in Listing 7.1 and notice that the variable to represent an employee’s age is called X. X does not clearly represent its purpose or follow the coding standards. You intend to change the variable from X to nAgeOfEmployee. Because X is used many times throughout this method, your first inclination is to do a search for X and replace it with nAgeOfEmployee.

Listing 7.1. Refactoring a Variable—Concept ...

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.