重构是通过改变现有程序结构而不改变其功能和用途来提高代码的可重用性和可维护性。
codearts支持重构操作,提供了多种重要的重构类型,如下:
codearts支持的重构操作
| 重构类型 | 支持操作 | 快捷键 |
| 重命名 | rename symbol | shift f6 |
| 提取重构 | extract superclass | |
| extract method object | ||
| extract method | ctrl alt shift m |
|
| extract interface | ||
| extract delegate... | ||
| encapsulate fields | ||
| 引入重构 | introduce variable | ctrl alt v |
| introduce parameter | ctrl alt shift p |
|
| introduce parameter object | ||
| introduce functional variable | ||
| introduce functional parameter | ||
| introduce field | ctrl alt shift f |
|
| introduce constant | ctrl alt c
|
|
| 复制重构 | copy class | shift f5
|
| 移动和更改重构 | push members down | |
| pull members up | ||
| move inner class to upper level | ||
| make static | ||
| change method signature | ctrl f6 |
|
| change class signature | ctrl f6 |
|
| type migration | ||
| 查找和替换重构 | replace inheritance with delegation | |
| replace constructor with factory method | ||
| replace constructor with builder | ||
| 内联重构 | inline variable | |
| inline to anonymous class | ||
| inline super class | ||
| inline parameter | ctrl alt shift p
|
|
| inline method | ctrl alt shift l |
|
| inline field | ||
| 其它重构 | invert boolean | |
| use interface where possible |
快捷键很实用,跟 intellij 一致
实用
很不错
感谢分享
感谢分享
感谢分享