0

I have the following variables in an object:

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;

I want to use Alt+Insert in IntelliJ to auto generate a constructor and when I do that, this is what gets generated:

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;
}

How can I change the generate settings such that the constructor created looks more like this:

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;
}

I know this is possible as I have made use of it in other IntelliJ configurations (different devices) but I am not sure how to make the switch.

Thank you

1 Answer 1

1

Go to the settings Preferences | Editor | Code Style | Java and under the tab Code Generation set the Field Name prefix to m.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.