All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uk.co.automatictester.wiremock.maven.plugin.util.ParameterUtil Maven / Gradle / Ivy

There is a newer version: 7.3.0
Show newest version
package uk.co.automatictester.wiremock.maven.plugin.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ParameterUtil {

    private ParameterUtil() {
    }

    private static final String ROOT_DIR_PARAM_PREFIX = "--root-dir=";

    public static String[] getAllParams(String dir, String nonDirParams) {
        List dirParam = Arrays.asList(getDirParam(dir));
        List otherParams = getNonDirParams(nonDirParams);
        List allParams = new ArrayList<>();
        allParams.addAll(dirParam);
        allParams.addAll(otherParams);
        return allParams.toArray(new String[]{});
    }

    public static String[] getDirParam(String dir) {
        List dirParam = new ArrayList<>();
        dirParam.add(ROOT_DIR_PARAM_PREFIX + dir);
        return dirParam.toArray(new String[]{});
    }

    private static List getNonDirParams(String nonDirParams) {
        return getParamsFrom(nonDirParams);
    }

    private static List getParamsFrom(String paramString) {
        String[] params = paramString.split(" ");
        return Arrays.asList(params);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy