Package org.opennms.core.time
Class ZonedDateTimeBuilder
- java.lang.Object
-
- org.opennms.core.time.ZonedDateTimeBuilder
-
public class ZonedDateTimeBuilder extends java.lang.Object
This is basically aCalendar.Builder
replacement that builds Java 8ZonedDateTime
instances.- 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.ZonedDateTime
build()
Build theZonedDateTime
instance.protected java.time.ZoneId
getBestZoneId()
Return the specified ZoneId orZoneId.systemDefault()
if none has been specified.java.lang.Integer
getDayOfMonth()
java.lang.Integer
getHourOfDay()
java.lang.Integer
getMinute()
java.lang.Integer
getMonth()
java.lang.Integer
getNanosecond()
java.lang.Integer
getSecond()
java.lang.Integer
getYear()
java.time.ZoneId
getZoneId()
static java.time.ZoneId
parseZoneId(java.lang.String value)
Convert a time zone String into a ZoneId.void
setDayOfMonth(java.lang.Integer dayOfMonth)
void
setHourOfDay(java.lang.Integer hourOfDay)
void
setMinute(java.lang.Integer minute)
void
setMonth(java.lang.Integer month)
void
setNanosecond(java.lang.Integer nanosecond)
void
setSecond(java.lang.Integer second)
void
setYear(java.lang.Integer year)
void
setZoneId(java.time.ZoneId timeZone)
-
-
-
Method Detail
-
parseZoneId
public static java.time.ZoneId parseZoneId(java.lang.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 java.lang.Integer getYear()
-
setYear
public void setYear(java.lang.Integer year)
-
getMonth
public java.lang.Integer getMonth()
-
setMonth
public void setMonth(java.lang.Integer month)
-
getDayOfMonth
public java.lang.Integer getDayOfMonth()
-
setDayOfMonth
public void setDayOfMonth(java.lang.Integer dayOfMonth)
-
getHourOfDay
public java.lang.Integer getHourOfDay()
-
setHourOfDay
public void setHourOfDay(java.lang.Integer hourOfDay)
-
getMinute
public java.lang.Integer getMinute()
-
setMinute
public void setMinute(java.lang.Integer minute)
-
getSecond
public java.lang.Integer getSecond()
-
setSecond
public void setSecond(java.lang.Integer second)
-
getNanosecond
public java.lang.Integer getNanosecond()
-
setNanosecond
public void setNanosecond(java.lang.Integer nanosecond)
-
getZoneId
public java.time.ZoneId getZoneId()
-
setZoneId
public void setZoneId(java.time.ZoneId timeZone)
-
build
public java.time.ZonedDateTime build()
Build theZonedDateTime
instance. 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:
-
-