Package com.saperion.common.lang.format
Class ParameterFormatter
java.lang.Object
com.saperion.common.lang.format.ParameterFormatter
- All Implemented Interfaces:
FormatConstants
Utility class for parameter formatting.
- Author:
- agz
-
Field Summary
Fields inherited from interface com.saperion.common.lang.format.FormatConstants
LS, LS_LENGTH, NULL, TAB, TAB_LENGTH
-
Method Summary
-
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 benull
). 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. UsesObject.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 benull
)nameValueSeparator
- string to add between parameter name and value (may be empty but must not benull
)parameterSeparator
- string to add between parameter name/value-pairs (may be empty but must not benull
)- Returns:
- the formatted string
-