protected Options()

in src/main/java/org/apache/sling/pipes/internal/CommandExecutorImpl.java [368:406]


        protected Options(List<String> options){
            Map<String, Object> optionMap = new HashMap<>();
            for (String optionToken : options) {
                String currentKey = null;
                List<String> currentList = new ArrayList<>();
                for (String subToken : getSpaceSeparatedTokens(optionToken)) {
                    if (currentKey == null) {
                        currentKey = subToken;
                    } else {
                        currentList.add(subToken);
                    }
                }
                finishOption(currentKey, currentList, optionMap);
            }
            for (Map.Entry<String, Object> entry : optionMap.entrySet()){
                switch (entry.getKey()) {
                    case Pipe.PN_NAME :
                        this.name = (String)entry.getValue();
                        break;
                    case Pipe.PN_PATH :
                        this.path = (String)entry.getValue();
                        break;
                    case Pipe.PN_EXPR :
                        this.expr = (String)entry.getValue();
                        break;
                    case "with" :
                        this.with = keyValuesToArray((List<String>)entry.getValue());
                        break;
                    case "bindings" :
                        this.bindings = keyValuesToArray((List<String>) entry.getValue());
                        break;
                    case "outputs" :
                        setOutputs((List<String>)entry.getValue());
                        break;
                    default:
                        throw new IllegalArgumentException(String.format("%s is an unknown option", entry.getKey()));
                }
            }
        }