Class ParameterFormatter

  • All Implemented Interfaces:
    FormatConstants

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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String format​(java.lang.Object[] arObjects, java.lang.String nameValueSeparator, java.lang.String parameterSeparator)
      Assumes that the specified array of objects alternating contains a parameter name (string) and a parameter value (any object, may be null).
      • Methods inherited from class java.lang.Object

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

      • format

        public static java.lang.String format​(java.lang.Object[] arObjects,
                                              java.lang.String nameValueSeparator,
                                              java.lang.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