Class CalendarDuration

java.lang.Object
io.jmix.fullcalendarflowui.kit.component.model.CalendarDuration
All Implemented Interfaces:
Serializable

public class CalendarDuration extends Object implements Serializable
A time based object. Is used to pass time value, e.g. to properties (JmixFullCalendar.setSlotDuration(CalendarDuration) or to navigation methods (JmixFullCalendar.navigateToNext(CalendarDuration)).

Note that each property in this object does not include the units of the other properties. For instance, if the duration is 6 months, the year value will be 0, not 0.5. And vice-versa, if the duration is 1 year, the month value will be 0, not 12.

See Also:
  • Field Details

    • years

      protected int years
    • months

      protected int months
    • weeks

      protected int weeks
    • days

      protected int days
    • hours

      protected int hours
    • minutes

      protected int minutes
    • seconds

      protected long seconds
    • milliseconds

      protected long milliseconds
  • Method Details

    • ofYears

      public static CalendarDuration ofYears(int years)
      Creates a duration object from years.
      Parameters:
      years - years to pass
      Returns:
      new duration object
    • ofMonths

      public static CalendarDuration ofMonths(int months)
      Creates a duration object from months.
      Parameters:
      months - months to pass
      Returns:
      new duration object
    • ofWeeks

      public static CalendarDuration ofWeeks(int weeks)
      Creates a duration object from weeks.
      Parameters:
      weeks - weeks to pass
      Returns:
      new duration object
    • ofDays

      public static CalendarDuration ofDays(int days)
      Creates a duration object from days.
      Parameters:
      days - days to pass
      Returns:
      new duration object
    • ofHours

      public static CalendarDuration ofHours(int hours)
      Creates a duration object from hours.
      Parameters:
      hours - hours to pass
      Returns:
      new duration object
    • ofMinutes

      public static CalendarDuration ofMinutes(int minutes)
      Creates a duration object from minutes.
      Parameters:
      minutes - minutes to pass
      Returns:
      new duration object
    • ofSeconds

      public static CalendarDuration ofSeconds(long seconds)
      Creates a duration object from seconds.
      Parameters:
      seconds - seconds to pass
      Returns:
      new duration object
    • ofMilliseconds

      public static CalendarDuration ofMilliseconds(long ms)
      Creates a duration object from milliseconds.
      Parameters:
      ms - milliseconds to pass
      Returns:
      new duration object
    • ofDuration

      public static CalendarDuration ofDuration(Duration duration)
      Creates a new duration object from the provided Duration. The new object will contain the extracted days, along with the remaining hours, seconds, and milliseconds after the calculation.
      Parameters:
      duration - duration to pass
      Returns:
      new duration object
    • plusYears

      public CalendarDuration plusYears(int years)
      Returns a copy of this CalendarDuration with the specified number of years added.
      Parameters:
      years - years to add
      Returns:
      a CalendarDuration based on this duration with the years added
    • minusYears

      public CalendarDuration minusYears(int years)
      Returns a copy of this CalendarDuration with the specified number of years subtracted.
      Parameters:
      years - years to subtract
      Returns:
      a CalendarDuration based on this duration with the years subtracted
    • plusMonths

      public CalendarDuration plusMonths(int months)
      Returns a copy of this CalendarDuration with the specified number of months added.
      Parameters:
      months - months to add
      Returns:
      a CalendarDuration based on this duration with the months added
    • minusMonths

      public CalendarDuration minusMonths(int months)
      Returns a copy of this CalendarDuration with the specified number of months subtracted.
      Parameters:
      months - months to subtract
      Returns:
      a CalendarDuration based on this duration with the months subtracted
    • plusWeeks

      public CalendarDuration plusWeeks(int weeks)
      Returns a copy of this CalendarDuration with the specified number of weeks added.
      Parameters:
      weeks - weeks to add
      Returns:
      a CalendarDuration based on this duration with the weeks added
    • minusWeeks

      public CalendarDuration minusWeeks(int weeks)
      Returns a copy of this CalendarDuration with the specified number of weeks subtracted.
      Parameters:
      weeks - weeks to subtract
      Returns:
      a CalendarDuration based on this duration with the weeks subtracted
    • plusDays

      public CalendarDuration plusDays(int days)
      Returns a copy of this CalendarDuration with the specified number of days added.
      Parameters:
      days - days to add
      Returns:
      a CalendarDuration based on this duration with the days added
    • minusDays

      public CalendarDuration minusDays(int days)
      Returns a copy of this CalendarDuration with the specified number of days subtracted.
      Parameters:
      days - days to subtract
      Returns:
      a CalendarDuration based on this duration with the days subtracted
    • plusHours

      public CalendarDuration plusHours(int hours)
      Returns a copy of this CalendarDuration with the specified number of hours added.
      Parameters:
      hours - hours to add
      Returns:
      a CalendarDuration based on this duration with the hours added
    • minusHours

      public CalendarDuration minusHours(int hours)
      Returns a copy of this CalendarDuration with the specified number of hours subtracted.
      Parameters:
      hours - hours to subtract
      Returns:
      a CalendarDuration based on this duration with the hours subtracted
    • plusMinutes

      public CalendarDuration plusMinutes(int minutes)
      Returns a copy of this CalendarDuration with the specified number of minutes added.
      Parameters:
      minutes - minutes to add
      Returns:
      a CalendarDuration based on this duration with the minutes added
    • minusMinutes

      public CalendarDuration minusMinutes(int minutes)
      Returns a copy of this CalendarDuration with the specified number of minutes subtracted.
      Parameters:
      minutes - minutes to subtract
      Returns:
      a CalendarDuration based on this duration with the minutes subtracted
    • plusSeconds

      public CalendarDuration plusSeconds(long seconds)
      Returns a copy of this CalendarDuration with the specified number of seconds added.
      Parameters:
      seconds - seconds to add
      Returns:
      a CalendarDuration based on this duration with the seconds added
    • minusSeconds

      public CalendarDuration minusSeconds(long seconds)
      Returns a copy of this CalendarDuration with the specified number of seconds subtracted.
      Parameters:
      seconds - seconds to subtract
      Returns:
      a CalendarDuration based on this duration with the seconds subtracted
    • plusMilliseconds

      public CalendarDuration plusMilliseconds(long milliseconds)
      Returns a copy of this CalendarDuration with the specified number of milliseconds added.
      Parameters:
      milliseconds - milliseconds to add
      Returns:
      a CalendarDuration based on this duration with the milliseconds added
    • minusMilliseconds

      public CalendarDuration minusMilliseconds(long milliseconds)
      Returns a copy of this CalendarDuration with the specified number of milliseconds subtracted.
      Parameters:
      milliseconds - milliseconds to subtract
      Returns:
      a CalendarDuration based on this duration with the milliseconds subtracted
    • getYears

      public int getYears()
      Returns:
      years field
    • getMonths

      public int getMonths()
      Returns:
      months field
    • getWeeks

      public int getWeeks()
      Returns:
      weeks field
    • getDays

      public int getDays()
      Returns:
      days field
    • getHours

      public int getHours()
      Returns:
      hours field
    • getMinutes

      public int getMinutes()
      Returns:
      minutes field
    • getSeconds

      public long getSeconds()
      Returns:
      seconds field
    • getMilliseconds

      public long getMilliseconds()
      Returns:
      milliseconds field
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object