Class RollingCalendar
java.lang.Object
java.util.Calendar
java.util.GregorianCalendar
ch.qos.logback.core.rolling.helper.RollingCalendar
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Calendar>
RollingCalendar is a helper class to
TimeBasedRollingPolicy
or similar
timed-based rolling policies. Given a periodicity type and the current time,
it computes the start of the next interval (i.e. the triggering date).- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.Calendar
Calendar.Builder
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) String
(package private) static final TimeZone
(package private) PeriodicityType
private static final long
Fields inherited from class java.util.GregorianCalendar
AD, BC
Fields inherited from class java.util.Calendar
ALL_STYLES, AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, fields, FRIDAY, HOUR, HOUR_OF_DAY, isSet, isTimeSet, JANUARY, JULY, JUNE, LONG, LONG_FORMAT, LONG_STANDALONE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NARROW_FORMAT, NARROW_STANDALONE, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SHORT, SHORT_FORMAT, SHORT_STANDALONE, SUNDAY, THURSDAY, time, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET
-
Constructor Summary
ConstructorsConstructorDescriptionRollingCalendar
(String datePattern) RollingCalendar
(String datePattern, TimeZone tz, Locale locale) -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
collision
(long delta) static int
diffInMonths
(long startTime, long endTime) getEndOfNextNthPeriod
(Date now, int periods) long
getStartOfCurrentPeriodWithGMTOffsetCorrection
(long now, TimeZone timezone) private static Date
innerGetEndOfNextNthPeriod
(Calendar cal, PeriodicityType periodicityType, Date now, int numPeriods) private static Date
innerGetEndOfThisPeriod
(Calendar cal, PeriodicityType periodicityType, Date now) boolean
long
periodBarriersCrossed
(long start, long end) void
Methods inherited from class java.util.GregorianCalendar
add, clone, computeFields, computeTime, equals, from, getActualMaximum, getActualMinimum, getCalendarType, getGreatestMinimum, getGregorianChange, getLeastMaximum, getMaximum, getMinimum, getTimeZone, getWeeksInWeekYear, getWeekYear, hashCode, isLeapYear, isWeekDateSupported, roll, roll, setGregorianChange, setTimeZone, setWeekDate, toZonedDateTime
Methods inherited from class java.util.Calendar
after, before, clear, clear, compareTo, complete, get, getAvailableCalendarTypes, getAvailableLocales, getDisplayName, getDisplayNames, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis, toInstant, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
GMT_TIMEZONE
-
periodicityType
PeriodicityType periodicityType -
datePattern
String datePattern
-
-
Constructor Details
-
RollingCalendar
-
RollingCalendar
-
-
Method Details
-
getPeriodicityType
-
computePeriodicityType
-
isCollisionFree
public boolean isCollisionFree() -
collision
private boolean collision(long delta) -
printPeriodicity
-
periodBarriersCrossed
public long periodBarriersCrossed(long start, long end) -
diffInMonths
public static int diffInMonths(long startTime, long endTime) -
innerGetEndOfThisPeriod
private static Date innerGetEndOfThisPeriod(Calendar cal, PeriodicityType periodicityType, Date now) -
innerGetEndOfNextNthPeriod
private static Date innerGetEndOfNextNthPeriod(Calendar cal, PeriodicityType periodicityType, Date now, int numPeriods) -
getEndOfNextNthPeriod
-
getNextTriggeringDate
-
getStartOfCurrentPeriodWithGMTOffsetCorrection
-