Class Millisecond

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

public final class Millisecond extends Object implements Comparable<Millisecond>, IValueObject
Millisecond. Not DSGVO relevant. TODO Listener TODO min, max
  • Field Details

  • Constructor Details

    • Millisecond

      private Millisecond(int millisecond)
      Constructor.
      Parameters:
      millisecond - Millisecond 0-999
      Throws:
      IndexOutOfBoundsException - When the milliseond is less than 0 or greater than 999
  • Method Details

    • of

      public static Millisecond of(int millisecond)
      Millisecond factory.
      Parameters:
      millisecond - Millisecond 0-999
      Returns:
      Millisecond object
    • of

      public static Millisecond of(String value)
      Millisecond factory.
      Parameters:
      value - Millisecond string 0-999
      Returns:
      Millisecond object
    • intValue

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

      public String stringValue()
      Returns the value of this Millisecond as an String.
      Specified by:
      stringValue in interface IValueObject
      Returns:
      The numeric value represented by this object after conversion to type String (0-999).
    • 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 Millisecond. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Millisecond[millisecond=0]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this Millisecond
      See Also:
    • compareTo

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

      public Millisecond add(Milliseconds milliseconds)
      Add milliseconds to this millisecond.
      Parameters:
      milliseconds - Milliseconds to add to this millisecond
      Returns:
      New millisecond after adding the milliseconds to this millisecond
      Throws:
      ArithmeticException - In case of an overflow
    • subtract

      public Millisecond subtract(Milliseconds milliseconds)
      Subtract milliseconds from this millisecond.
      Parameters:
      milliseconds - Milliseconds to subtract from this millisecond
      Returns:
      New millisecond after subtracting milliseconds from this millisecond
      Throws:
      ArithmeticException - In case of an underflow
    • increment

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

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