public class BetweenFormatter extends Object implements Serializable
BetweenFormatter.Level
不同,调用format()
方法后返回类似于:
Modifier and Type | Class and Description |
---|---|
static class |
BetweenFormatter.Level
格式化等级枚举
|
Constructor and Description |
---|
BetweenFormatter(long betweenMs,
BetweenFormatter.Level level)
构造
|
BetweenFormatter(long betweenMs,
BetweenFormatter.Level level,
int levelMaxCount)
构造
|
Modifier and Type | Method and Description |
---|---|
String |
format()
格式化日期间隔输出
|
long |
getBetweenMs()
获得 时长毫秒数
|
BetweenFormatter.Level |
getLevel()
获得 格式化级别
|
void |
setBetweenMs(long betweenMs)
设置 时长毫秒数
|
void |
setLevel(BetweenFormatter.Level level)
设置格式化级别
|
BetweenFormatter |
setLevelFormatter(Function<BetweenFormatter.Level,String> levelFormatter)
设置级别格式化器
|
BetweenFormatter |
setSeparator(String separator)
设置分隔符
|
String |
toString() |
public BetweenFormatter(long betweenMs, BetweenFormatter.Level level)
betweenMs
- 日期间隔level
- 级别,按照天、小时、分、秒、毫秒分为5个等级,根据传入等级,格式化到相应级别public BetweenFormatter(long betweenMs, BetweenFormatter.Level level, int levelMaxCount)
betweenMs
- 日期间隔level
- 级别,按照天、小时、分、秒、毫秒分为5个等级,根据传入等级,格式化到相应级别levelMaxCount
- 格式化级别的最大个数,假如级别个数为1,但是级别到秒,那只显示一个级别public String format()
public long getBetweenMs()
public void setBetweenMs(long betweenMs)
betweenMs
- 时长毫秒数public BetweenFormatter.Level getLevel()
public void setLevel(BetweenFormatter.Level level)
level
- 格式化级别public BetweenFormatter setLevelFormatter(Function<BetweenFormatter.Level,String> levelFormatter)
levelFormatter
- 级别格式化器public BetweenFormatter setSeparator(String separator)
separator
- 分割符Copyright © 2024. All rights reserved.