Class DateExpression
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.function.AbstractExpression
-
- org.pentaho.reporting.engine.classic.core.function.date.DateExpression
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Expression
- Direct Known Subclasses:
VariableDateExpression
public class DateExpression extends AbstractExpression
The DateExpression can be used to construct a static date object. The Calendar object used as base is initialized to the current date. Fields that are not set, are ignored. To construct dates from values read from the data-row, use theVariableDateExpression
instead.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DateExpression()
Default Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
configureCalendar(Calendar calendar)
Configures the given Calendar instance by applying all defined fields to it.protected Calendar
getCalendar()
Create a new calendar instance.Integer
getDay()
Returns the day property.Integer
getDayOfMonth()
Returns the day of the month property.Integer
getDayOfWeek()
Returns the day of the week property.Integer
getDayOfWeekInMonth()
Returns the day of the week in the month property.Integer
getDayOfYear()
Returns the day of the year property.Long
getEpochTime()
Returns the time in seconds since 01-Jan-1970.Integer
getHour()
Returns the hour of the day property.Integer
getMilliSecond()
Returns the milli-second property.Integer
getMinute()
Returns the minute property.Integer
getMonth()
Returns the month property.Integer
getSecond()
Returns the second property.Long
getTime()
Returns the time in milli-seconds since 01-Jan-1970.TimeZone
getTimeZone()
Returns the current time-zone.Object
getValue()
Return the current expression value.Integer
getWeekOfMonth()
Integer
getWeekOfYear()
Returns the week of the year property.Integer
getYear()
Returns the year property.void
setDay(Integer day)
Defines the day property.void
setDayOfMonth(Integer dayOfMonth)
Defines the day of the month property.void
setDayOfWeek(Integer dayOfWeek)
Defines the day of the week property.void
setDayOfWeekInMonth(Integer dayOfWeekInMonth)
Defines the day of the week in the month property.void
setDayOfYear(Integer dayOfYear)
Defines the day of the year property.void
setEpochTime(Long epochTime)
Defines the time in seconds since 01-Jan-1970.void
setHour(Integer hour)
Defines the hour property.void
setMilliSecond(Integer milliSecond)
Defines the year property.void
setMinute(Integer minute)
Defines the minute property.void
setMonth(Integer month)
Defines the month property.void
setSecond(Integer second)
Defines the second property.void
setTime(Long time)
Defines the time in milli-seconds since 01-Jan-1970.void
setTimeZone(TimeZone timeZone)
Defines the timezone.void
setWeekOfMonth(Integer weekOfMonth)
void
setWeekOfYear(Integer weekOfYear)
Defines the week of the year property.void
setYear(Integer year)
Defines the year property.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
clone, getDataRow, getDependencyLevel, getInstance, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setActive, setDependencyLevel, setName, setPreserve, setRuntime
-
-
-
-
Method Detail
-
getTimeZone
public TimeZone getTimeZone()
Returns the current time-zone.- Returns:
- the time-zone or null, if none is set.
-
setTimeZone
public void setTimeZone(TimeZone timeZone)
Defines the timezone. If none is defined here, the locale's default timezone is used instead.- Parameters:
timeZone
- the time-zone.
-
getMonth
public Integer getMonth()
Returns the month property.- Returns:
- the month property.
-
setMonth
public void setMonth(Integer month)
Defines the month property.- Parameters:
month
- the month property.
-
getDay
public Integer getDay()
Returns the day property. This returns the day within the current month.- Returns:
- the day of the month property.
-
setDay
public void setDay(Integer day)
Defines the day property. This defines the day within the current month.- Parameters:
day
- the day of the month property.
-
getYear
public Integer getYear()
Returns the year property.- Returns:
- the year property.
-
setYear
public void setYear(Integer year)
Defines the year property.- Parameters:
year
- the year property.
-
getHour
public Integer getHour()
Returns the hour of the day property. This uses the 24-hour system.- Returns:
- the hour property.
-
setHour
public void setHour(Integer hour)
Defines the hour property. This uses the 24-hour system- Parameters:
hour
- the hour property.
-
getMinute
public Integer getMinute()
Returns the minute property.- Returns:
- the minute property.
-
setMinute
public void setMinute(Integer minute)
Defines the minute property.- Parameters:
minute
- the minute property.
-
getSecond
public Integer getSecond()
Returns the second property.- Returns:
- the second property.
-
setSecond
public void setSecond(Integer second)
Defines the second property.- Parameters:
second
- the second property.
-
getMilliSecond
public Integer getMilliSecond()
Returns the milli-second property.- Returns:
- the milli-second property.
-
setMilliSecond
public void setMilliSecond(Integer milliSecond)
Defines the year property.- Parameters:
milliSecond
- the milli-seconds property.
-
getTime
public Long getTime()
Returns the time in milli-seconds since 01-Jan-1970.- Returns:
- the time in milli-seconds since 01-Jan-1970.
-
setTime
public void setTime(Long time)
Defines the time in milli-seconds since 01-Jan-1970.- Parameters:
time
- the time in milli-seconds since 01-Jan-1970.
-
getEpochTime
public Long getEpochTime()
Returns the time in seconds since 01-Jan-1970.- Returns:
- the time in seconds since 01-Jan-1970.
-
setEpochTime
public void setEpochTime(Long epochTime)
Defines the time in seconds since 01-Jan-1970.- Parameters:
epochTime
- the time in seconds since 01-Jan-1970.
-
getDayOfWeek
public Integer getDayOfWeek()
Returns the day of the week property.- Returns:
- the day-of-the-week property.
-
setDayOfWeek
public void setDayOfWeek(Integer dayOfWeek)
Defines the day of the week property.- Parameters:
dayOfWeek
- the day-of-the-week property.
-
getDayOfYear
public Integer getDayOfYear()
Returns the day of the year property.- Returns:
- the day-of-the-year property.
-
setDayOfYear
public void setDayOfYear(Integer dayOfYear)
Defines the day of the year property.- Parameters:
dayOfYear
- the day-of-the-year property.
-
getDayOfMonth
public Integer getDayOfMonth()
Returns the day of the month property.- Returns:
- the day-of-the-month property.
-
setDayOfMonth
public void setDayOfMonth(Integer dayOfMonth)
Defines the day of the month property.- Parameters:
dayOfMonth
- the day-of-the-month property.
-
getDayOfWeekInMonth
public Integer getDayOfWeekInMonth()
Returns the day of the week in the month property.- Returns:
- the day of the week in the month property.
-
setDayOfWeekInMonth
public void setDayOfWeekInMonth(Integer dayOfWeekInMonth)
Defines the day of the week in the month property.- Parameters:
dayOfWeekInMonth
- the day of the week in the month property.
-
getWeekOfYear
public Integer getWeekOfYear()
Returns the week of the year property.- Returns:
- the week of the year property.
-
setWeekOfYear
public void setWeekOfYear(Integer weekOfYear)
Defines the week of the year property.- Parameters:
weekOfYear
- the week of the year property.
-
getWeekOfMonth
public Integer getWeekOfMonth()
-
setWeekOfMonth
public void setWeekOfMonth(Integer weekOfMonth)
-
getValue
public Object getValue()
Return the current expression value.The value depends (obviously) on the expression implementation.
- Returns:
- the value of the function.
-
configureCalendar
protected void configureCalendar(Calendar calendar)
Configures the given Calendar instance by applying all defined fields to it.- Parameters:
calendar
- the week of the year property.
-
getCalendar
protected Calendar getCalendar()
Create a new calendar instance. This implementation uses Calendar.getInstance(..) to create the Calendar, and therefore the result depends on the locale of the report.- Returns:
- the calendar.
-
-