public class TemporalAccessorConverter extends AbstractConverter
java.time.Instant java.time.LocalDateTime java.time.LocalDate java.time.LocalTime java.time.ZonedDateTime java.time.OffsetDateTime java.time.OffsetTime
Modifier and Type | Field and Description |
---|---|
static TemporalAccessorConverter |
INSTANCE
单例
|
Constructor and Description |
---|
TemporalAccessorConverter()
构造
|
TemporalAccessorConverter(String format)
构造
|
Modifier and Type | Method and Description |
---|---|
protected TemporalAccessor |
convertInternal(Class<?> targetClass,
Object value)
内部转换器,被
AbstractConverter.convert(Type, Object) 调用,实现基本转换逻辑内部转换器转换后如果转换失败可以做如下操作,处理结果都为返回默认值: 1、返回 null
2、抛出一个RuntimeException 异常
|
String |
getFormat()
获取日期格式
|
void |
setFormat(String format)
设置日期格式
|
convert, convertToStr
public static final TemporalAccessorConverter INSTANCE
public TemporalAccessorConverter()
public TemporalAccessorConverter(String format)
format
- 日期格式public String getFormat()
public void setFormat(String format)
format
- 日期格式protected TemporalAccessor convertInternal(Class<?> targetClass, Object value)
AbstractConverter
AbstractConverter.convert(Type, Object)
调用,实现基本转换逻辑1、返回null
2、抛出一个RuntimeException
异常
convertInternal
in class AbstractConverter
targetClass
- 目标类型value
- 值Copyright © 2025. All rights reserved.