Class EnvVarOperationProcessor


  • public class EnvVarOperationProcessor
    extends java.lang.Object
    This is an utility class that implements environment variable operations functionality: append, prepend, replace and remove
    Since:
    3.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.lang.String> convertToList​(java.lang.String value, java.lang.String delimiter)
      Converts a given value to string using a delimiter passed to this method
      static java.lang.String convertToString​(java.util.List<java.lang.String> list, java.lang.String delimiter)
      Converts list to a single String using a given delimiter to separate the list value in the resulting String
      static IEnvironmentVariable[] filterVariables​(IEnvironmentVariable[] variables, java.lang.String[] remove)  
      static java.lang.String normalizeName​(java.lang.String name)
      normalizes the variable name.
      static java.lang.String performAppend​(java.lang.String initialValue, java.lang.String addValue, java.lang.String delimiter)
      performs append given an initial String, a string to be appended and a delimiter Returns a String representing the result of the operation
      static java.lang.String performAppendPrepend​(java.lang.String initialValue, java.lang.String addValue, java.lang.String delimiter, boolean prepend)
      performs append or prepend given an initial String, a string to be appended/prepended and a delimiter Returns a String representing the result of the operation
      static java.lang.String performOperation​(java.lang.String initialValue, java.lang.String newValue, java.lang.String delimiter, int op)
      performs an environment variable operation Returns String representing the result of the operation
      static IEnvironmentVariable performOperation​(IEnvironmentVariable initial, IEnvironmentVariable added)
      performs the environment variable operation given an initial variable and a variable representing an operation to be performed Returns a new variable the represents the result of a performed operation
      static java.lang.String performPrepend​(java.lang.String initialValue, java.lang.String addValue, java.lang.String delimiter)
      performs prepend given an initial String, a string to be prepended and a delimiter Returns a String representing the result of the operation
      static java.util.List<java.lang.String> removeDuplicates​(java.util.List<java.lang.String> value, java.util.List<java.lang.String> duplicates)
      removes duplicates
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EnvVarOperationProcessor

        public EnvVarOperationProcessor()
    • Method Detail

      • performOperation

        public static IEnvironmentVariable performOperation​(IEnvironmentVariable initial,
                                                            IEnvironmentVariable added)
        performs the environment variable operation given an initial variable and a variable representing an operation to be performed Returns a new variable the represents the result of a performed operation
        Parameters:
        initial - the initial variable
        added - the variable that specifies an operation to be performed on the initial variable value
        Returns:
        the new variable the represents the result of a performed operation
      • performAppendPrepend

        public static java.lang.String performAppendPrepend​(java.lang.String initialValue,
                                                            java.lang.String addValue,
                                                            java.lang.String delimiter,
                                                            boolean prepend)
        performs append or prepend given an initial String, a string to be appended/prepended and a delimiter Returns a String representing the result of the operation
        Parameters:
        initialValue -
        addValue -
        delimiter -
        prepend -
        Returns:
        String
      • performAppend

        public static java.lang.String performAppend​(java.lang.String initialValue,
                                                     java.lang.String addValue,
                                                     java.lang.String delimiter)
        performs append given an initial String, a string to be appended and a delimiter Returns a String representing the result of the operation
        Parameters:
        initialValue -
        addValue -
        delimiter -
        Returns:
        String
      • performPrepend

        public static java.lang.String performPrepend​(java.lang.String initialValue,
                                                      java.lang.String addValue,
                                                      java.lang.String delimiter)
        performs prepend given an initial String, a string to be prepended and a delimiter Returns a String representing the result of the operation
        Parameters:
        initialValue -
        addValue -
        delimiter -
        Returns:
        String
      • performOperation

        public static java.lang.String performOperation​(java.lang.String initialValue,
                                                        java.lang.String newValue,
                                                        java.lang.String delimiter,
                                                        int op)
        performs an environment variable operation Returns String representing the result of the operation
        Parameters:
        initialValue -
        newValue -
        delimiter -
        op -
        Returns:
        String
      • convertToList

        public static java.util.List<java.lang.String> convertToList​(java.lang.String value,
                                                                     java.lang.String delimiter)
        Converts a given value to string using a delimiter passed to this method
        Parameters:
        value -
        delimiter -
      • removeDuplicates

        public static java.util.List<java.lang.String> removeDuplicates​(java.util.List<java.lang.String> value,
                                                                        java.util.List<java.lang.String> duplicates)
        removes duplicates
      • convertToString

        public static java.lang.String convertToString​(java.util.List<java.lang.String> list,
                                                       java.lang.String delimiter)
        Converts list to a single String using a given delimiter to separate the list value in the resulting String
        Parameters:
        list -
        delimiter -
        Returns:
        String
      • normalizeName

        public static java.lang.String normalizeName​(java.lang.String name)
        normalizes the variable name. That is: removes prepended and appended spaces
        Returns:
        the normalized name or null in case the name is not valid