|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.op4j.functions.FnCalendar
public final class FnCalendar
Method Summary | |
---|---|
static Function<Calendar,Calendar> |
add(int calendarField,
int amount)
Modifies a Calendar by adding a positive or negative amount to one of its fields. |
static Function<Calendar,Calendar> |
addDays(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "day" property (java.util.Calendar.DATE). |
static Function<Calendar,Calendar> |
addHours(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "hour" property (java.util.Calendar.HOUR). |
static Function<Calendar,Calendar> |
addMilliseconds(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "millisecond" property (java.util.Calendar.MILLISECOND). |
static Function<Calendar,Calendar> |
addMinutes(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "minute" property (java.util.Calendar.MINUTE). |
static Function<Calendar,Calendar> |
addMonths(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "month" property (java.util.Calendar.MONTH). |
static Function<Calendar,Calendar> |
addWeeks(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "week" property (java.util.Calendar.WEEK_OF_YEAR). |
static Function<Calendar,Calendar> |
addYears(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "year" property (java.util.Calendar.YEAR). |
static Function<Calendar,Boolean> |
after(Calendar calendar)
Determines whether the target Calendar represents a moment in time after the Calendar specified as a parameter. |
static Function<Calendar,Boolean> |
before(Calendar calendar)
Determines whether the target Calendar represents a moment in time before the Calendar specified as a parameter. |
static Function<Object,Boolean> |
eq(Calendar object)
Determines whether the target object and the specified object are equal by calling the equals method on the target object. |
static Function<Integer[],Calendar> |
fieldIntegerArrayToCalendar()
Converts an Integer[] containing the components of a date to a java.util.Calendar object. |
static Function<List<Integer>,Calendar> |
fieldIntegerListToCalendar()
Converts a List<Integer> containing the components of a date to a java.util.Calendar object. |
static Function<String[],Calendar> |
fieldStringArrayToCalendar()
Converts a String[] containing the components of a date to a java.util.Calendar object. |
static Function<List<String>,Calendar> |
fieldStringListToCalendar()
Converts a List<String> containing the components of a date to a java.util.Calendar object. |
protected static Calendar |
fromInts(Integer year,
Integer month,
Integer day,
Integer hour,
Integer minute,
Integer second,
Integer milli)
|
static Function<Object,Boolean> |
isNotNull()
Determines whether the target object is null or not. |
static Function<Object,Boolean> |
isNull()
Determines whether the target object is null or not. |
static Function<Object,Boolean> |
notEq(Calendar object)
Determines whether the target object and the specified object are NOT equal by calling the equals method on the target object. |
static Function<Calendar,Calendar> |
round(int calendarField)
Rounds the target Calendar, setting the specified field as the most significant field. |
static Function<Calendar,Calendar> |
set(int calendarField,
int value)
Modifies a Calendar by setting one of its to the specified value. |
static Function<Calendar,Calendar> |
setDay(int value)
Modifies a Calendar by setting the "day" property (java.util.Calendar.DATE) to the specified value. |
static Function<Calendar,Calendar> |
setHour(int value)
Modifies a Calendar by setting the "hour" property (java.util.Calendar.HOUR) to the specified value. |
static Function<Calendar,Calendar> |
setMillisecond(int value)
Modifies a Calendar by setting the "millisecond" property (java.util.Calendar.MILLISECOND) to the specified value. |
static Function<Calendar,Calendar> |
setMinute(int value)
Modifies a Calendar by setting the "minute" property (java.util.Calendar.MINUTE) to the specified value. |
static Function<Calendar,Calendar> |
setMonth(int value)
Modifies a Calendar by setting the "month" property (java.util.Calendar.MONTH) to the specified value. |
static Function<Calendar,Calendar> |
setWeek(int value)
Modifies a Calendar by setting the "week" property (java.util.Calendar.WEEK_OF_YEAR) to the specified value. |
static Function<Calendar,Calendar> |
setYear(int value)
Modifies a Calendar by setting the "year" property (java.util.Calendar.YEAR) to the specified value. |
static Function<Long,Calendar> |
timeInMillisToCalendar()
Converts the target Long (representing a time in milliseconds) into a Calendar. |
static Function<Long,Calendar> |
timeInMillisToCalendar(int truncateField)
Converts the target Long (representing a time in milliseconds) into a Calendar, truncating by the specified field (java.util.Calendar constant field). |
static Function<Timestamp,Calendar> |
timestampToCalendar()
Converts the target java.sql.Timestamp into a Calendar. |
static Function<Timestamp,Calendar> |
timestampToCalendar(int truncateField)
Converts the target java.sql.Timestamp into a Calendar, truncating by the specified field (java.util.Calendar constant field). |
static Function<Calendar,String> |
toStr(DateStyle dateStyle,
TimeStyle timeStyle)
Converts the target Calendar into a String using the specified date ( DateStyle )
and time (TimeStyle ) styles. |
static Function<Calendar,String> |
toStr(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. |
static Function<Calendar,String> |
toStr(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. |
static Function<Calendar,String> |
toStr(String pattern)
Converts the target Calendar into a String using the specified pattern. |
static Function<Calendar,String> |
toStr(String pattern,
Locale locale)
Converts the target Calendar into a String using the specified pattern. |
static Function<Calendar,String> |
toStr(String pattern,
String locale)
Converts the target Calendar into a String using the specified pattern. |
static Function<Calendar,Calendar> |
truncate(int calendarField)
Truncates the target Calendar, setting the specified field as the most significant field. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final Function<Calendar,Calendar> add(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).
calendarField
- the field that will be modified (java.util.Calendar constant).amount
- the positive or negative amount to be added
public static final Function<Calendar,Calendar> addDays(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "day" property (java.util.Calendar.DATE).
amount
- the positive or negative amount to be added
public static final Function<Calendar,Calendar> addHours(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "hour" property (java.util.Calendar.HOUR).
amount
- the positive or negative amount to be added
public static final Function<Calendar,Calendar> addMilliseconds(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "millisecond" property (java.util.Calendar.MILLISECOND).
amount
- the positive or negative amount to be added
public static final Function<Calendar,Calendar> addMinutes(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "minute" property (java.util.Calendar.MINUTE).
amount
- the positive or negative amount to be added
public static final Function<Calendar,Calendar> addMonths(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "month" property (java.util.Calendar.MONTH).
amount
- the positive or negative amount to be added
public static final Function<Calendar,Calendar> addWeeks(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "week" property (java.util.Calendar.WEEK_OF_YEAR).
amount
- the positive or negative amount to be added
public static final Function<Calendar,Calendar> addYears(int amount)
Modifies a Calendar by adding a positive or negative amount to one the "year" property (java.util.Calendar.YEAR).
amount
- the positive or negative amount to be added
public static final Function<Calendar,Calendar> set(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).
calendarField
- the field that will be modified (java.util.Calendar constant).value
- the new value
public static final Function<Calendar,Calendar> setDay(int value)
Modifies a Calendar by setting the "day" property (java.util.Calendar.DATE) to the specified value.
value
- the new value for the property
public static final Function<Calendar,Calendar> setHour(int value)
Modifies a Calendar by setting the "hour" property (java.util.Calendar.HOUR) to the specified value.
value
- the new value for the property
public static final Function<Calendar,Calendar> setMillisecond(int value)
Modifies a Calendar by setting the "millisecond" property (java.util.Calendar.MILLISECOND) to the specified value.
value
- the new value for the property
public static final Function<Calendar,Calendar> setMinute(int value)
Modifies a Calendar by setting the "minute" property (java.util.Calendar.MINUTE) to the specified value.
value
- the new value for the property
public static final Function<Calendar,Calendar> setMonth(int value)
Modifies a Calendar by setting the "month" property (java.util.Calendar.MONTH) to the specified value.
value
- the new value for the property
public static final Function<Calendar,Calendar> setWeek(int value)
Modifies a Calendar by setting the "week" property (java.util.Calendar.WEEK_OF_YEAR) to the specified value.
value
- the new value for the property
public static final Function<Calendar,Calendar> setYear(int value)
Modifies a Calendar by setting the "year" property (java.util.Calendar.YEAR) to the specified value.
value
- the new value for the property
public static final Function<Calendar,Calendar> round(int calendarField)
Rounds the target Calendar, setting the specified field as the most significant field.
Based on org.apache.commons.lang.time.DateUtils.round().
calendarField
- the field on which the calendar will be rounded (java.util.Calendar field).
public static final Function<Calendar,Calendar> truncate(int calendarField)
Truncates the target Calendar, setting the specified field as the most significant field.
Based on org.apache.commons.lang.time.DateUtils.truncate().
calendarField
- the field on which the calendar will be truncated (java.util.Calendar field).
public static final Function<Calendar,Boolean> before(Calendar calendar)
Determines whether the target Calendar represents a moment in time before the Calendar specified as a parameter.
calendar
- the calendar to compare to
public static final Function<Calendar,Boolean> after(Calendar calendar)
Determines whether the target Calendar represents a moment in time after the Calendar specified as a parameter.
calendar
- the calendar to compare to
public static final Function<Calendar,String> toStr(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.
pattern
- the pattern to be used, as specified by java.text.SimpleDateFormat.
public static final Function<Calendar,String> toStr(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).
pattern
- the pattern to be used, as specified by java.text.SimpleDateFormat.locale
- the locale to be used for text-based pattern components
public static final Function<Calendar,String> toStr(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).
pattern
- the pattern to be used, as specified by java.text.SimpleDateFormat.locale
- the locale to be used for text-based pattern components
public static final Function<Calendar,String> toStr(DateStyle dateStyle, TimeStyle timeStyle)
Converts the target Calendar into a String using the specified date (DateStyle
)
and time (TimeStyle
) styles.
dateStyle
- the date style to be usedtimeStyle
- the time style to be used
public static final Function<Calendar,String> toStr(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.
dateStyle
- the date style to be usedtimeStyle
- the time style to be usedlocale
- the locale to be used
public static final Function<Calendar,String> toStr(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.
dateStyle
- the date style to be usedtimeStyle
- the time style to be usedlocale
- the locale to be used
public static final Function<Timestamp,Calendar> timestampToCalendar()
Converts the target java.sql.Timestamp into a Calendar.
public static final Function<Timestamp,Calendar> timestampToCalendar(int truncateField)
Converts the target java.sql.Timestamp into a Calendar, truncating by the specified field (java.util.Calendar constant field).
public static final Function<Long,Calendar> timeInMillisToCalendar()
Converts the target Long (representing a time in milliseconds) into a Calendar.
public static final Function<Long,Calendar> timeInMillisToCalendar(int truncateField)
Converts the target Long (representing a time in milliseconds) into a Calendar, truncating by the specified field (java.util.Calendar constant field).
public static final Function<List<Integer>,Calendar> fieldIntegerListToCalendar()
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:
public static final Function<Integer[],Calendar> fieldIntegerArrayToCalendar()
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:
public static final Function<List<String>,Calendar> fieldStringListToCalendar()
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:
public static final Function<String[],Calendar> fieldStringArrayToCalendar()
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:
public static final Function<Object,Boolean> eq(Calendar object)
Determines whether the target object and the specified object are equal by calling the equals method on the target object.
object
- the object to compare to the target
public static final Function<Object,Boolean> notEq(Calendar object)
Determines whether the target object and the specified object are NOT equal by calling the equals method on the target object.
object
- the object to compare to the target
public static final Function<Object,Boolean> isNull()
Determines whether the target object is null or not.
public static final Function<Object,Boolean> isNotNull()
Determines whether the target object is null or not.
protected static Calendar fromInts(Integer year, Integer month, Integer day, Integer hour, Integer minute, Integer second, Integer milli) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |