Package org.eclipse.jetty.toolchain.test
Class StringMangler
java.lang.Object
org.eclipse.jetty.toolchain.test.StringMangler
Collection of utility methods for manipulating Strings for zen purposes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
condensePackageString
(String classname) Condenses a classname by stripping down the package name to just the first character of each package name segment.static String
maxStringLength
(int max, String raw) Smash a long string to fit within the max string length, by taking the middle section of the string and replacing them with an ellipsis "..."
-
Constructor Details
-
StringMangler
public StringMangler()
-
-
Method Details
-
condensePackageString
Condenses a classname by stripping down the package name to just the first character of each package name segment.Examples: "org.eclipse.jetty.test.FooTest" = "oejt.FooTest" "org.eclipse.jetty.server.logging.LogTest" = "oejsl.LogTest"
- Parameters:
classname
- the fully qualified class name- Returns:
- the condensed name
-
maxStringLength
Smash a long string to fit within the max string length, by taking the middle section of the string and replacing them with an ellipsis "..."Examples: .maxStringLength( 9, "Eatagramovabits") == "Eat...its" .maxStringLength(10, "Eatagramovabits") == "Eat...bits" .maxStringLength(11, "Eatagramovabits") == "Eata...bits"
- Parameters:
max
- the maximum size of the string (minimum size supported is 9)raw
- the raw string to smash- Returns:
- the ellipsis'd version of the string.
-