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

public final class Day extends Object implements Comparable<Day>, IValueObject
Day. Not DSGVO relevant. TODO Constructor with day, month TODO Constructor with day, month, year TODO Listener TODO hoursWithin = 24 TODO min, max
  • Field Details

  • Constructor Details

    • Day

      private Day(int day)
      Constructor.
      Parameters:
      day - Day 1-31
      Throws:
      IndexOutOfBoundsException - When the day is less than 1 or greater than 31
  • Method Details

    • of

      public static Day of(int day)
      Day factory.
      Parameters:
      day - Day 1-31
      Returns:
      Day object
    • of

      public static Day of(String value)
      Day factory.
      Parameters:
      value - String value
      Returns:
      Day object
    • intValue

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

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

      public Day add(Days days)
      Add days to this day.
      Parameters:
      days - Days to add to this day
      Returns:
      New day after adding the days to this day
      Throws:
      ArithmeticException - In case of an overflow
    • subtract

      public Day subtract(Days days)
      Subtract days from this day.
      Parameters:
      days - Days to subtract from this day
      Returns:
      New day after subtracting days from this day
      Throws:
      ArithmeticException - In case of an underflow
    • increment

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

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