|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.op4j.functions.FnDate
public final class FnDate
Method Summary | |
---|---|
static Function<Date,Date> |
add(int calendarField,
int amount)
Modifies a Date by adding a positive or negative amount to one of its fields. |
static Function<Date,Date> |
addDays(int amount)
Modifies a Date by adding a positive or negative amount to one the "day" property (java.util.Calendar.DATE). |
static Function<Date,Date> |
addHours(int amount)
Modifies a Date by adding a positive or negative amount to one the "hour" property (java.util.Calendar.HOUR). |
static Function<Date,Date> |
addMilliseconds(int amount)
Modifies a Date by adding a positive or negative amount to one the "millisecond" property (java.util.Calendar.MILLISECOND). |
static Function<Date,Date> |
addMinutes(int amount)
Modifies a Date by adding a positive or negative amount to one the "minutes" property (java.util.Calendar.MINUTES). |
static Function<Date,Date> |
addMonths(int amount)
Modifies a Date by adding a positive or negative amount to one the "month" property (java.util.Calendar.MONTH). |
static Function<Date,Date> |
addWeeks(int amount)
Modifies a Date by adding a positive or negative amount to one the "week" property (java.util.Calendar.WEEK). |
static Function<Date,Date> |
addYears(int amount)
Modifies a Date by adding a positive or negative amount to one the "year" property (java.util.Calendar.YEAR). |
static Function<Date,Boolean> |
after(Date date)
Determines whether the target Date represents a moment in time after the Date specified as a parameter. |
static Function<Date,Boolean> |
before(Date date)
Determines whether the target Date represents a moment in time before the Date specified as a parameter. |
static Function<Object,Boolean> |
eq(Date object)
Determines whether the target object and the specified object are equal by calling the equals method on the target object. |
static Function<Integer[],Date> |
fieldIntegerArrayToDate()
Converts an Integer[] containing the components of a date to a java.util.Date object. |
static Function<List<Integer>,Date> |
fieldIntegerListToDate()
Converts a List<Integer> containing the components of a date to a java.util.Date object. |
static Function<String[],Date> |
fieldStringArrayToDate()
Converts a String[] containing the components of a date to a java.util.Date object. |
static Function<List<String>,Date> |
fieldStringListToDate()
Converts a List<String> containing the components of a date to a java.util.Date object. |
protected static Date |
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(Date object)
Determines whether the target object and the specified object are NOT equal by calling the equals method on the target object. |
static Function<Date,Date> |
round(int calendarField)
Rounds the target Date, setting the specified field as the most significant field. |
static Function<Date,Date> |
set(int calendarField,
int value)
Modifies a Date by setting one of its to the specified value. |
static Function<Date,Date> |
setDay(int value)
Modifies a Date by setting the "day" property (java.util.Calendar.DATE) to the specified value. |
static Function<Date,Date> |
setHour(int value)
Modifies a Date by setting the "hour" property (java.util.Calendar.HOUR) to the specified value. |
static Function<Date,Date> |
setMillisecond(int value)
Modifies a Date by setting the "millisecond" property (java.util.Calendar.MILLISECOND) to the specified value. |
static Function<Date,Date> |
setMinute(int value)
Modifies a Date by setting the "minute" property (java.util.Calendar.MINUTE) to the specified value. |
static Function<Date,Date> |
setMonth(int value)
Modifies a Date by setting the "month" property (java.util.Calendar.MONTH) to the specified value. |
static Function<Date,Date> |
setWeek(int value)
Modifies a Date by setting the "week" property (java.util.Calendar.WEEK_OF_YEAR) to the specified value. |
static Function<Date,Date> |
setYear(int value)
Modifies a Date by setting the "year" property (java.util.Calendar.YEAR) to the specified value. |
static Function<Long,Date> |
timeInMillisToDate()
Converts the target Long (representing a time in milliseconds) into a Date. |
static Function<Long,Date> |
timeInMillisToDate(int truncateField)
Converts the target Long (representing a time in milliseconds) into a Date, truncating by the specified field (java.util.Calendar constant field). |
static Function<Timestamp,Date> |
timestampToDate()
Converts the target java.sql.Timestamp into a Date. |
static Function<Timestamp,Date> |
timestampToDate(int truncateField)
Converts the target java.sql.Timestamp into a Date, truncating by the specified field (java.util.Calendar constant field). |
static Function<Date,Calendar> |
toCalendar()
|
static Function<Date,Calendar> |
toCalendar(int truncateField)
|
static Function<Date,String> |
toStr(DateStyle dateStyle,
TimeStyle timeStyle)
Converts the target Date into a String using the specified date ( DateStyle )
and time (TimeStyle ) styles. |
static Function<Date,String> |
toStr(DateStyle dateStyle,
TimeStyle timeStyle,
Locale locale)
Converts the target Date 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<Date,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<Date,String> |
toStr(String pattern)
Converts the target Date into a String using the specified pattern. |
static Function<Date,String> |
toStr(String pattern,
Locale locale)
Converts the target Date into a String using the specified pattern. |
static Function<Date,String> |
toStr(String pattern,
String locale)
Converts the target Date into a String using the specified pattern. |
static Function<Date,Date> |
truncate(int calendarField)
Truncates the target Date, 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<Date,Calendar> toCalendar()
public static final Function<Date,Calendar> toCalendar(int truncateField)
public static final Function<Date,Date> add(int calendarField, int amount)
Modifies a Date by adding a positive or negative amount to one of its fields.
Fields are specified by means of java.util.Calendar constants, like FnDate.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<Date,Date> addDays(int amount)
Modifies a Date 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<Date,Date> addHours(int amount)
Modifies a Date 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<Date,Date> addMilliseconds(int amount)
Modifies a Date 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<Date,Date> addMinutes(int amount)
Modifies a Date by adding a positive or negative amount to one the "minutes" property (java.util.Calendar.MINUTES).
amount
- the positive or negative amount to be added
public static final Function<Date,Date> addMonths(int amount)
Modifies a Date 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<Date,Date> addWeeks(int amount)
Modifies a Date by adding a positive or negative amount to one the "week" property (java.util.Calendar.WEEK).
amount
- the positive or negative amount to be added
public static final Function<Date,Date> addYears(int amount)
Modifies a Date 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<Date,Date> set(int calendarField, int value)
Modifies a Date by setting one of its to the specified value.
Fields are specified by means of java.util.Calendar constants, like FnDate.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<Date,Date> setDay(int value)
Modifies a Date by setting the "day" property (java.util.Calendar.DATE) to the specified value.
value
- the new value for the property
public static final Function<Date,Date> setHour(int value)
Modifies a Date by setting the "hour" property (java.util.Calendar.HOUR) to the specified value.
value
- the new value for the property
public static final Function<Date,Date> setMillisecond(int value)
Modifies a Date by setting the "millisecond" property (java.util.Calendar.MILLISECOND) to the specified value.
value
- the new value for the property
public static final Function<Date,Date> setMinute(int value)
Modifies a Date by setting the "minute" property (java.util.Calendar.MINUTE) to the specified value.
value
- the new value for the property
public static final Function<Date,Date> setMonth(int value)
Modifies a Date by setting the "month" property (java.util.Calendar.MONTH) to the specified value.
value
- the new value for the property
public static final Function<Date,Date> setWeek(int value)
Modifies a Date 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<Date,Date> setYear(int value)
Modifies a Date by setting the "year" property (java.util.Calendar.YEAR) to the specified value.
value
- the new value for the property
public static final Function<Date,Date> round(int calendarField)
Rounds the target Date, setting the specified field as the most significant field.
Based on org.apache.commons.lang.time.DateUtils.round().
calendarField
- the field on which the Date will be rounded (java.util.Calendar field).
public static final Function<Date,Date> truncate(int calendarField)
Truncates the target Date, setting the specified field as the most significant field.
Based on org.apache.commons.lang.time.DateUtils.truncate().
calendarField
- the field on which the Date will be truncated (java.util.Calendar field).
public static final Function<Date,Boolean> before(Date date)
Determines whether the target Date represents a moment in time before the Date specified as a parameter.
date
- the date to compare to
public static final Function<Date,Boolean> after(Date date)
Determines whether the target Date represents a moment in time after the Date specified as a parameter.
date
- the date to compare to
public static final Function<Date,String> toStr(String pattern)
Converts the target Date 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<Date,String> toStr(String pattern, Locale locale)
Converts the target Date 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<Date,String> toStr(String pattern, String locale)
Converts the target Date 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<Date,String> toStr(DateStyle dateStyle, TimeStyle timeStyle)
Converts the target Date 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<Date,String> toStr(DateStyle dateStyle, TimeStyle timeStyle, Locale locale)
Converts the target Date 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<Date,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,Date> timestampToDate()
Converts the target java.sql.Timestamp into a Date.
public static final Function<Timestamp,Date> timestampToDate(int truncateField)
Converts the target java.sql.Timestamp into a Date, truncating by the specified field (java.util.Calendar constant field).
public static final Function<Long,Date> timeInMillisToDate()
Converts the target Long (representing a time in milliseconds) into a Date.
public static final Function<Long,Date> timeInMillisToDate(int truncateField)
Converts the target Long (representing a time in milliseconds) into a Date, truncating by the specified field (java.util.Calendar constant field).
public static final Function<List<Integer>,Date> fieldIntegerListToDate()
Converts a List<Integer> containing the components of a date to a java.util.Date object.
The target list can contain the following combinations of elements, in the specified order:
public static final Function<Integer[],Date> fieldIntegerArrayToDate()
Converts an Integer[] containing the components of a date to a java.util.Date object.
The target array can contain the following combinations of elements, in the specified order:
public static final Function<List<String>,Date> fieldStringListToDate()
Converts a List<String> containing the components of a date to a java.util.Date 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[],Date> fieldStringArrayToDate()
Converts a String[] containing the components of a date to a java.util.Date 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(Date 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(Date 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 Date 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 |