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

add ClassInfo.enumConstants() #253

Closed
Ladicek opened this issue Sep 5, 2022 · 0 comments · Fixed by #259
Closed

add ClassInfo.enumConstants() #253

Ladicek opened this issue Sep 5, 2022 · 0 comments · Fixed by #259
Assignees
Milestone

Comments

@Ladicek
Copy link
Collaborator

Ladicek commented Sep 5, 2022

Currently, it is a bit inconvenient to obtain the list of enum constants, one basically has to resort to code like this:

List<FieldInfo> enumConstants = enumClass.unsortedFields()
        .stream()
        .filter(FieldInfo::isEnumConstant)
        .collect(Collectors.toList());

Also one has to remember to use unsortedFields(), because fields() return fields in lexicographical order, which is useless when one needs to figure out the ordinal of each enum constant.

We should add an enumConstants() method that would basically do the same thing as above (except a bit more efficiently).

This can be done in a micro release.

@Ladicek Ladicek self-assigned this Sep 12, 2022
@Ladicek Ladicek added this to the 3.0.1 milestone Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant