Class Duration

  • All Implemented Interfaces:
    java.io.Serializable

    public class Duration
    extends java.lang.Object
    implements java.io.Serializable
    This class represents a duration in time.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Duration​(int seconds)
      Create a Duration instance from a number of seconds.
      Duration​(java.lang.String durationString)
      Create a Duration instance from a human readable string.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static Duration forValue​(java.lang.String value)  
      int getSeconds()
      Get the number of seconds this duration represents.
      void setSeconds​(int seconds)
      Set the number of seconds this duration represents.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Duration

        public Duration​(java.lang.String durationString)
        Create a Duration instance from a human readable string. e.g: 3h30m
        Parameters:
        durationString - a duration in human readable format
      • Duration

        public Duration​(int seconds)
        Create a Duration instance from a number of seconds.
        Parameters:
        seconds - the number of seconds for this Duration instance to represent
    • Method Detail

      • getSeconds

        public int getSeconds()
        Get the number of seconds this duration represents.
        Returns:
        the number of seconds this duration represents
      • setSeconds

        public void setSeconds​(int seconds)
        Set the number of seconds this duration represents.
        Parameters:
        seconds - the number of seconds this duration represents
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • forValue

        public static Duration forValue​(java.lang.String value)