Package org.dashbuilder.dataset.date
Class TimeInstant
- java.lang.Object
-
- org.dashbuilder.dataset.date.TimeInstant
-
public class TimeInstant extends Object
This class is used to represent a given time instant relative to the current time.Some examples of time instants are:
- now
- now -10second or just -10second
- begin[minute] => begin of current minute. It turns back the clock to first second.
- begin[year March] => begin of current year (year starting on March)
- end[year March] +1year => end of next year (year starting on March)
- begin[year March] -7day => last year's last week start
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTimeInstant.TimeMode
-
Field Summary
Fields Modifier and Type Field Description static DateSTART_TIME
-
Constructor Summary
Constructors Constructor Description TimeInstant()TimeInstant(TimeInstant.TimeMode timeMode, DateIntervalType intervalType, Month firstMonthOfYear, TimeAmount timeAmount)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DatecalculateStartTime()TimeInstantcloneInstance()MonthgetFirstMonthOfYear()DateIntervalTypegetIntervalType()DategetStartTime()TimeAmountgetTimeAmount()DategetTimeInstant()TimeInstant.TimeModegetTimeMode()static TimeInstantnow()Return a time instant representing the current time.static TimeInstantparse(String timeInstantExpr)Parses a time instant expression.voidsetFirstMonthOfYear(Month firstMonthOfYear)voidsetIntervalType(DateIntervalType intervalType)voidsetStartTime(Date now)voidsetTimeAmount(TimeAmount timeAmount)voidsetTimeMode(TimeInstant.TimeMode timeMode)StringtoString()
-
-
-
Field Detail
-
START_TIME
public static Date START_TIME
-
-
Constructor Detail
-
TimeInstant
public TimeInstant()
-
TimeInstant
public TimeInstant(TimeInstant.TimeMode timeMode, DateIntervalType intervalType, Month firstMonthOfYear, TimeAmount timeAmount)
-
-
Method Detail
-
getTimeMode
public TimeInstant.TimeMode getTimeMode()
-
setTimeMode
public void setTimeMode(TimeInstant.TimeMode timeMode)
-
getIntervalType
public DateIntervalType getIntervalType()
-
setIntervalType
public void setIntervalType(DateIntervalType intervalType)
-
getFirstMonthOfYear
public Month getFirstMonthOfYear()
-
setFirstMonthOfYear
public void setFirstMonthOfYear(Month firstMonthOfYear)
-
getTimeAmount
public TimeAmount getTimeAmount()
-
setTimeAmount
public void setTimeAmount(TimeAmount timeAmount)
-
cloneInstance
public TimeInstant cloneInstance()
-
getTimeInstant
public Date getTimeInstant()
-
setStartTime
public void setStartTime(Date now)
-
getStartTime
public Date getStartTime()
-
calculateStartTime
protected Date calculateStartTime()
-
now
public static TimeInstant now()
Return a time instant representing the current time.
-
parse
public static TimeInstant parse(String timeInstantExpr)
Parses a time instant expression.- Parameters:
timeInstantExpr- A valid time instant expression (see TimeInstant class javadoc)- Returns:
- A TimeInstant instance
- Throws:
IllegalArgumentException- If the expression is not valid
-
-