Package org.apache.sling.pipes
Class CommandUtil
- java.lang.Object
-
- org.apache.sling.pipes.CommandUtil
-
public class CommandUtil extends Object
utilities for user input
-
-
Field Summary
Fields Modifier and Type Field Description static PatternCONFIGURATION_PATTERN
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckArguments(Object... params)Checks arguments and throws exception if there is an issuestatic String[]keyValuesToArray(List<String> o)static Map<String,Object>stringToMap(@NotNull String input, UnaryOperator<String> valueTransformer)static StringtrimQuotes(@NotNull String quotedString)static voidwriteToMap(Map<String,Object> map, boolean embed, Object... params)write key/value pairs into a map
-
-
-
Field Detail
-
CONFIGURATION_PATTERN
public static final Pattern CONFIGURATION_PATTERN
-
-
Method Detail
-
checkArguments
public static void checkArguments(Object... params)
Checks arguments and throws exception if there is an issue- Parameters:
params- arguments to check- Throws:
IllegalArgumentException- exception thrown in case arguments are wrong
-
writeToMap
public static void writeToMap(Map<String,Object> map, boolean embed, Object... params)
write key/value pairs into a map- Parameters:
map- target mapembed- flag indicating wether or not we should try to embed values in script tags,params- key/value pairs to write into the map
-
stringToMap
public static Map<String,Object> stringToMap(@NotNull @NotNull String input, UnaryOperator<String> valueTransformer)
- Parameters:
input- comma separated key=value pairsvalueTransformer- before adding it to the map, that function will be applied to found value- Returns:
- map of key and (transformed) value
-
trimQuotes
public static String trimQuotes(@NotNull @NotNull String quotedString)
- Parameters:
quotedString- non null string with or without quotes- Returns:
- if the string is wrapped with
", strip them away, otherwise return same string
-
-