Package freemarker.template
Interface TemplateDateModel
-
- All Superinterfaces:
TemplateModel
- All Known Implementing Classes:
DateModel,SimpleDate
public interface TemplateDateModel extends TemplateModel
"date", "time" and "date-time" template language data types: corresponds toDate. Contrary to Java, FreeMarker distinguishes date (no time part), time and date-time values.Objects of this type should be immutable, that is, calling
getAsDate()andgetDateType()should always return the same value as for the first time.
-
-
Field Summary
Fields Modifier and Type Field Description static intDATEThe date model represents a date value (no time part).static intDATETIMEThe date model represents a date-time value (also known as timestamp).static intTIMEThe date model represents a time value (no date part).static java.util.ListTYPE_NAMESstatic intUNKNOWNIt is not known whether the date represents a date, a time, or a date-time value.-
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.DategetAsDate()Returns the date value.intgetDateType()Returns the type of the date.
-
-
-
Field Detail
-
UNKNOWN
static final int UNKNOWN
It is not known whether the date represents a date, a time, or a date-time value. This often leads to exceptions in templates due to ambiguities it causes, so avoid it if possible.- See Also:
- Constant Field Values
-
TIME
static final int TIME
The date model represents a time value (no date part).- See Also:
- Constant Field Values
-
DATE
static final int DATE
The date model represents a date value (no time part).- See Also:
- Constant Field Values
-
DATETIME
static final int DATETIME
The date model represents a date-time value (also known as timestamp).- See Also:
- Constant Field Values
-
TYPE_NAMES
static final java.util.List TYPE_NAMES
-
-
Method Detail
-
getAsDate
java.util.Date getAsDate() throws TemplateModelExceptionReturns the date value. The return value must not benull.- Throws:
TemplateModelException
-
getDateType
int getDateType()
-
-