Java Reference
In-Depth Information
Figure 9.20 Finally, a tool that can help developers enforce proper
encapsulation! The Encapsulate Fields refactoring protects all field variables
behind an accessor/mutator layer.
Encapsulate —Select the type of encapsulation you want to perform. You
can encapsulate get requests and/or set requests. You must select at least
one of these two options.
Options —There is only one option, to use the accessors even when the
field is available. If this is deselected, existing direct references that are still
legal after any change in visibility to the field are left as direct references,
not going through the accessor methods. Otherwise, all references go
through the new accessors.
Encapsulated Fields' Visibility —This option allows changing the field's
visibility as part of the refactoring. For example, you can take a public
field, encapsulate it behind public accessor methods, and change its visibil-
ity to private.
Accessors' Visibility —This option sets the visibility of the accessor meth-
ods created as a result of the refactoring.
9.4.5
Refactoring method calls to improve usability
In addition to the already covered ability to rename methods, IDEA provides a
number of refactoring operations for creating, modifying, and restructuring
Java methods.
 
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search