Class YearMonth

  • All Implemented Interfaces:
    java.io.Serializable

    public class YearMonth
    extends java.lang.Object
    implements java.io.Serializable
    Implementation of the XML Schema type gYearMonth
    Author:
    Tom Jordahl
    See Also:
    XML Schema 3.2.10, Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      YearMonth​(int year, int month)
      Constructs a YearMonth with the given values No timezone is specified
      YearMonth​(int year, int month, java.lang.String timezone)
      Constructs a YearMonth with the given values, including a timezone string The timezone is validated but not used.
      YearMonth​(java.lang.String source)
      Construct a YearMonth from a String in the format [-]CCYY-MM
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      int getMonth()  
      java.lang.String getTimezone()  
      int getYear()  
      int hashCode()
      Return the value of (month + year) XORed with the hashCode of timezone iff one is defined.
      void setMonth​(int month)  
      void setTimezone​(java.lang.String timezone)  
      void setValue​(int year, int month)  
      void setValue​(int year, int month, java.lang.String timezone)  
      void setYear​(int year)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • YearMonth

        public YearMonth​(int year,
                         int month)
                  throws java.lang.NumberFormatException
        Constructs a YearMonth with the given values No timezone is specified
        Throws:
        java.lang.NumberFormatException
      • YearMonth

        public YearMonth​(int year,
                         int month,
                         java.lang.String timezone)
                  throws java.lang.NumberFormatException
        Constructs a YearMonth with the given values, including a timezone string The timezone is validated but not used.
        Throws:
        java.lang.NumberFormatException
      • YearMonth

        public YearMonth​(java.lang.String source)
                  throws java.lang.NumberFormatException
        Construct a YearMonth from a String in the format [-]CCYY-MM
        Throws:
        java.lang.NumberFormatException
    • Method Detail

      • getYear

        public int getYear()
      • setYear

        public void setYear​(int year)
      • getMonth

        public int getMonth()
      • setMonth

        public void setMonth​(int month)
      • getTimezone

        public java.lang.String getTimezone()
      • setTimezone

        public void setTimezone​(java.lang.String timezone)
      • setValue

        public void setValue​(int year,
                             int month,
                             java.lang.String timezone)
                      throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • setValue

        public void setValue​(int year,
                             int month)
                      throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Return the value of (month + year) XORed with the hashCode of timezone iff one is defined.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        an int value