我在一个对象中有以下变量:
private String mName;
private String mArtist;
private String mWhosampledPage;
private String mImage;
private List<Pair<String, String>> mSamples;
private List<Pair<String, String>> mSampledIn;
private List<Pair<String, String>> mCovers;
private List<Pair<String, String>> mRemixes;
我想在IntelliJ中使用Alt+Insert来自动生成一个构造函数,当我这样做时,这就是生成的内容:
public Song(String mName, String mArtist, String mWhosampledPage, String mImage, List<Pair<String, String>> mSamples, List<Pair<String, String>> mSampledIn, List<Pair<String, String>> mCovers, List<Pair<String, String>> mRemixes) {
this.mName = mName;
this.mArtist = mArtist;
this.mWhosampledPage = mWhosampledPage;
this.mImage = mImage;
this.mSamples = mSamples;
this.mSampledIn = mSampledIn;
this.mCovers = mCovers;
this.mRemixes = mRemixes;
}
如何更改生成设置,使创建的构造函数更像这样:
public Song(String name, String artist, String whosampledPage, String image, List<Pair<String, String>> samples, List<Pair<String, String>> sampledIn, List<Pair<String, String>> covers, List<Pair<String, String>> remixes) {
mName = name;
mArtist = artist;
mWhosampledPage = whosampledPage;
mImage = image;
mSamples = samples;
mSampledIn = sampledIn;
mCovers = covers;
mRemixes = remixes;
}
我知道这是可能的,因为我已经在其他IntelliJ配置(不同的设备)中使用了它,但我不确定如何进行切换。
谢谢你
1条答案
按热度按时间lf3rwulv1#
转到设置
Preferences | Editor | Code Style | Java
,并在选项卡Code Generation
下将字段名称前缀设置为m
。