FnCalendar is a function hub class containing a lot of static methods to work with Calendar objects. Those static methods return functions that take a Calendar object as its input or output (depending on the function). It includes conversions to String, to Calendar and adding days to a Calendar among others.
Function name | Type | Params | Description |
---|---|---|---|
add | Function<Calendar,Calendar> | int calendarField int amount | Modifies a Calendar by adding a positive or negative amount to one of its fields. Fields are specified by means of java.util.Calendar constants, like FnCalendar.add(Calendar.DAY_OF_MONTH, 1). |
addDays | Function<Calendar,Calendar> | int amount | Modifies a Calendar by adding a positive or negative amount to one the "day" property (java.util.Calendar.DATE). |
addHours | Function<Calendar,Calendar> | int amount | Modifies a Calendar by adding a positive or negative amount to one the "hour" property (java.util.Calendar.HOUR). |
addMilliseconds | Function<Calendar,Calendar> | int amount | Modifies a Calendar by adding a positive or negative amount to one the "millisecond" property (java.util.Calendar.MILLISECOND). |
addMinutes | Function<Calendar,Calendar> | int amount | Modifies a Calendar by adding a positive or negative amount to one the "minute" property (java.util.Calendar.MINUTE). |
addMonths | Function<Calendar,Calendar> | int amount | Modifies a Calendar by adding a positive or negative amount to one the "month" property (java.util.Calendar.MONTH). |
addWeeks | Function<Calendar,Calendar> | int amount | Modifies a Calendar by adding a positive or negative amount to one the "week" property (java.util.Calendar.WEEK_OF_YEAR). |
addYears | Function<Calendar,Calendar> | int amount | Modifies a Calendar by adding a positive or negative amount to one the "year" property (java.util.Calendar.YEAR). |
after | Function<Calendar,Boolean> | Calendar calendar | Determines whether the target Calendar represents a moment in time after the Calendar specified as a parameter. |
before | Function<Calendar,Boolean> | Calendar calendar | Determines whether the target Calendar represents a moment in time before the Calendar specified as a parameter. |
eq | Function<Object,Boolean> | Calendar object | Determines whether the target object and the specified object are equal by calling the equals method on the target object. |
fieldIntegerArrayToCalendar | Function<Integer[], Calendar> | Converts an Integer[] containing the components of a date to a java.util.Calendar object. The target array can contain the following combinations of elements, in the specified order:
| |
fieldIntegerListToCalendar | Function<List<Integer>, Calendar> | Converts a List<Integer> containing the components of a date to a java.util.Calendar object. The target list can contain the following combinations of elements, in the specified order:
| |
fieldStringArrayToCalendar | Function<String[], Calendar> | Converts a String[] containing the components of a date to a java.util.Calendar object. The target array can contain the following combinations of elements, all of them in numeric format, in the specified order:
| |
fieldStringListToCalendar | Function<List<String>, Calendar> | Converts a List<String> containing the components of a date to a java.util.Calendar object. The target list can contain the following combinations of elements, all of them in numeric format, in the specified order:
| |
isNotNull | Function<Object,Boolean> | Determines whether the target object is null or not. | |
isNull | Function<Object,Boolean> | Determines whether the target object is null or not. | |
notEq | Function<Object,Boolean> | Calendar object | Determines whether the target object and the specified object are NOT equal by calling the equals method on the target object. |
round | Function<Calendar,Calendar> | int calendarField | Rounds the target Calendar, setting the specified field as the most significant field. Based on org.apache.commons.lang.time.DateUtils.round(). |
set | Function<Calendar,Calendar> | int calendarField int value | Modifies a Calendar by setting one of its to the specified value. Fields are specified by means of java.util.Calendar constants, like FnCalendar.set(Calendar.DAY_OF_MONTH, 12). |
setDay | Function<Calendar,Calendar> | int value | Modifies a Calendar by setting the "day" property (java.util.Calendar.DATE) to the specified value. |
setHour | Function<Calendar,Calendar> | int value | Modifies a Calendar by setting the "hour" property (java.util.Calendar.HOUR) to the specified value. |
setMillisecond | Function<Calendar,Calendar> | int value | Modifies a Calendar by setting the "millisecond" property (java.util.Calendar.MILLISECOND) to the specified value. |
setMinute | Function<Calendar,Calendar> | int value | Modifies a Calendar by setting the "minute" property (java.util.Calendar.MINUTE) to the specified value. |
setMonth | Function<Calendar,Calendar> | int value | Modifies a Calendar by setting the "month" property (java.util.Calendar.MONTH) to the specified value. |
setWeek | Function<Calendar,Calendar> | int value | Modifies a Calendar by setting the "week" property (java.util.Calendar.WEEK_OF_YEAR) to the specified value. |
setYear | Function<Calendar,Calendar> | int value | Modifies a Calendar by setting the "year" property (java.util.Calendar.YEAR) to the specified value. |
timeInMillisToCalendar | Function<Long,Calendar> | Converts the target Long (representing a time in milliseconds) into a Calendar. | |
timeInMillisToCalendar | Function<Long,Calendar> | int truncateField | Converts the target Long (representing a time in milliseconds) into a Calendar, truncating by the specified field (java.util.Calendar constant field). |
timestampToCalendar | Function<Timestamp,Calendar> | Converts the target java.sql.Timestamp into a Calendar. | |
timestampToCalendar | Function<Timestamp,Calendar> | int truncateField | Converts the target java.sql.Timestamp into a Calendar, truncating by the specified field (java.util.Calendar constant field). |
toStr | Function<Calendar,String> | String pattern | Converts the target Calendar into a String using the specified pattern. The pattern has to be written in the java.text.SimpleDateFormat format. As no locale is specified, if pattern includes locale-dependent texts like month names (MMM) or week days (EEE), the default locale will be used for resolving these components. |
toStr | Function<Calendar,String> | String pattern Locale locale | Converts the target Calendar into a String using the specified pattern. The pattern has to be written in the java.text.SimpleDateFormat format, and the specified locale will be used for text-based pattern components (like month names or week days). |
toStr | Function<Calendar,String> | String pattern String locale | Converts the target Calendar into a String using the specified pattern. The pattern has to be written in the java.text.SimpleDateFormat format, and the specified locale will be used for text-based pattern components (like month names or week days). |
toStr | Function<Calendar,String> | DateStyle dateStyle TimeStyle timeStyle | Converts the target Calendar into a String using the specified date ( DateStyle) and time ( TimeStyle) styles. |
toStr | Function<Calendar,String> | DateStyle dateStyle TimeStyle timeStyle Locale locale | Converts the target Calendar into a String using the specified date ( DateStyle) and time ( TimeStyle) styles, and resolving text-based components like month names using the specified locale. |
toStr | Function<Calendar,String> | DateStyle dateStyle TimeStyle timeStyle String locale | Converts the target Calendar into a String using the specified date ( DateStyle) and time ( TimeStyle) styles, and resolving text-based components like month names using the specified locale. |
truncate | Function<Calendar,Calendar> | int calendarField | Truncates the target Calendar, setting the specified field as the most significant field. Based on org.apache.commons.lang.time.DateUtils.truncate(). |