This is about replacing field access with a getter

By default, there’s a visible refactoring option for this through alt+insert - getter.

enq1

The problem is that if a field is already used in many places, just creating a getter is not enough. You also need to replace direct access with this getter everywhere.

enq2

Fortunately, JetBrains has thought of this! Press ctrl+shift+A, enter and open the refactor this action.

enq3

In the menu, there are many different refactorings. We select encapsulate.

enq4

A dialog will open where you select the needed fields, tick the getters/setters, and click refactor.

enq5

Done!

enq6

As we can see, direct access has been replaced with the getter throughout the code.

enq7