Class CasedString.StringCase
java.lang.Object
org.apache.rat.utils.CasedString.StringCase
- Enclosing class:
CasedString
The definition of a String case.
- Since:
- 0.17
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CasedString.StringCaseThe camel case.static final CasedString.StringCaseThe dot case.static final CasedString.StringCaseThe Kebab case.static final CasedString.StringCaseThe pascal case.static final CasedString.StringCaseThe phrase case.static final CasedString.StringCaseThe slash case.static final CasedString.StringCaseThe Snake case. -
Constructor Summary
ConstructorsConstructorDescriptionStringCase(String name, char delimiter) Constructs a String case for the common cases where the delimiter is not preserved in the segments.StringCase(String name, Predicate<Character> splitter, boolean preserveSplit, Function<String[], String> joiner) Constructs a StringCaseStringCase(String name, Predicate<Character> splitter, boolean preserveSplit, Function<String[], String> joiner, UnaryOperator<String> postProcess) Constructs a StingCase. -
Method Summary
Modifier and TypeMethodDescriptionAssembles segments into a String.String[]getSegments(String string) Parses a String into segments.simpleJoiner(char delimiter) A simple joiner that assembles a String from a collection of segments.toString()
-
Field Details
-
CAMEL
The camel case. Example: "HelloWorld" -
PASCAL
The pascal case. Example: "helloWorld" -
SNAKE
The Snake case. Example: "hello_world" -
KEBAB
The Kebab case. Example: "hello-world" -
PHRASE
The phrase case. Example: "hello world" -
DOT
The dot case. Example: "hello.world" -
SLASH
The slash case. Example: "hello/world"
-
-
Constructor Details
-
StringCase
public StringCase(String name, Predicate<Character> splitter, boolean preserveSplit, Function<String[], String> joiner) Constructs a StringCase- Parameters:
name- the name of the case.splitter- the splitter to determine when to split a string.preserveSplit- the preserveSplit flag.joiner- the joiner to assemble the String from the segments.
-
StringCase
Constructs a String case for the common cases where the delimiter is not preserved in the segments.- Parameters:
name- the name of the case.delimiter- the delimiter between segments.
-
StringCase
public StringCase(String name, Predicate<Character> splitter, boolean preserveSplit, Function<String[], String> joiner, UnaryOperator<String> postProcess) Constructs a StingCase.- Parameters:
name- the name of the string case.splitter- the splitter to detect segments.preserveSplit- the flag to preserve the splitter character.joiner- the joiner to assemble a String from segments.postProcess- the post-process applied to the segments after the splitter has created them.
-
-
Method Details
-
simpleJoiner
A simple joiner that assembles a String from a collection of segments. Correctly handles the case where there are zero length segments.- Parameters:
delimiter- the delimiter to use between the segments.- Returns:
- the assembled string.
-
toString
-
assemble
-
getSegments
-