Class ListTokenizer


  • public class ListTokenizer
    extends Object
    Tokenizes lists and ranges of strings, numbers and booleans into their individual elements.
    Author:
    Nick Collier
    • Constructor Detail

      • ListTokenizer

        public ListTokenizer()
    • Method Detail

      • parseBooleanValues

        public static Boolean[] parseBooleanValues​(String values,
                                                   String name)
                                            throws ParameterFormatException
        Parses a space delimited list of strings into an array of boolean values. The individual elements must be "true" or "false"
        Parameters:
        values - the values to tokenize
        name - the name of the parameter
        Returns:
        the tokenized list as an array of Booleans
        Throws:
        ParameterFormatException - if there is an error in the tokenization or conversion.
      • parseFloatValues

        public static Float[] parseFloatValues​(String values,
                                               String name)
                                        throws ParameterFormatException
        Parses a space delimited list of strings into an array of Float values. The strings must be valid floats.
        Parameters:
        values - the values to tokenize
        name - the name of the parameter
        Returns:
        the tokenized list as an array of Floats
        Throws:
        ParameterFormatException - if there is an error in the tokenization or conversion.
      • parseLongValues

        public static Long[] parseLongValues​(String values,
                                             String name)
                                      throws ParameterFormatException
        Parses a space delimited list of strings into an array of Long values. The strings must be valid longs.
        Parameters:
        values - the values to tokenize
        name - the name of the parameter
        Returns:
        the tokenized list as an array of Longs
        Throws:
        ParameterFormatException - if there is an error in the tokenization or conversion.
      • parseDoubleValues

        public static Double[] parseDoubleValues​(String values,
                                                 String name)
                                          throws ParameterFormatException
        Parses a space delimited list of strings into an array of Double values. The strings must be valid doubles.
        Parameters:
        values - the values to tokenize
        name - the name of the parameter
        Returns:
        the tokenized list as an array of Doubles
        Throws:
        ParameterFormatException - if there is an error in the tokenization or conversion.
      • parseByteValues

        public static Byte[] parseByteValues​(String values,
                                             String name)
                                      throws ParameterFormatException
        Parses a space delimited list of strings into an array of Byte values. The strings must be valid bytes.
        Parameters:
        values - the values to tokenize
        name - the name of the parameter
        Returns:
        the tokenized list as an array of Bytes
        Throws:
        ParameterFormatException - if there is an error in the tokenization or conversion.
      • parseShortValues

        public static Short[] parseShortValues​(String values,
                                               String name)
                                        throws ParameterFormatException
        Parses a space delimited list of strings into an array of Short values. The strings must be valid Shorts.
        Parameters:
        values - the values to tokenize
        name - the name of the parameter
        Returns:
        the tokenized list as an array of Shorts
        Throws:
        ParameterFormatException - if there is an error in the tokenization or conversion.
      • parseIntValues

        public static Integer[] parseIntValues​(String values,
                                               String name)
                                        throws ParameterFormatException
        Parses a space delimited list of strings into an array of Integer values. The strings must be valid ints.
        Parameters:
        values - the values to tokenize
        name - the name of the parameter
        Returns:
        the tokenized list as an array of Integers
        Throws:
        ParameterFormatException - if there is an error in the tokenization or conversion.
      • parseStringValues

        public static String[] parseStringValues​(String values)
        Parses a space delimited list of strings into an array of individual String values. The strings should be enclosed in single quotes.
        Parameters:
        values - the values to tokenize
        Returns:
        the tokenized list as an array of Strings