Class SimpleParameters

  • Direct Known Subclasses:
    Parameters

    public class SimpleParameters
    extends Object
    • Field Detail

      • MUST_SURROUND_QUOTE

        public static final List<Character> MUST_SURROUND_QUOTE
    • Method Detail

      • transfertThisConfigurationTo

        public SimpleParameters transfertThisConfigurationTo​(SimpleParameters newInstance)
        Don't touch to current parameters, only parameterKeysStartsWith
      • importParametersFrom

        public SimpleParameters importParametersFrom​(SimpleParameters previousInstance)
        Transfer (clone) current parameters and parameterKeysStartsWith
      • addAllFrom

        public void addAllFrom​(SimpleParameters source)
        Don't touch to actual parameters, and clone from source.
      • hasParameters

        public boolean hasParameters​(String... params)
        Parameters:
        params - (anyMatch) ; params can have "-" or not (it will be added).
      • ifHasNotParameter

        public SimpleParameters ifHasNotParameter​(Runnable toDoIfMissing,
                                                  String... inParameters)
        See SimpleParameters#hasParameters()
      • getParameters

        public List<String> getParameters()
        Returns:
        internal list, never null
      • addParameters

        public SimpleParameters addParameters​(String... params)
        Parameters:
        params - don't alter params Remove null and empty
      • addBulkParameters

        public SimpleParameters addBulkParameters​(String params)
        Parameters:
        params - transform spaces in each param to new params: "a b c d" -> ["a", "b", "c", "d"], and it manage " but not tabs. Remove empty
      • prependParameters

        public SimpleParameters prependParameters​(String... params)
        Parameters:
        params - add all in front of command line, don't alter params
      • prependBulkParameters

        public SimpleParameters prependBulkParameters​(String params)
        Parameters:
        params - params add all in front of command line, transform spaces in each param to new params: "a b c d" -> ["a", "b", "c", "d"], and it manage " but not tabs.
      • exportToExternalCommandLine

        public String exportToExternalCommandLine​(String processExecFile)
        Mostly in Linux/Bash mode.
        Returns:
        with automatic escape
      • setParametersKeysStartsWith

        public SimpleParameters setParametersKeysStartsWith​(String parameterKeysStartsWith)
        Parameters:
        parameterKeysStartsWith - "-" by default
      • getParametersKeysStartsWith

        public String getParametersKeysStartsWith()
        Returns:
        "-" by default
      • conformParameterKey

        protected String conformParameterKey​(String parameterKey)
        Parameters:
        parameterKey - add "-" in front of paramKey if needed
      • getValues

        public List<String> getValues​(String parameterKey)
        Parameters:
        parameterKey - can have "-" or not (it will be added).
        Returns:
        For "-param val1 -param val2 -param val3" -> val1, val2, val3 ; null if parameterKey can't be found, empty if not values for param
      • removeParameter

        public boolean removeParameter​(String parametersKey,
                                       int paramAsThisKeyPos)
        Search a remove all parameters with paramKey as name, even associated values.
        Parameters:
        parametersKey - can have "-" or not (it will be added).
      • alterParameter

        public boolean alterParameter​(String parameterKey,
                                      String newValue,
                                      int paramAsThisKeyPos)
        Parameters:
        parameterKey - can have "-" or not (it will be added).
        Returns:
        true if done
      • count

        public int count()
      • isEmpty

        public boolean isEmpty()
      • compareAndAlter

        public void compareAndAlter​(SimpleParameters toCompare,
                                    ArgValueChoice argValueChoice,
                                    boolean removeActualMissing,
                                    boolean addComparedMissing)
        Parameters:
        argValueChoice - policy to apply if some args keys a in common with actual and toCompare
        removeActualMissing - remove all current args not founded in toCompare args list
        addComparedMissing - add all args from toCompare args list for some not found in actual args list
        See Also:
        getAllArgKeyValues()