public class BooleanConverter extends AbstractConverter<Boolean>
对象转为boolean,规则如下:
1、数字0为false,其它数字为true 2、转换为字符串,形如"true", "yes", "y", "t", "ok", "1", "on", "是", "对", "真", "對", "√"为true,其它字符串为false.
Constructor and Description |
---|
BooleanConverter() |
Modifier and Type | Method and Description |
---|---|
protected Boolean |
convertInternal(Object value)
内部转换器,被
AbstractConverter.convert(Object, Object) 调用,实现基本转换逻辑内部转换器转换后如果转换失败可以做如下操作,处理结果都为返回默认值: 1、返回 null
2、抛出一个RuntimeException 异常
|
convert, convertQuietly, convertToStr, getTargetType
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
convertWithCheck
protected Boolean convertInternal(Object value)
AbstractConverter
AbstractConverter.convert(Object, Object)
调用,实现基本转换逻辑1、返回null
2、抛出一个RuntimeException
异常
convertInternal
in class AbstractConverter<Boolean>
value
- 值Copyright © 2024. All rights reserved.