Class Helper


  • public class Helper
    extends Object
    Class for shared used (static) methods
    Author:
    Raphael Stoeckli
    • Field Detail

      • MIN_OADATE_VALUE

        public static final double MIN_OADATE_VALUE
        Minimum valid OAdate value (1900-01-01)
        See Also:
        Constant Field Values
      • MAX_OADATE_VALUE

        public static final double MAX_OADATE_VALUE
        Maximum valid OAdate value (9999-12-31)
        See Also:
        Constant Field Values
    • Constructor Detail

      • Helper

        public Helper()
    • Method Detail

      • getOADateTimeString

        public static String getOADateTimeString​(Date date)
        Method to calculate the OA date (OLE automation) of the passed date.
        OA Date format starts at January 1st 1900 (actually 00.01.1900)and ends at December 31 9999. Values beyond these dates cannot be handled by Excel under normal circumstances and will throw a FormatException
        Parameters:
        date - Date to convert
        Returns:
        Date or date and time as number
        Throws:
        FormatException - Throws a FormatException if the passed date cannot be translated to the OADate format
      • getOATimeString

        public static String getOATimeString​(LocalTime time)
        Method to convert a time into the internal Excel time format (OAdate without days)

        The time is represented by a OAdate without the date component. A time range is between >0.0 (00:00:00) and <1.0 (23:59:59)

        Parameters:
        time - Time to process.
        Returns:
        Time as number
        Throws:
        FormatException - Throws a FormatException if the passed time cannot be translated to the OADate format
      • isNullOrEmpty

        public static boolean isNullOrEmpty​(String value)
        Method of a string to check whether its reference is null or the content is empty
        Parameters:
        value - value / reference to check
        Returns:
        True if the passed parameter is null or empty, otherwise false