We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enums are usually used to provide values to input elements that are then submitted to the backend. For example:
public enum Car { Volvo, Saab, Fiat, Audi, }
<select id="cars" name="cars"> @for(Car car : Car.values()) <option value="${car}">${localize(car)}</option> @endfor </select>
This will break unexpectedly, as soon as someone overrides the toString() method:
toString()
public enum Car { Volvo, Saab, Fiat, Audi, ; @Override public String toString() { return name() + " is a fine car!"; } }
To prevent this from happening, rendering Enums should call name(), instead of toString().
The text was updated successfully, but these errors were encountered:
#185 Rendering Enums calls name(), instead of toString()
3c4cfc5
casid
No branches or pull requests
Enums are usually used to provide values to input elements that are then submitted to the backend. For example:
This will break unexpectedly, as soon as someone overrides the
toString()
method:To prevent this from happening, rendering Enums should call name(), instead of toString().
The text was updated successfully, but these errors were encountered: