Skip to content
New issue

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

String based context params having fixed set of allowed values should be represented by enums #1831

Open
BalusC opened this issue Jul 23, 2023 · 1 comment
Labels
mojarra-implemented API issue implemented by Mojarra
Milestone

Comments

@BalusC
Copy link
Member

BalusC commented Jul 23, 2023

While working on PoC for @FacesConfig annotation having all context params as attributes/constants, https://github.com/eclipse-ee4j/mojarra/blob/4e486bfabe8b08e5b4588ab8e9198e0bd4c30503/impl/src/main/java/jakarta/faces/annotation/FacesConfig.java I noticed the following String based context param values having a fixed set of allowed values such as "auto", "none", etc but these values are in turn not represented by enums such as ProjectStage. We should introduce enums on them in order to have type safety.

  • jakarta.faces.CLIENT_WINDOW_MODE --> none and url.
  • jakarta.faces.STATE_SAVING_METHOD --> client and server.
  • jakarta.faces.VALIDATE_EMPTY_FIELDS --> auto, true and false.

There's only a slight difficulty with client window mode; the javadoc of ClientWindow.CLIENT_WINDOW_MODE_PARAM_NAME literally says "but other values are possible", we should probably remove this phrase. Update: it's definitely freeform. Moreover, MyFaces has its own additional variants already (url-redirect, client).

@BalusC
Copy link
Member Author

BalusC commented Oct 14, 2023

Proposal:

For jakarta.faces.STATE_SAVING_METHOD add new enum StateSavingMethod to StateManager.
For jakarta.faces.VALIDATE_EMPTY_FIELDS add new enum ValidateEmptyFields to UIInput.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mojarra-implemented API issue implemented by Mojarra
Projects
None yet
Development

No branches or pull requests

1 participant