如何自动生成getter和setter在Android的工作室 [英] How to automatically generate getters and setters in Android Studio
问题描述
我工作的一个Android应用程序,并创造了大量的变量模型。因为我打算添加getter和setter方法为所有这些。
I am working on a Android application and created a model with a large number of variables. Since I am planning to add getters and setters for all of them.
有没有在Android的Studio中自动生成的getter和setter在一个给定类的快捷方式?
Is there a shortcut in Android Studio for automatically generating the getters and setters in a given class?
推荐答案
使用<大骨节病>替代骨节病> + <大骨节病>插入骨节病>在编辑器中,你可以很容易地生成getter和setter方法的任何字段你的类。
Using Alt+ Insert in the editor, you may easily generate getter and setter methods for any fields of your class.
,然后使用Shift或控制按钮,选择你需要添加getter和setter变量
and then using shift or control button, select all the variables you need to add getters and setters
这篇关于如何自动生成getter和setter在Android的工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!