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
`static Pattern` `CONFIGURATION_PATTERN`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `checkArguments​(Object... params)` Checks arguments and throws exception if there is an issue
`static String[]` `keyValuesToArray​(List<String> o)`
`static Map<String,​Object>` `stringToMap​(@NotNull String input, UnaryOperator<String> valueTransformer)`
`static String` `trimQuotes​(@NotNull String quotedString)`
`static void` `writeToMap​(Map<String,​Object> map, boolean embed, Object... params)` write key/value pairs into a map

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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 map
  `embed` - 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 pairs
  `valueTransformer` - 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

#### keyValuesToArray

    public static String[] keyValuesToArray​(List<String> o)

Parameters:
  `o` - list of key value strings key1=value1,key2=value2,...
Returns:
  String [] key1,value1,key2,value2,... corresponding to the pipe builder API