Class TimeUtil


  • public class TimeUtil
    extends java.lang.Object
    Operations for ZonedDateTime, Zone and MyDataTimeExpressions
    Author:
    Robin Brandstaedter
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.time.ZonedDateTime addDay​(int value, java.time.ZonedDateTime aZonedDateTime)  
      static java.time.ZonedDateTime addHours​(int value, java.time.ZonedDateTime aZonedDateTime)  
      static java.time.ZonedDateTime addMinutes​(int value, java.time.ZonedDateTime aZonedDateTime)  
      static java.time.ZonedDateTime addMonth​(int value, java.time.ZonedDateTime aZonedDateTime)  
      static java.time.ZonedDateTime addSeconds​(int value, java.time.ZonedDateTime aZonedDateTime)  
      static java.time.ZonedDateTime addYear​(int value, java.time.ZonedDateTime aZonedDateTime)  
      static java.time.ZonedDateTime addYear​(java.lang.String expressionValue, java.time.ZonedDateTime aZonedDateTime)  
      static java.time.ZonedDateTime getDynamicZonedDateTime​(java.util.Map<java.lang.String,​java.lang.String> expressionMap, java.time.ZonedDateTime timeRelativeTo)  
      static java.util.Map<java.lang.String,​java.lang.String> getExpressionMap​(java.lang.String expression)  
      static java.lang.String getHighestRelativeChangeUnit​(TimeExpression timeExpression)  
      static TimeInterval getInterval​(java.lang.String fixedExpression, java.time.ZonedDateTime timeRelativeTo)  
      static TimeInterval getInterval​(java.lang.String fixedExpression, java.time.ZonedDateTime timeRelativeTo, java.lang.String sDayOfWeek)  
      static java.lang.String getLowestConcreteUnit​(TimeExpression timeExpression)  
      static long getMillisFromZonedDateTime​(java.time.ZonedDateTime zdt, java.lang.String targetZoneId)  
      static java.time.ZonedDateTime getNow​(java.lang.String timezoneid)  
      static java.time.ZonedDateTime getNow​(java.time.ZoneId zoneId)  
      static int getValenceOfUnitString​(java.lang.String unit)  
      static java.time.ZonedDateTime getZonedDateTime​(java.lang.String dateString, java.lang.String timezoneid)  
      static java.time.ZonedDateTime getZonedDateTime​(java.lang.String dateString, java.time.ZoneId zoneId)  
      static java.time.ZonedDateTime getZonedDateTime​(java.sql.Timestamp ts, java.lang.String timezoneid)  
      static boolean isValid​(TimeExpression timeExpression)  
      static java.time.ZonedDateTime parseExpressionToZonedDateTime​(java.lang.String expression, java.time.ZonedDateTime timeRelativeTo)
      Parses the expression and returns the zoned date time.
      static TimeExpression splittMap​(java.util.Map<java.lang.String,​java.lang.String> expressionMap)  
      static java.time.ZonedDateTime transferToZone​(java.time.ZonedDateTime zdt, java.lang.String timeZoneId)  
      static java.time.ZonedDateTime transferToZone​(java.time.ZonedDateTime zdt, java.time.ZoneId zoneId)  
      • Methods inherited from class java.lang.Object

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

      • TimeUtil

        public TimeUtil()
    • Method Detail

      • parseExpressionToZonedDateTime

        public static java.time.ZonedDateTime parseExpressionToZonedDateTime​(java.lang.String expression,
                                                                             java.time.ZonedDateTime timeRelativeTo)
        Parses the expression and returns the zoned date time.
        Parameters:
        expression - e.g., "10.10.2016 00:00:00", "*.-1.* *:*:*",...
        timeRelativeTo - the time relative to now/event
        Returns:
        the zoned date time
        Throws:
        java.lang.IllegalArgumentException - the invalid format exception
      • getInterval

        public static TimeInterval getInterval​(java.lang.String fixedExpression,
                                               java.time.ZonedDateTime timeRelativeTo)
      • getInterval

        public static TimeInterval getInterval​(java.lang.String fixedExpression,
                                               java.time.ZonedDateTime timeRelativeTo,
                                               java.lang.String sDayOfWeek)
      • getDynamicZonedDateTime

        public static java.time.ZonedDateTime getDynamicZonedDateTime​(java.util.Map<java.lang.String,​java.lang.String> expressionMap,
                                                                      java.time.ZonedDateTime timeRelativeTo)
      • addYear

        public static java.time.ZonedDateTime addYear​(int value,
                                                      java.time.ZonedDateTime aZonedDateTime)
      • addMonth

        public static java.time.ZonedDateTime addMonth​(int value,
                                                       java.time.ZonedDateTime aZonedDateTime)
      • addDay

        public static java.time.ZonedDateTime addDay​(int value,
                                                     java.time.ZonedDateTime aZonedDateTime)
      • addHours

        public static java.time.ZonedDateTime addHours​(int value,
                                                       java.time.ZonedDateTime aZonedDateTime)
      • addMinutes

        public static java.time.ZonedDateTime addMinutes​(int value,
                                                         java.time.ZonedDateTime aZonedDateTime)
      • addSeconds

        public static java.time.ZonedDateTime addSeconds​(int value,
                                                         java.time.ZonedDateTime aZonedDateTime)
      • addYear

        public static java.time.ZonedDateTime addYear​(java.lang.String expressionValue,
                                                      java.time.ZonedDateTime aZonedDateTime)
      • getExpressionMap

        public static java.util.Map<java.lang.String,​java.lang.String> getExpressionMap​(java.lang.String expression)
      • splittMap

        public static TimeExpression splittMap​(java.util.Map<java.lang.String,​java.lang.String> expressionMap)
      • getNow

        public static java.time.ZonedDateTime getNow​(java.lang.String timezoneid)
      • getNow

        public static java.time.ZonedDateTime getNow​(java.time.ZoneId zoneId)
      • transferToZone

        public static java.time.ZonedDateTime transferToZone​(java.time.ZonedDateTime zdt,
                                                             java.lang.String timeZoneId)
      • transferToZone

        public static java.time.ZonedDateTime transferToZone​(java.time.ZonedDateTime zdt,
                                                             java.time.ZoneId zoneId)
      • getHighestRelativeChangeUnit

        public static java.lang.String getHighestRelativeChangeUnit​(TimeExpression timeExpression)
      • getLowestConcreteUnit

        public static java.lang.String getLowestConcreteUnit​(TimeExpression timeExpression)
      • getValenceOfUnitString

        public static int getValenceOfUnitString​(java.lang.String unit)
      • isValid

        public static boolean isValid​(TimeExpression timeExpression)
      • getZonedDateTime

        public static java.time.ZonedDateTime getZonedDateTime​(java.lang.String dateString,
                                                               java.lang.String timezoneid)
      • getZonedDateTime

        public static java.time.ZonedDateTime getZonedDateTime​(java.sql.Timestamp ts,
                                                               java.lang.String timezoneid)
      • getZonedDateTime

        public static java.time.ZonedDateTime getZonedDateTime​(java.lang.String dateString,
                                                               java.time.ZoneId zoneId)
      • getMillisFromZonedDateTime

        public static long getMillisFromZonedDateTime​(java.time.ZonedDateTime zdt,
                                                      java.lang.String targetZoneId)