Package com.ibm.fhir.search.date
Class DateTimeHandler
- java.lang.Object
-
- com.ibm.fhir.search.date.DateTimeHandler
-
public class DateTimeHandler extends Object
Date Time Handler
Date Time Formatter
-
-
Constructor Summary
Constructors Constructor Description DateTimeHandler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Instant
generateLowerBound(SearchConstants.Prefix prefix, TemporalAccessor value, String originalString)
generate lower boundsstatic Instant
generateLowerBoundApproximation(Instant now, Instant cur)
Calculates a lower bound absolutely.static Timestamp
generateTimestamp(Instant inst)
static Instant
generateUpperBound(Date value)
convenience method to generate upper bound for a Date value.static Instant
generateUpperBound(DateTime value)
convenience method to generate upper bound for a DateTime value.static Instant
generateUpperBound(SearchConstants.Prefix prefix, TemporalAccessor value, String originalString)
generate upper boundsstatic Instant
generateUpperBoundApproximation(Instant now, Instant cur)
Calculates a lower bound absolutely.static Instant
generateValue(TemporalAccessor value)
common code to generate instant value.static Instant
generateValue(TemporalAccessor value, String originalString)
static void
parse(SearchConstants.Prefix prefix, QueryParameterValue parameterValue, String v)
parses the value into a set of bounds/value and adds to parameter value.static TemporalAccessor
parse(String value)
Parses the value into a set of bounds/value and adds to parameter value.static TemporalAccessor
parseQuiet(String value)
Parses quiet the value into a set of bounds/value and adds to parameter value.static String
serialize(TemporalAccessor value)
Serializer encapsulates the logic to serialize to string.
-
-
-
Method Detail
-
generateLowerBoundApproximation
public static Instant generateLowerBoundApproximation(Instant now, 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" rangecur
- the search parameter value instant- Returns:
-
generateLowerBound
public static Instant generateLowerBound(SearchConstants.Prefix prefix, TemporalAccessor value, String originalString)
generate lower bounds- Parameters:
prefix
-value
-originalString
-- Returns:
-
generateValue
public static Instant generateValue(TemporalAccessor value, String originalString)
-
generateValue
public static Instant generateValue(TemporalAccessor value)
common code to generate instant value.- Parameters:
value
-- Returns:
-
generateUpperBound
public static Instant generateUpperBound(DateTime value)
convenience method to generate upper bound for a DateTime value.- Parameters:
value
-- Returns:
-
generateUpperBound
public static Instant generateUpperBound(Date value)
convenience method to generate upper bound for a Date value.- Parameters:
value
-- Returns:
-
generateUpperBound
public static Instant generateUpperBound(SearchConstants.Prefix prefix, TemporalAccessor value, String originalString)
generate upper bounds- Parameters:
prefix
-value
-originalString
-- Returns:
-
generateUpperBoundApproximation
public static Instant generateUpperBoundApproximation(Instant now, Instant cur)
Calculates a lower bound absolutely. No matter if the time is AFTER the current time.- Parameters:
now
-cur
-- Returns:
-
serialize
public static String serialize(TemporalAccessor value)
Serializer encapsulates the logic to serialize to string.
-
parse
public static void parse(SearchConstants.Prefix prefix, QueryParameterValue parameterValue, String v) throws FHIRSearchException
parses the value into a set of bounds/value and adds to parameter value.- Parameters:
prefix
-parameterValue
-v
-- Throws:
FHIRSearchException
-
parse
public static TemporalAccessor parse(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 TemporalAccessor parseQuiet(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
-
-