Package andesite.util.metadata
Interface NamePartJoiner
public interface NamePartJoiner
Joins a list of strings into a string, possibly transforming
them or adding separators.
-
Field Summary
Fields Modifier and Type Field Description static NamePartJoinerDASHEDJoins the strings with a dash (-) character.static NamePartJoinerHTTP_HEADERJoins the strings with a dash (-) character, after converting them to Title Case.static NamePartJoinerLOWER_CAMEL_CASEJoins the strings after converting all but the first into Title Case. -
Method Summary
Modifier and Type Method Description default NamePartJoinerafterMapping(java.util.function.Function<java.lang.String,java.lang.String> mapper)Returns a new joiner that will join the strings resulting from applying the provided function to each part.java.lang.Stringjoin(java.util.List<java.lang.String> parts)Joins the provided parts into a string.static NamePartJoinerjoinWith(java.lang.String separator)Joins the parts with the provided separator.
-
Field Details
-
DASHED
Joins the strings with a dash (-) character.[some, strings, go, here]would becomesome-strings-go-here. -
HTTP_HEADER
Joins the strings with a dash (-) character, after converting them to Title Case.[some, strings, go, here]would becomeSome-Strings-Go-Here. -
LOWER_CAMEL_CASE
Joins the strings after converting all but the first into Title Case.[some, strings, go, here]would becomesomeStringsGoHere.
-
-
Method Details
-
join
Joins the provided parts into a string. The joiner is free to apply any transformation it wants to the strings, and join them however it wants.- Parameters:
parts- Parts to join. All strings in this list should be in lower case.- Returns:
- The resulting string.
-
afterMapping
@Nonnull @CheckReturnValue default NamePartJoiner afterMapping(@Nonnull java.util.function.Function<java.lang.String,java.lang.String> mapper)Returns a new joiner that will join the strings resulting from applying the provided function to each part.- Parameters:
mapper- Maps the parts before joining.- Returns:
- A joiner that maps the parts before calling the join method.
-
joinWith
Joins the parts with the provided separator.- Parameters:
separator- Separator for the parts.- Returns:
- Joiner that separates the parts with the given separator.
-