Klasse Time

Alle implementierten Schnittstellen:
IElement, ITime

public final class Time extends AbstractElement implements ITime
A Time is not mutable. Technically, a Time is a wrapper around a JDK's ZonedDateTime.
Version:
2016-09-01
Autor:
Silvan Wyss
  • Felddetails

    • DEFAULT_YEAR

      public static final int DEFAULT_YEAR
      Siehe auch:
    • DEFAULT_MONTH_OF_YEAR

      public static final int DEFAULT_MONTH_OF_YEAR
      Siehe auch:
    • DEFAULT_DAY_OF_MONTH

      public static final int DEFAULT_DAY_OF_MONTH
      Siehe auch:
    • DEFAULT_HOUR_OF_DAY

      public static final int DEFAULT_HOUR_OF_DAY
      Siehe auch:
    • DEFAULT_MINUTE_OF_HOUR

      public static final int DEFAULT_MINUTE_OF_HOUR
      Siehe auch:
    • DEFAULT_SECOND_OF_MINUTE

      public static final int DEFAULT_SECOND_OF_MINUTE
      Siehe auch:
    • DEFAULT_MILLISECOND_OF_SECOND

      public static final int DEFAULT_MILLISECOND_OF_SECOND
      Siehe auch:
    • DEFAULT_MICROSECOND_OF_MILLISECOND

      public static final int DEFAULT_MICROSECOND_OF_MILLISECOND
      Siehe auch:
  • Methodendetails

    • forZonedDateTime

      public static Time forZonedDateTime(ZonedDateTime zonedDateTime)
      Parameter:
      zonedDateTime -
      Gibt zurück:
      a new Time for the given zonedDateTime.
      Löst aus:
      ArgumentIsNullException - if the given zonedDateTime is null.
    • fromSpecification

      public static Time fromSpecification(INode<?> specification)
      Parameter:
      specification -
      Gibt zurück:
      a new Time from the given specification.
      Löst aus:
      NullPointerException - if the given specification is null.
      InvalidArgumentException - if the given specification does not represent a Time.
    • fromString

      public static Time fromString(String string)
      Parameter:
      string -
      Gibt zurück:
      a new Time from the given string.
      Löst aus:
      InvalidArgumentException - if the given string does not represent a Time.
    • ofNow

      public static Time ofNow()
      Gibt zurück:
      a new Time that represents the current time.
    • withYear

      public static Time withYear(int year)
      Parameter:
      year -
      Gibt zurück:
      a new Time with the given year.
    • withYearAndMonthOfYear

      public static Time withYearAndMonthOfYear(int year, int monthOfYear)
      Parameter:
      year -
      monthOfYear -
      Gibt zurück:
      a new Time with the given year and monthOfYear.
    • withYearAndMonthOfYearAndDayOfMonth

      public static Time withYearAndMonthOfYearAndDayOfMonth(int year, int monthOfYear, int dayOfMonth)
      Parameter:
      year -
      monthOfYear -
      dayOfMonth -
      Gibt zurück:
      a new Time with the given year, monthOfYear and dayOfMonth.
    • withYearAndMonthOfYearAndDayOfMonthAndHourOfDay

      public static Time withYearAndMonthOfYearAndDayOfMonthAndHourOfDay(int year, int monthOfYear, int dayOfMonth, int hourOfDay)
      Parameter:
      year -
      monthOfYear -
      dayOfMonth -
      hourOfDay -
      Gibt zurück:
      a new Time with the given year, monthOfYear, dayOfMonth and hourOfDay.
    • withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinOfHour

      public static Time withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinOfHour(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour)
      Parameter:
      year -
      monthOfYear -
      dayOfMonth -
      hourOfDay -
      minuteOfHour -
      Gibt zurück:
      a new Time with the given year, monthOfYear, dayOfMonth, hourOfDay and minuteOfHour.
    • withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinOfHourAndSecOfMin

      public static Time withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinOfHourAndSecOfMin(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute)
      Parameter:
      year -
      monthOfYear -
      dayOfMonth -
      hourOfDay -
      minuteOfHour -
      secondOfMinute -
      Gibt zurück:
      a new Time with the given year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour and secondOfMinute.
    • withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinOfHourAndSecOfMinAndMillisecOfSec

      public static Time withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinOfHourAndSecOfMinAndMillisecOfSec(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisecondOfSecond)
      Parameter:
      year -
      monthOfYear -
      dayOfMonth -
      hourOfDay -
      minuteOfHour -
      secondOfMinute -
      millisecondOfSecond -
      Gibt zurück:
      a new Time with the given year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute and millisecondOfSecond.
    • withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinOfHourAndSecOfMinAndMillisecOfSecAndMicrosecOfMillisec

      public static Time withYearAndMonthOfYearAndDayOfMonthAndHourOfDayAndMinOfHourAndSecOfMinAndMillisecOfSecAndMicrosecOfMillisec(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisecondOfSecond, int microsecondsOfMilliSecond)
      Parameter:
      year -
      monthOfYear -
      dayOfMonth -
      hourOfDay -
      minuteOfHour -
      secondOfMinute -
      millisecondOfSecond -
      microsecondsOfMilliSecond -
      Gibt zurück:
      a new Time with the given year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute and millisecondOfSecond.
    • getAttributes

      public IContainer<INode<?>> getAttributes()
      Angegeben von:
      getAttributes in Schnittstelle IElement
      Gibt zurück:
      the attributes of the current IElement.
    • getDayOfMonth

      public int getDayOfMonth()
      Angegeben von:
      getDayOfMonth in Schnittstelle ITime
      Gibt zurück:
      the day of the month of the current ITime.
    • getHourOfDay

      public int getHourOfDay()
      Angegeben von:
      getHourOfDay in Schnittstelle ITime
      Gibt zurück:
      the hour of the day of the current ITime.
    • getMicrosecondOfMillisecond

      public int getMicrosecondOfMillisecond()
      Angegeben von:
      getMicrosecondOfMillisecond in Schnittstelle ITime
      Gibt zurück:
      the microsecond of the millisecond of the current ITime.
    • getMillisecondOfSecond

      public int getMillisecondOfSecond()
      Angegeben von:
      getMillisecondOfSecond in Schnittstelle ITime
      Gibt zurück:
      the millisecond of the second of the current ITime.
    • getMinuteOfHour

      public int getMinuteOfHour()
      Angegeben von:
      getMinuteOfHour in Schnittstelle ITime
      Gibt zurück:
      the minute of the hour of the current ITime.
    • getMonthOfYear

      public Month getMonthOfYear()
      Angegeben von:
      getMonthOfYear in Schnittstelle ITime
      Gibt zurück:
      the month of the year of the current ITime.
    • getMonthOfYearAsInt

      public int getMonthOfYearAsInt()
      Angegeben von:
      getMonthOfYearAsInt in Schnittstelle ITime
      Gibt zurück:
      the month of the year of the current ITime as int.
    • getSecondOfMinute

      public int getSecondOfMinute()
      Angegeben von:
      getSecondOfMinute in Schnittstelle ITime
      Gibt zurück:
      the second of the minute of the current ITime.
    • getWeekday

      public Weekday getWeekday()
      Angegeben von:
      getWeekday in Schnittstelle ITime
      Gibt zurück:
      the weekday of the current ITime.
    • getYear

      public int getYear()
      Angegeben von:
      getYear in Schnittstelle ITime
      Gibt zurück:
      the year of the current ITime.
    • isAfter

      public boolean isAfter(ITime time)
      Angegeben von:
      isAfter in Schnittstelle ITime
      Parameter:
      time -
      Gibt zurück:
      true if the current ITime is after the given time, false otherwise
    • isBefore

      public boolean isBefore(ITime time)
      Angegeben von:
      isBefore in Schnittstelle ITime
      Parameter:
      time -
      Gibt zurück:
      true if the current ITime is before the given time, false otherwise
    • isInLeapYear

      public boolean isInLeapYear()
      Angegeben von:
      isInLeapYear in Schnittstelle ITime
      Gibt zurück:
      true if the current ITime is in a leap year.
    • toSeconds

      public long toSeconds()
      Angegeben von:
      toSeconds in Schnittstelle ITime
      Gibt zurück:
      the seconds of the current ITime.
    • withAddedOrSubtractedDays

      public Time withAddedOrSubtractedDays(int days)
      Angegeben von:
      withAddedOrSubtractedDays in Schnittstelle ITime
      Parameter:
      days -
      Gibt zurück:
      a new ITime with the given days added to or subtracted from the current ITime.
    • withAddedOrSubtractedHours

      public Time withAddedOrSubtractedHours(int hours)
      Angegeben von:
      withAddedOrSubtractedHours in Schnittstelle ITime
      Parameter:
      hours -
      Gibt zurück:
      a new ITime with the given hours added to or subtracted from the current ITime.
    • withAddedOrSubtractedMicroseconds

      public ITime withAddedOrSubtractedMicroseconds(long microseconds)
      Angegeben von:
      withAddedOrSubtractedMicroseconds in Schnittstelle ITime
      Parameter:
      microseconds -
      Gibt zurück:
      a new ITime with the given microseconds added to or subtracted from the current ITime.
    • withAddedOrSubtractedMilliseconds

      public Time withAddedOrSubtractedMilliseconds(int milliseconds)
      Angegeben von:
      withAddedOrSubtractedMilliseconds in Schnittstelle ITime
      Parameter:
      milliseconds -
      Gibt zurück:
      a new ITime with the given milliseconds added to or subtracted from to the current ITime.
    • withAddedOrSubtractedMinutes

      public Time withAddedOrSubtractedMinutes(int minutes)
      Angegeben von:
      withAddedOrSubtractedMinutes in Schnittstelle ITime
      Parameter:
      minutes -
      Gibt zurück:
      a new ITime with the given minutes added to or subtracted from the current ITime.
    • withAddedOrSubtractedSeconds

      public Time withAddedOrSubtractedSeconds(int seconds)
      Angegeben von:
      withAddedOrSubtractedSeconds in Schnittstelle ITime
      Parameter:
      seconds -
      Gibt zurück:
      a new ITime with the given seconds added to or subtracted from the current ITime.