The getter () and setter () methods are generated to remove the variable prefix and gettersetter
When the defined variable name has a prefix but does not want to display it in the getter () and setter methods, for example, part of the code of today's project:
1 public class Crime {2 private UUID mId; // ID is the unique element of the Crime identification 3 private String mTitle; // the title is a descriptive name 4 5 public Crime () {6 mId = UUID. randomUUID (); // generate a unique identifier 7} 8 9 public UUID getId () {10 return mId; 11} 12 13 public String getTitle () {14 return mTitle; 15} 16 17 public void setTitle (String mTitle) {18 this. mTitle = mTitle; 19} 20}
In this case, we can File --> Settings --> Code Style --> Java, click Code Generation on the right, and add the prefix (m) to the NamePrefix in the Naming section, as shown in
Copyright statement: Original Author. for reprinting, please indicate the source.