java.lang.Object
de.powerstat.validation.values.Month
All Implemented Interfaces:
IValueObject, Comparable<Month>

public final class Month extends Object implements Comparable<Month>, IValueObject
Month. Not DSGVO relevant. TODO constructor with year TODO daysWithin() = 31, 30, 29, 28, n (Year specific for february, or october 1582) TODO Listener TODO Translations short/long TODO min, max
  • Field Details

  • Constructor Details

    • Month

      private Month(int month)
      Constructor.
      Parameters:
      month - Month 1-12
      Throws:
      IndexOutOfBoundsException - When the month is less than 1 or greater than 12
  • Method Details

    • of

      public static Month of(int month)
      Month factory.
      Parameters:
      month - Month 1-12
      Returns:
      Month object
      Throws:
      IndexOutOfBoundsException - When the month is less than 1 or greater than 12
    • of

      public static Month of(String value)
      Month factory.
      Parameters:
      value - Month 1-12 string
      Returns:
      Month object
      Throws:
      IndexOutOfBoundsException - When the month is less than 1 or greater than 12
    • intValue

      public int intValue()
      Returns the value of this Month as an int.
      Returns:
      The numeric value represented by this object after conversion to type int.
    • stringValue

      public String stringValue()
      Returns the value of this Month as an String.
      Specified by:
      stringValue in interface IValueObject
      Returns:
      The numeric value represented by this object after conversion to type String.
    • hashCode

      public int hashCode()
      Calculate hash code.
      Overrides:
      hashCode in class Object
      Returns:
      Hash
      See Also:
    • equals

      public boolean equals(Object obj)
      Is equal with another object.
      Overrides:
      equals in class Object
      Parameters:
      obj - Object
      Returns:
      true when equal, false otherwise
      See Also:
    • toString

      public String toString()
      Returns the string representation of this Month. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Month[month=1]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this Month
      See Also:
    • compareTo

      public int compareTo(Month obj)
      Compare with another object.
      Specified by:
      compareTo in interface Comparable<Month>
      Parameters:
      obj - Object to compare with
      Returns:
      0: equal; 1: greater; -1: smaller
      See Also:
    • add

      public Month add(Months months)
      Add months to this month.
      Parameters:
      months - Months to add to this month
      Returns:
      New month after adding the months to this month
      Throws:
      ArithmeticException - In case of an overflow
    • subtract

      public Month subtract(Months months)
      Subtract months from this month.
      Parameters:
      months - Months to subtract from this month
      Returns:
      New month after subtracting months from this month
      Throws:
      ArithmeticException - In case of an underflow
    • increment

      public Month increment()
      Increment this month.
      Returns:
      New month after incrementing this month
      Throws:
      ArithmeticException - In case of an overflow
    • decrement

      public Month decrement()
      Decrement this month.
      Returns:
      New month after decrement this month
      Throws:
      ArithmeticException - In case of an overflow