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

public final class Second extends Object implements Comparable<Second>, IValueObject
Second. Not DSGVO relevant. TODO Constructor with day, month, year, hour, minute TODO Listener (mod 60 = 0) TODO millisecondsWithin = 1000 TODO min, max
  • Field Details

  • Constructor Details

    • Second

      private Second(int second)
      Constructor.
      Parameters:
      second - Second 0-59/60
      Throws:
      IndexOutOfBoundsException - When the second is less than 0 or greater than 59/60
  • Method Details

    • of

      public static Second of(int second)
      Second factory.
      Parameters:
      second - Second 0-59/60
      Returns:
      Second object
    • of

      public static Second of(String value)
      Second factory.
      Parameters:
      value - Second 0-59/60 string
      Returns:
      Second object
    • intValue

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

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

      public Second add(Seconds seconds)
      Add seconds to this second.
      Parameters:
      seconds - Secondss to add to this second
      Returns:
      New second after adding the seconds to this second
      Throws:
      ArithmeticException - In case of an overflow
    • subtract

      public Second subtract(Seconds seconds)
      Subtract seconds from this second.
      Parameters:
      seconds - Seconds to subtract from this second
      Returns:
      New second after subtracting seconds from this second
      Throws:
      ArithmeticException - In case of an underflow
    • increment

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

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