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

public final class Week extends Object implements Comparable<Week>, IValueObject
Week. Not DSGVO relevant. TODO Constructor with year TODO Listener TODO daysWithin = 7 TODO min, max
  • Field Details

  • Constructor Details

    • Week

      private Week(int week)
      Constructor.
      Parameters:
      week - Week 1-53
      Throws:
      IndexOutOfBoundsException - When the week is less than 1 or greater than 53
  • Method Details

    • of

      public static Week of(int week)
      Week factory.
      Parameters:
      week - Week 1-53
      Returns:
      Week object
    • of

      public static Week of(String value)
      Week factory.
      Parameters:
      value - Week 1-53 string
      Returns:
      Week object
    • intValue

      public int intValue()
      Returns the value of this Week 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 Week 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 Week. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Week[week=1]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this Week
      See Also:
    • compareTo

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

      public Week add(Weeks weeks)
      Add weeks to this week.
      Parameters:
      weeks - Weeks to add to this week
      Returns:
      New week after adding the weeks to this week
      Throws:
      ArithmeticException - In case of an overflow
    • subtract

      public Week subtract(Weeks weeks)
      Subtract weeks from this week.
      Parameters:
      weeks - Weeks to subtract from this week
      Returns:
      New week after subtracting weeks from this week
      Throws:
      ArithmeticException - In case of an underflow
    • increment

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

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