Package freemarker.template
Class SimpleDate
- java.lang.Object
-
- freemarker.template.SimpleDate
-
- All Implemented Interfaces:
TemplateDateModel,TemplateModel
public class SimpleDate extends java.lang.Object implements TemplateDateModel
A simple implementation of the TemplateDateModel interface. Note that this class is immutable.This class is thread-safe.
-
-
Field Summary
-
Fields inherited from interface freemarker.template.TemplateDateModel
DATE, DATETIME, TIME, TYPE_NAMES, UNKNOWN
-
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
-
-
Constructor Summary
Constructors Constructor Description SimpleDate(java.sql.Date date)Creates a new date model wrapping the specified date object and having DATE type.SimpleDate(java.sql.Time time)Creates a new date model wrapping the specified time object and having TIME type.SimpleDate(java.sql.Timestamp datetime)Creates a new date model wrapping the specified time object and having DATETIME type.SimpleDate(java.util.Date date, int type)Creates a new date model wrapping the specified date object and having the specified type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.DategetAsDate()Returns the date value.intgetDateType()Returns the type of the date.java.lang.StringtoString()
-
-
-
Constructor Detail
-
SimpleDate
public SimpleDate(java.sql.Date date)
Creates a new date model wrapping the specified date object and having DATE type.
-
SimpleDate
public SimpleDate(java.sql.Time time)
Creates a new date model wrapping the specified time object and having TIME type.
-
SimpleDate
public SimpleDate(java.sql.Timestamp datetime)
Creates a new date model wrapping the specified time object and having DATETIME type.
-
SimpleDate
public SimpleDate(java.util.Date date, int type)Creates a new date model wrapping the specified date object and having the specified type.
-
-
Method Detail
-
getAsDate
public java.util.Date getAsDate()
Description copied from interface:TemplateDateModelReturns the date value. The return value must not benull.- Specified by:
getAsDatein interfaceTemplateDateModel
-
getDateType
public int getDateType()
Description copied from interface:TemplateDateModelReturns the type of the date. It can be any ofTemplateDateModel.TIME,TemplateDateModel.DATE, orTemplateDateModel.DATETIME.- Specified by:
getDateTypein interfaceTemplateDateModel
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-