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

Create Naming-variations on-the-fly #225

Open
sebastian-peter opened this issue Feb 9, 2022 · 0 comments
Open

Create Naming-variations on-the-fly #225

sebastian-peter opened this issue Feb 9, 2022 · 0 comments
Labels
wontfix This will not be worked on

Comments

@sebastian-peter
Copy link
Member

sebastian-peter commented Feb 9, 2022

In Naming.java, all variants of a provided String are calculated during construction of the object.

String flatCase = String.join("", components);
String upperFlatCase =
components.stream().map(String::toUpperCase).collect(Collectors.joining(""));
String camelCase = String.join("", camelCasing(components));
String pascalCase =
components.stream().map(StringUtils::capitalize).collect(Collectors.joining(""));
String snakeCase = String.join("_", components);
String screamingSnakeCase =
components.stream().map(String::toUpperCase).collect(Collectors.joining("_"));
String camelSnakeCase = String.join("_", camelCasing(components));
String pascalSnakeCase =
components.stream().map(StringUtils::capitalize).collect(Collectors.joining("_"));
String kebabCase = String.join("-", components);
String donerCase = String.join("|", components);
String screamingKebabCase =
components.stream().map(String::toUpperCase).collect(Collectors.joining("-"));
String trainCase =
components.stream().map(StringUtils::capitalize).collect(Collectors.joining("-"));

This is rather time and space consuming, as in most cases, only a small number is actually required. The code could be adapted to construct the desired variant on-the-fly when any method such as flatCase() is called. One could even implement some sort of caching here, where the variants are only lazily built once they're requested.

@sebastian-peter sebastian-peter added the wontfix This will not be worked on label Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant