java.lang.Object
java.util.Calendar
com.aoapps.lang.util.UnmodifiableCalendar
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Calendar>
Wraps a Calendar to make it unmodifiable.
- Author:
- AO Industries, Inc.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.Calendar
Calendar.Builder
-
Field Summary
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(int field, int amount) boolean
boolean
clone()
int
protected void
complete()
protected void
protected void
boolean
int
get
(int field) int
getActualMaximum
(int field) int
getActualMinimum
(int field) getDisplayName
(int field, int style, Locale locale) getDisplayNames
(int field, int style, Locale locale) int
int
getGreatestMinimum
(int field) int
getLeastMaximum
(int field) int
getMaximum
(int field) int
int
getMinimum
(int field) long
int
hashCode()
boolean
isInstanceOf
(Class<? extends Calendar> clazz) Checks if the calendar is an instance of the given class or is a wrapper around an instance of the given class.static boolean
isInstanceOf
(Calendar cal, Class<? extends Calendar> clazz) Checks if the calendar is an instance of the given class or is a wrapper around an instance of the given class.boolean
void
roll
(int field, boolean up) void
roll
(int field, int amount) void
set
(int field, int value) void
setFirstDayOfWeek
(int value) void
setLenient
(boolean lenient) void
setMinimalDaysInFirstWeek
(int value) void
setTimeInMillis
(long millis) void
setTimeZone
(TimeZone value) toString()
static Calendar
unwrapClone
(Calendar cal) Unwraps and returns a modifiable clone of the given calendar.static UnmodifiableCalendar
Wraps the calendar if needed.Methods inherited from class java.util.Calendar
clear, clear, getAvailableCalendarTypes, getAvailableLocales, getCalendarType, getInstance, getInstance, getInstance, getInstance, getTime, getWeeksInWeekYear, getWeekYear, internalGet, isSet, isWeekDateSupported, set, set, set, setTime, setWeekDate, toInstant
-
Method Details
-
wrap
Wraps the calendar if needed. If null, null is returned. If already unmodifiable, parameter is returned without additional wrapping. -
unwrapClone
Unwraps and returns a modifiable clone of the given calendar. -
isInstanceOf
Checks if the calendar is an instance of the given class or is a wrapper around an instance of the given class. -
isInstanceOf
Checks if the calendar is an instance of the given class or is a wrapper around an instance of the given class. -
add
public void add(int field, int amount) -
after
-
before
-
clone
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Calendar>
- Overrides:
compareTo
in classCalendar
-
complete
protected void complete() -
computeFields
protected void computeFields()- Specified by:
computeFields
in classCalendar
-
computeTime
protected void computeTime()- Specified by:
computeTime
in classCalendar
-
equals
-
get
public int get(int field) -
getActualMaximum
public int getActualMaximum(int field) - Overrides:
getActualMaximum
in classCalendar
-
getActualMinimum
public int getActualMinimum(int field) - Overrides:
getActualMinimum
in classCalendar
-
getDisplayName
- Overrides:
getDisplayName
in classCalendar
-
getDisplayNames
- Overrides:
getDisplayNames
in classCalendar
-
getFirstDayOfWeek
public int getFirstDayOfWeek()- Overrides:
getFirstDayOfWeek
in classCalendar
-
getGreatestMinimum
public int getGreatestMinimum(int field) - Specified by:
getGreatestMinimum
in classCalendar
-
getLeastMaximum
public int getLeastMaximum(int field) - Specified by:
getLeastMaximum
in classCalendar
-
getMaximum
public int getMaximum(int field) - Specified by:
getMaximum
in classCalendar
-
getMinimalDaysInFirstWeek
public int getMinimalDaysInFirstWeek()- Overrides:
getMinimalDaysInFirstWeek
in classCalendar
-
getMinimum
public int getMinimum(int field) - Specified by:
getMinimum
in classCalendar
-
getTimeInMillis
public long getTimeInMillis()- Overrides:
getTimeInMillis
in classCalendar
-
getTimeZone
- Overrides:
getTimeZone
in classCalendar
-
hashCode
public int hashCode() -
isLenient
public boolean isLenient() -
roll
public void roll(int field, boolean up) -
roll
public void roll(int field, int amount) -
set
public void set(int field, int value) -
setFirstDayOfWeek
public void setFirstDayOfWeek(int value) - Overrides:
setFirstDayOfWeek
in classCalendar
-
setLenient
public void setLenient(boolean lenient) - Overrides:
setLenient
in classCalendar
-
setMinimalDaysInFirstWeek
public void setMinimalDaysInFirstWeek(int value) - Overrides:
setMinimalDaysInFirstWeek
in classCalendar
-
setTimeInMillis
public void setTimeInMillis(long millis) - Overrides:
setTimeInMillis
in classCalendar
-
setTimeZone
- Overrides:
setTimeZone
in classCalendar
-
toString
-