Class ImmutableDate

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.util.Date>

    public final class ImmutableDate
    extends java.util.Date
    Class acting as an immutable date class based on the Date class. Throws UnsupportedOperationException when mutable methods are invoked.
    See Also:
    Date, Immutable Date, Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long serialVersionUID  
    • Constructor Summary

      Constructors 
      Constructor Description
      ImmutableDate​(java.util.Date date)
      Private constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      void setDate​(int arg0)
      As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
      void setHours​(int arg0)
      As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
      void setMinutes​(int arg0)
      As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
      void setMonth​(int arg0)
      As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
      void setSeconds​(int arg0)
      As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
      void setTime​(long arg0)
      As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
      void setYear​(int arg0)
      As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
      • Methods inherited from class java.util.Date

        after, before, compareTo, equals, from, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, hashCode, parse, toGMTString, toInstant, toLocaleString, toString, UTC
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ImmutableDate

        public ImmutableDate​(java.util.Date date)
        Private constructor. A factory method is provided.
        Parameters:
        date - date to be made immutable
    • Method Detail

      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.util.Date
      • setDate

        public void setDate​(int arg0)
        As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
        Overrides:
        setDate in class java.util.Date
      • setHours

        public void setHours​(int arg0)
        As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
        Overrides:
        setHours in class java.util.Date
      • setMinutes

        public void setMinutes​(int arg0)
        As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
        Overrides:
        setMinutes in class java.util.Date
      • setMonth

        public void setMonth​(int arg0)
        As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
        Overrides:
        setMonth in class java.util.Date
      • setSeconds

        public void setSeconds​(int arg0)
        As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
        Overrides:
        setSeconds in class java.util.Date
      • setTime

        public void setTime​(long arg0)
        As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
        Overrides:
        setTime in class java.util.Date
      • setYear

        public void setYear​(int arg0)
        As an ImmutableDate is immutable, this method throws an UnsupportedOperationException exception.
        Overrides:
        setYear in class java.util.Date