Class RawDateTime

  • All Implemented Interfaces:
    PofConstants

    public class RawDateTime
    extends PofHelper
    An immutable POF date-time value.
    Since:
    Coherence 3.2
    Author:
    cp 2006.07.17
    • Constructor Detail

      • RawDateTime

        public RawDateTime​(RawDate date,
                           RawTime time)
        Construct a date-time value.
        Parameters:
        date - the date portion of the raw date-time value
        time - the time portion of the raw date-time value
    • Method Detail

      • getRawDate

        public RawDate getRawDate()
        Obtain the date portion of the raw date-time value.
        Returns:
        the date portion of the raw date-time value
      • getRawTime

        public RawTime getRawTime()
        Obtain the time portion of the raw date-time value.
        Returns:
        the time portion of the raw date-time value
      • from

        public static RawDateTime from​(Object o)
        Create RawDateTime from the specified object.
        Parameters:
        o - an object to create RawDateTime from.
        Returns:
        a RawDateTime value
        Throws:
        IllegalArgumentException - if the specified object cannot be converted to RawDateTime
      • from

        public static RawDateTime from​(LocalDateTime dt)
        Create RawDateTime from the specified LocalDateTime.
        Parameters:
        dt - a LocalDateTime to create RawDateTime from.
        Returns:
        a RawDateTime value
      • from

        public static RawDateTime from​(OffsetDateTime dt)
        Create RawDateTime from the specified OffsetDateTime.
        Parameters:
        dt - a OffsetDateTime to create RawDateTime from.
        Returns:
        a RawDateTime value
      • from

        public static RawDateTime from​(Timestamp dt)
        Create RawDateTime from the specified Timestamp.
        Parameters:
        dt - a Timestamp to create RawDateTime from.
        Returns:
        a RawDateTime value
      • from

        public static RawDateTime from​(Date dt)
        Create RawDateTime from the specified Date.
        Parameters:
        dt - a Date to create RawDateTime from.
        Returns:
        a RawDateTime value
      • toLocalDateTime

        public LocalDateTime toLocalDateTime()
        Create a LocalDateTime from the raw date/time information.
        Returns:
        a LocalDateTime value
      • toOffsetDateTime

        public OffsetDateTime toOffsetDateTime()
        Create an OffsetDateTime from the raw date/time information.
        Returns:
        an OffsetDateTime value
        Throws:
        IllegalStateException - if this RawDateTime does not have time zone information
      • toSqlTimestamp

        public Timestamp toSqlTimestamp()
        Create a JDBC Timestamp from the raw date/time information. Note that the JDBC Timestamp does not contain timezone information.
        Returns:
        a JDBC Timestamp value
      • toJavaDate

        public Date toJavaDate()
        Create a Java Date from the raw date/time information. Note that the Java Date does not contain nanosecond information.
        Returns:
        a Java Date value
      • equals

        public boolean equals​(Object o)
        Compare this object with another for equality.
        Overrides:
        equals in class Object
        Parameters:
        o - another object to compare to for equality
        Returns:
        true iff this object is equal to the other object
      • hashCode

        public int hashCode()
        Obtain the hashcode for this object.
        Overrides:
        hashCode in class Object
        Returns:
        an integer hashcode
      • toString

        public String toString()
        Format this object's data as a human-readable string.
        Overrides:
        toString in class Object
        Returns:
        a string description of this object