Class Helper


  • public class Helper
    extends java.lang.Object
    Class for shared used (static) methods
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double MAX_OADATE_VALUE
      Maximum valid OAdate value (9999-12-31)
      static double MIN_OADATE_VALUE
      Minimum valid OAdate value (1900-01-01)
    • Constructor Summary

      Constructors 
      Constructor Description
      Helper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getOADateTimeString​(java.util.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.
      static java.lang.String getOATimeString​(java.time.LocalTime time)
      Method to convert a time into the internal Excel time format (OAdate without days)
      static boolean isNullOrEmpty​(java.lang.String value)
      Method of a string to check whether its reference is null or the content is empty
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 java.lang.String getOADateTimeString​(java.util.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 java.lang.String getOATimeString​(java.time.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​(java.lang.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