类 ComparisonDateTool.Comparison
java.lang.Object
org.apache.velocity.tools.generic.ComparisonDateTool.Comparison
- 封闭类:
- ComparisonDateTool
-
字段概要
字段修饰符和类型字段说明private final boolean
private final Locale
private final int
private final long
private final int
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明abbr
(boolean abbr) Sets whether or not this comparison is to be rendered in abbreviated form or not.depth
(int depth) Set the maximum number of units to render for this comparison.getAbbr()
This is equivalent to callingabbr(boolean abbr)
withtrue
as the argument, thus setting this comparison to be rendered in abbreviated form.long
getDays()
Return the number of days between the dates being compared.Sets this comparison to be rendered as aComparisonDateTool.difference(java.lang.Object, java.lang.Object)
.getFull()
Sets thedepth(int depth)
to which this comparison is rendered to the maximum number of time units available to the tool.long
getHours()
Return the number of hours between the dates being compared.long
Return the number of milliseconds between the dates being compared.long
Return the number of minutes between the dates being compared.long
Return the approximate number of months between the dates being compared.Sets this comparison to be rendered as if it where generated using theComparisonDateTool.whenIs(Object now, Object then)
method.long
Return the number of seconds between the dates being compared.long
getWeeks()
Return the number of weeks between the dates being compared.long
getYears()
Return the approximate number of years between the dates being compared.Sets the locale used to look up the textual portions of the rendering.toString()
Renders this comparison to a String.
-
字段详细资料
-
milliseconds
private final long milliseconds -
type
private final int type -
maxUnitDepth
private final int maxUnitDepth -
abbreviate
private final boolean abbreviate -
locale
-
-
构造器详细资料
-
Comparison
-
-
方法详细资料
-
abbr
Sets whether or not this comparison is to be rendered in abbreviated form or not. By default, it is not abbreviated. -
depth
Set the maximum number of units to render for this comparison. By default, this is set to 1 unit. -
locale
Sets the locale used to look up the textual portions of the rendering. This defaults to the Locale configured for this tool, if any. If no locale was configured, this defaults to the system default. -
getYears
public long getYears()Return the approximate number of years between the dates being compared. -
getMonths
public long getMonths()Return the approximate number of months between the dates being compared. -
getWeeks
public long getWeeks()Return the number of weeks between the dates being compared. -
getDays
public long getDays()Return the number of days between the dates being compared. -
getHours
public long getHours()Return the number of hours between the dates being compared. -
getMinutes
public long getMinutes()Return the number of minutes between the dates being compared. -
getSeconds
public long getSeconds()Return the number of seconds between the dates being compared. -
getMilliseconds
public long getMilliseconds()Return the number of milliseconds between the dates being compared. -
getFull
Sets thedepth(int depth)
to which this comparison is rendered to the maximum number of time units available to the tool. By default, there are 8 units available, but the tool may be configured to "skip" any of the standard units, thus shortening the maximum depth. -
getDifference
Sets this comparison to be rendered as aComparisonDateTool.difference(java.lang.Object, java.lang.Object)
. This effectively means that the comparison will render as a period of time, without any suffix to describe the relative position of the dates being compared (e.g. "later" or "ago"). -
getRelative
Sets this comparison to be rendered as if it where generated using theComparisonDateTool.whenIs(Object now, Object then)
method. This effectively means that the comparison will render with a suffix to describe the relative position of the dates being compared (e.g. "later" or "ago"). -
getAbbr
This is equivalent to callingabbr(boolean abbr)
withtrue
as the argument, thus setting this comparison to be rendered in abbreviated form. -
toString
Renders this comparison to a String.
-