For MVC model classes, my setters look like this:
enum BoundProperty {FIELD_NAME, ...}
private Type fieldName;
public setFieldName(Type newValue) {
Type oldValue = fieldName;
fieldName = newValue;
firePropertyChange(BoundProperty.FIELD_NAME, oldValue, newValue);
}
Given the field, can this output be obtained from an auto-generated setter? If there is no way to get this result from the template?
The result should CamelCase for the field name to get the method name, so fieldName generates setFieldName () and Uppercase field name to create an enumeration of properties.
So fieldName generates FIELD_NAME(or FIELDNAMEwill work too).
source
share