Class SimpleParameters

java.lang.Object
tv.hd3g.processlauncher.cmdline.SimpleParameters
Direct Known Subclasses:
Parameters

public class SimpleParameters extends Object
  • Field Details

    • MUST_ESCAPE

      public static final List<Character> MUST_ESCAPE
    • MUST_SURROUND_QUOTE

      public static final List<Character> MUST_SURROUND_QUOTE
  • Method Details

    • 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.
    • clear

      public SimpleParameters clear()
    • 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
    • replaceParameters

      public SimpleParameters replaceParameters(Collection<? extends String> newParameters)
    • addParameters

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

      public SimpleParameters addParameters(Collection<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(Collection<String> params)
      Parameters:
      params - don't alter params
    • 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.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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()
    • getAllArgKeyValues

      public Map<String,List<String>> getAllArgKeyValues()
    • 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:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object