Package freemarker.template
Interface TemplateDateModel
-
- All Superinterfaces:
TemplateModel
- All Known Implementing Classes:
SimpleDate
public interface TemplateDateModel extends TemplateModel
Date values in a template data model must implement this interface. Contrary to Java, FreeMarker actually distinguishes values that represent only a time, only a date, or a combined date and time. All three are represented using this single interface, however there's a method that
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface freemarker.template.TemplateModel
TemplateModel.InvalidExpressionModel, TemplateModel.JavaNull
-
-
Field Summary
Fields Modifier and Type Field Description static intDATEThe date model represents a date-only value.static intDATETIMEThe date model represents a datetime value.static intTIMEThe date model represents a time-only value.static ListTYPE_NAMESstatic intUNKNOWNIt is not known whether the date model represents a time-only, a date-only, or a datetime value.-
Fields inherited from interface freemarker.template.TemplateModel
INVALID_EXPRESSION, JAVA_NULL, NOTHING
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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 model represents a time-only, a date-only, or a datetime value.- See Also:
- Constant Field Values
-
TIME
static final int TIME
The date model represents a time-only value.- See Also:
- Constant Field Values
-
DATE
static final int DATE
The date model represents a date-only value.- See Also:
- Constant Field Values
-
DATETIME
static final int DATETIME
The date model represents a datetime value.- See Also:
- Constant Field Values
-
TYPE_NAMES
static final List TYPE_NAMES
-
-
Method Detail
-
getAsDate
Date getAsDate() throws TemplateModelException
Returns the date value. The return value must not be null.- Returns:
- the
Dateinstance associated with this date model. - Throws:
TemplateModelException
-
getDateType
int getDateType()
Returns the type of the date. It can be any of TIME, DATE, or DATETIME.
-
-