Self encapsulating a field
To self-encapsulate a field:
-
Select the field in one of the Java views (e.g. Outline, Package Explorer
or Members view)
-
Do one of the following
-
From the menu bar, select Refactor > Self Encapsulate or
-
From the field's pop-up menu, select Refactor > Self Encapsulate
You can also invoke this refactoring from the Java editor:
-
In the Java editor, select the field (or a reference to it)
-
Do one of the following
-
From the menu bar, select Refactor > Self Encapsulate or
-
From the editor's pop-up menu, select Refactor > Self Encapsulate
Refactoring actions
Refactoring wizard
Refactoring preferences