Package org.opennms.core.time
Class ZonedDateTimeBuilder
- java.lang.Object
-
- org.opennms.core.time.ZonedDateTimeBuilder
-
public class ZonedDateTimeBuilder extends 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.Integer
getDayOfMonth()
Integer
getHourOfDay()
Integer
getMinute()
Integer
getMonth()
Integer
getNanosecond()
Integer
getSecond()
Integer
getYear()
java.time.ZoneId
getZoneId()
static java.time.ZoneId
parseZoneId(String value)
Convert a time zone String into a ZoneId.void
setDayOfMonth(Integer dayOfMonth)
void
setHourOfDay(Integer hourOfDay)
void
setMinute(Integer minute)
void
setMonth(Integer month)
void
setNanosecond(Integer nanosecond)
void
setSecond(Integer second)
void
setYear(Integer year)
void
setZoneId(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 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:
-
-