Recently I wrote someCodeTo record some encoding rules for your use.
- Each property must have a corresponding method for obtaining and setting properties, that is, each property must provide the corresponding getter and setter methods (simple method: select all variables-> right-click source-> Generate getters and setters-> select all --> OK ).
- If a property is of the boolean type, the method for obtaining and setting the property is different. For example, a property of the boolean type is named, you must provide the corresponding methods for obtaining attributes, ISA () and Seta ().
- All attributes are preferably private variables, that is, the attribute of each class should be set to private, and the values and operations of attributes should be carried out through corresponding methods.
- It is best to set all methods to a common method, that is, all methods must be set to public, so that the external world can invoke the methods in the class.
PS: If the attribute name is XXX and it is not a Boolean variable, the values and settings of the corresponding attribute are getx ×× () and setx ×× (), the first letter in the method name should be capitalized. If the attribute name is isxx and it is a Boolean variable, the corresponding method is isxx (), and the value assignment method is setxx (), in this case, the method name and attribute name of the value method are the same, and the first letter of the Method Name of the value assignment method is capitalized.