Class ParameterFormatter

java.lang.Object
com.saperion.common.lang.format.ParameterFormatter
All Implemented Interfaces:
FormatConstants

public final class ParameterFormatter extends Object implements FormatConstants
Utility class for parameter formatting.
Author:
agz
  • Method Details

    • format

      public static String format(Object[] arObjects, String nameValueSeparator, String parameterSeparator)
      Assumes that the specified array of objects alternating contains a parameter name (string) and a parameter value (any object, may be null).

      Returns a string, where each parameter name/value-pair is separated by the specified name-value-separator and each such pair is separated to the next by the specified parameter-separator.

      Uses Object.toString() to format the parameter values.

      Throws a runtime-exception, if the specified array of objects is impair.
      Throws a runtime-exception, if an element at a name-position is not a string.

      Parameters:
      arObjects - array of alternating a parameter name (string) and a parameter value (any object, may be null)
      nameValueSeparator - string to add between parameter name and value (may be empty but must not be null)
      parameterSeparator - string to add between parameter name/value-pairs (may be empty but must not be null)
      Returns:
      the formatted string