Class DateTimeHandler

    • Constructor Summary

      Constructors 
      Constructor Description
      DateTimeHandler()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.time.Instant generateLowerBound​(SearchConstants.Prefix prefix, java.time.temporal.TemporalAccessor value, java.lang.String originalString)
      generate lower bounds
      static java.time.Instant generateLowerBoundApproximation​(java.time.Instant now, java.time.Instant cur)
      Calculates a lower bound absolutely.
      static java.sql.Timestamp generateTimestamp​(java.time.Instant inst)  
      static java.time.Instant generateUpperBound​(Date value)
      convenience method to generate upper bound for a Date value.
      static java.time.Instant generateUpperBound​(DateTime value)
      convenience method to generate upper bound for a DateTime value.
      static java.time.Instant generateUpperBound​(SearchConstants.Prefix prefix, java.time.temporal.TemporalAccessor value, java.lang.String originalString)
      generate upper bounds
      static java.time.Instant generateUpperBoundApproximation​(java.time.Instant now, java.time.Instant cur)
      Calculates a lower bound absolutely.
      static java.time.Instant generateValue​(java.time.temporal.TemporalAccessor value)
      Common code to generate an instant value.
      static java.time.Instant generateValue​(java.time.temporal.TemporalAccessor value, java.lang.String originalString)  
      static java.time.temporal.TemporalAccessor parse​(java.lang.String value)
      Parses the value into a set of bounds/value and adds to parameter value.
      static void parse​(SearchConstants.Prefix prefix, QueryParameterValue parameterValue, java.lang.String v)
      parses the value into a set of bounds/value and adds to parameter value.
      static java.time.temporal.TemporalAccessor parseQuiet​(java.lang.String value)
      Parses quiet the value into a set of bounds/value and adds to parameter value.
      static java.lang.String serialize​(java.time.temporal.TemporalAccessor value)
      Serializer encapsulates the logic to serialize to string.
      • Methods inherited from class java.lang.Object

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

      • DateTimeHandler

        public DateTimeHandler()
    • Method Detail

      • generateTimestamp

        public static java.sql.Timestamp generateTimestamp​(java.time.Instant inst)
      • generateLowerBoundApproximation

        public static java.time.Instant generateLowerBoundApproximation​(java.time.Instant now,
                                                                        java.time.Instant cur)
        Calculates a lower bound absolutely. No matter if the time is AFTER the current time.
        Parameters:
        now - the instant representing "now"...the now to compare against for computing the "approximation" range
        cur - the search parameter value instant
        Returns:
      • generateLowerBound

        public static java.time.Instant generateLowerBound​(SearchConstants.Prefix prefix,
                                                           java.time.temporal.TemporalAccessor value,
                                                           java.lang.String originalString)
        generate lower bounds
        Parameters:
        prefix -
        value -
        originalString -
        Returns:
      • generateValue

        public static java.time.Instant generateValue​(java.time.temporal.TemporalAccessor value,
                                                      java.lang.String originalString)
      • generateValue

        public static java.time.Instant generateValue​(java.time.temporal.TemporalAccessor value)
        Common code to generate an instant value. If needed, this method will pad the TemporalAccessor and then interpret this value according to the default timezone of the system.
        Parameters:
        value -
        Returns:
      • generateUpperBound

        public static java.time.Instant generateUpperBound​(DateTime value)
        convenience method to generate upper bound for a DateTime value.
        Parameters:
        value -
        Returns:
      • generateUpperBound

        public static java.time.Instant generateUpperBound​(Date value)
        convenience method to generate upper bound for a Date value.
        Parameters:
        value -
        Returns:
      • generateUpperBound

        public static java.time.Instant generateUpperBound​(SearchConstants.Prefix prefix,
                                                           java.time.temporal.TemporalAccessor value,
                                                           java.lang.String originalString)
        generate upper bounds
        Parameters:
        prefix -
        value -
        originalString -
        Returns:
      • generateUpperBoundApproximation

        public static java.time.Instant generateUpperBoundApproximation​(java.time.Instant now,
                                                                        java.time.Instant cur)
        Calculates a lower bound absolutely. No matter if the time is AFTER the current time.
        Parameters:
        now -
        cur -
        Returns:
      • serialize

        public static java.lang.String serialize​(java.time.temporal.TemporalAccessor value)
        Serializer encapsulates the logic to serialize to string.
      • parse

        public static java.time.temporal.TemporalAccessor parse​(java.lang.String value)
                                                         throws FHIRSearchException
        Parses the value into a set of bounds/value and adds to parameter value. The value will be truncated to a microsecond precision after being parsed.
        Parameters:
        value - The date/time value to be parsed
        Returns:
        A TemporalAccessor object representing the parsed and truncated date/time value
        Throws:
        FHIRSearchException
      • parseQuiet

        public static java.time.temporal.TemporalAccessor parseQuiet​(java.lang.String value)
        Parses quiet the value into a set of bounds/value and adds to parameter value. The value will be truncated to a microsecond precision after being parsed.
        Parameters:
        value - The date/time value to be parsed
        Returns:
        A TemporalAccessor object representing the parsed and truncated date/time value, or null if the value could not be parsed successfully