Class SpreadsheetUtils


  • public class SpreadsheetUtils
    extends java.lang.Object
    This class provides support methods.
    Author:
    Martins Francis
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.lang.String> convertObjectToList​(java.lang.Object value)
      This method creates list representation of the given object.
      static java.lang.String convertObjectToString​(SpreadsheetColumn column, java.lang.Object inputValue)
      This method creates a string representation of the given object.
      static java.util.List<SpreadsheetRow> extractAllRowsFromObject​(java.lang.Object object)
      This method returns all SpreadsheetRow instances contained by the given object.
      static java.util.Map<java.lang.String,​java.lang.Object> extractMapFromCollection​(java.util.Collection<java.lang.Object> collection)
      This method extracts Map from the given collection - it assumes the first object contained by it is a Map.
      static java.lang.String getValueConformingToDataType​(SpreadsheetColumn column, java.lang.String value)  
      static void removeFirst​(java.lang.StringBuilder sb, java.lang.String leadingChars)  
      static void removeFirstChar​(java.lang.StringBuilder sb)  
      static void removeLast​(java.lang.StringBuilder sb, java.lang.String trailingChars)  
      static void removeLastChar​(java.lang.StringBuilder sb)  
      • Methods inherited from class java.lang.Object

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

      • SpreadsheetUtils

        public SpreadsheetUtils()
    • Method Detail

      • removeFirstChar

        public static void removeFirstChar​(java.lang.StringBuilder sb)
      • removeFirst

        public static void removeFirst​(java.lang.StringBuilder sb,
                                       java.lang.String leadingChars)
      • removeLastChar

        public static void removeLastChar​(java.lang.StringBuilder sb)
      • removeLast

        public static void removeLast​(java.lang.StringBuilder sb,
                                      java.lang.String trailingChars)
      • getValueConformingToDataType

        public static java.lang.String getValueConformingToDataType​(SpreadsheetColumn column,
                                                                    java.lang.String value)
      • extractAllRowsFromObject

        public static java.util.List<SpreadsheetRow> extractAllRowsFromObject​(java.lang.Object object)
        This method returns all SpreadsheetRow instances contained by the given object.
        Parameters:
        object -
        Returns:
        list of SpreadsheetRow instances
      • extractMapFromCollection

        public static java.util.Map<java.lang.String,​java.lang.Object> extractMapFromCollection​(java.util.Collection<java.lang.Object> collection)
        This method extracts Map from the given collection - it assumes the first object contained by it is a Map. If the collection is empty or null then an empty Map is returned.
        Parameters:
        collection -
        Returns:
        Map
      • convertObjectToString

        public static java.lang.String convertObjectToString​(SpreadsheetColumn column,
                                                             java.lang.Object inputValue)
        This method creates a string representation of the given object. If it is an Iterable object then a delimiter separated string is created.
        Parameters:
        column -
        inputValue -
        Returns:
        string representation of the given object
      • convertObjectToList

        public static java.util.List<java.lang.String> convertObjectToList​(java.lang.Object value)
        This method creates list representation of the given object.
        Parameters:
        column -
        value -
        Returns:
        list representation of the given object