Class LookUpHelper


  • public class LookUpHelper
    extends Object
    Helper class for LookUp related stuff.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • LookUpHelper

        public LookUpHelper()
    • Method Detail

      • newTable

        public static HashMap<String,​Object> newTable()
        Returns an empty new lookup table.
        Returns:
        the empty table
      • load

        public static HashMap<String,​Object> load​(PlaceholderFile file,
                                                        String key,
                                                        String value,
                                                        boolean useNative,
                                                        StringBuilder error)
        Generates a lookup table from the given file. Uses empty string as missing value.
        Parameters:
        file - the spreadsheet (CSV) to load
        key - the key column (or 1-based index)
        value - the value column (or 1-based index)
        useNative - whether to use native objects or just string representation
        error - for storing error messages
        Returns:
        the lookup table, null in case of an error
      • load

        public static HashMap<String,​Object> load​(SpreadSheet sheet,
                                                        String key,
                                                        String value,
                                                        boolean useNative,
                                                        StringBuilder error)
        Generates a lookup table from the given spreadsheet.
        Parameters:
        sheet - the spreadsheet to use
        key - the key column (or 1-based index)
        value - the value column (or 1-based index)
        useNative - whether to use native objects or just string representation
        error - for storing error messages
        Returns:
        the lookup table, null in case of an error