Class RawDate

All Implemented Interfaces:
PofConstants

public class RawDate extends PofHelper
An immutable POF date value.
Since:
Coherence 3.2
Author:
cp 2006.07.17
  • Constructor Details

    • RawDate

      public RawDate(int nYear, int nMonth, int nDay)
      Construct a raw POF date value.
      Parameters:
      nYear - the year number as defined by ISO8601; note the difference with the Java Date class, whose year is relative to 1900
      nMonth - the month number between 1 and 12 inclusive as defined by ISO8601; note the difference from the Java Date class, whose month value is 0-based (0-11)
      nDay - the day number between 1 and 31 inclusive as defined by ISO8601
  • Method Details

    • getYear

      public int getYear()
      Determine the date's year value.
      Returns:
      the year number as defined by ISO8601; note the difference with the Java Date class, whose year is relative to 1900
    • getMonth

      public int getMonth()
      Determine the date's month value.
      Returns:
      the month number between 1 and 12 inclusive as defined by ISO8601; note the difference from the Java Date class, whose month value is 0-based (0-11)
    • getDay

      public int getDay()
      Determine the date's day value.
      Returns:
      the day number between 1 and 31 inclusive as defined by ISO8601
    • from

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

      public static RawDate from(LocalDate date)
      Create a RawDate from the LocalDate.
      Parameters:
      date - a LocalDate value
      Returns:
      a RawDate value
    • from

      public static RawDate from(Date date)
      Create a RawDate from the JDBC Date.
      Parameters:
      date - a java.sql.Date value
      Returns:
      a RawDate value
    • from

      public static RawDate from(Date date)
      Create a RawDate from the Java Date.
      Parameters:
      date - a java.util.Date value
      Returns:
      a RawDate value
    • toLocalDate

      public LocalDate toLocalDate()
      Create a LocalDate from the raw date information.
      Returns:
      a LocalDate value
    • toSqlDate

      public Date toSqlDate()
      Create a JDBC Date from the raw date information.
      Returns:
      a JDBC Date value
    • toJavaDate

      public Date toJavaDate()
      Create a Java Date from the raw date 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