Class ParameterUtils


  • public class ParameterUtils
    extends Object
    Utility methods for working with Parameters.
    Author:
    Nick Collier
    • Constructor Detail

      • ParameterUtils

        public ParameterUtils()
    • Method Detail

      • parseDefaultValue

        public static Object[] parseDefaultValue​(Class type,
                                                 String name,
                                                 String val)
                                          throws ParameterFormatException
        Parses and converts string representations of primitive values, their Object representations (ie. int and Integer) and Strings into an array. If the val parameter consists of a single string then the array will contain a single element. If the val parameter consists of more than one space delimited elements then the array will contain that many elements.
        Parameters:
        type - the type of the object
        name - the name of the parameter
        val - the list of string values to convert
        Returns:
        an array of the converted values.
        Throws:
        ParameterFormatException - if there is a parsing or converting error
        IllegalArgumentException - if the type is not a primitive, a primitive Object or a String.
      • getStringValue

        public static String getStringValue​(Class type,
                                            StringConverter converter,
                                            List values)
        Converts a list of object values to the string list representation