如何自动生成getter和setter在Android的工作室 [英] How to automatically generate getters and setters in Android Studio

查看:172
本文介绍了如何自动生成getter和setter在Android的工作室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆