Class AbstractAmbiguousTemporal<TYPE extends AbstractAmbiguousTemporal<TYPE>>

  • Type Parameters:
    TYPE - the bound object type
    All Implemented Interfaces:
    ICustomJavaDataType<TYPE>
    Direct Known Subclasses:
    Date, DateTime

    public abstract class AbstractAmbiguousTemporal<TYPE extends AbstractAmbiguousTemporal<TYPE>>
    extends AbstractCustomJavaDataType<TYPE,​ZonedDateTime>
    Metaschema has a need to represent dates and times that allow for an ambiguous time zone. This is due to some models not requiring a time zone as part of a date/time. An ambiguous dateTime allows a time zone to be inferred, without change information in the source content.

    This class wraps a ZonedDateTime object and tracks if a time zone was found when parsing, which can be used to ensure that the assumed time zone is not written back out in such cases.

    • Constructor Detail

      • AbstractAmbiguousTemporal

        public AbstractAmbiguousTemporal​(@NonNull
                                         ZonedDateTime value,
                                         boolean hasTimeZone)
        Construct a new object. This type supports ambiguous dates/times that were provided without a time zone.
        Parameters:
        value - the date value
        hasTimeZone - true if the date is intended to have an associated time zone or false otherwise
    • Method Detail

      • hasTimeZone

        public boolean hasTimeZone()
        Indicate if a time zone is configured.
        Returns:
        true if the date is intended to have an associated time zone or false otherwise