Package org.opennms.core.time
Class ZonedDateTimeBuilder
- java.lang.Object
-
- org.opennms.core.time.ZonedDateTimeBuilder
-
public class ZonedDateTimeBuilder extends Object
This is basically aCalendar.Builderreplacement that builds Java 8ZonedDateTimeinstances.- Author:
- Seth
-
-
Constructor Summary
Constructors Constructor Description ZonedDateTimeBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.time.ZonedDateTimebuild()Build theZonedDateTimeinstance.protected java.time.ZoneIdgetBestZoneId()Return the specified ZoneId orZoneId.systemDefault()if none has been specified.IntegergetDayOfMonth()IntegergetHourOfDay()IntegergetMinute()IntegergetMonth()IntegergetNanosecond()IntegergetSecond()IntegergetYear()java.time.ZoneIdgetZoneId()static java.time.ZoneIdparseZoneId(String value)Convert a time zone String into a ZoneId.voidsetDayOfMonth(Integer dayOfMonth)voidsetHourOfDay(Integer hourOfDay)voidsetMinute(Integer minute)voidsetMonth(Integer month)voidsetNanosecond(Integer nanosecond)voidsetSecond(Integer second)voidsetYear(Integer year)voidsetZoneId(java.time.ZoneId timeZone)
-
-
-
Method Detail
-
parseZoneId
public static java.time.ZoneId parseZoneId(String value)
Convert a time zone String into a ZoneId. This will work with all standard ZoneId types, plus a mostly-exhaustive list of 3-letter offset abbreviations.
-
getYear
public Integer getYear()
-
setYear
public void setYear(Integer year)
-
getMonth
public Integer getMonth()
-
setMonth
public void setMonth(Integer month)
-
getDayOfMonth
public Integer getDayOfMonth()
-
setDayOfMonth
public void setDayOfMonth(Integer dayOfMonth)
-
getHourOfDay
public Integer getHourOfDay()
-
setHourOfDay
public void setHourOfDay(Integer hourOfDay)
-
getMinute
public Integer getMinute()
-
setMinute
public void setMinute(Integer minute)
-
getSecond
public Integer getSecond()
-
setSecond
public void setSecond(Integer second)
-
getNanosecond
public Integer getNanosecond()
-
setNanosecond
public void setNanosecond(Integer nanosecond)
-
getZoneId
public java.time.ZoneId getZoneId()
-
setZoneId
public void setZoneId(java.time.ZoneId timeZone)
-
build
public java.time.ZonedDateTime build()
Build theZonedDateTimeinstance. The following fields are required to generate a datestamp:- month
- dayOfMonth
If missing:
- year will be assumed to be within the last 12 months or slightly in the future (if the current month is December)
- hourOfDay, minute, second and nanosecond will be assumed to be zero
- time zone will be assumed to be the system time zone
(
ZoneId.systemDefault())
- Returns:
-
getBestZoneId
protected java.time.ZoneId getBestZoneId()
Return the specified ZoneId orZoneId.systemDefault()if none has been specified.- Returns:
-
-