-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
wontfixThis will not be worked onThis will not be worked on
Description
In Naming.java, all variants of a provided String are calculated during construction of the object.
PowerSystemUtils/src/main/java/edu/ie3/util/naming/Naming.java
Lines 33 to 50 in c752e38
| 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.
Metadata
Metadata
Assignees
Labels
wontfixThis will not be worked onThis will not be worked on