public class BeanValueProvider extends Object implements ValueProvider<String>
Constructor and Description |
---|
BeanValueProvider(Object bean,
boolean ignoreCase,
boolean ignoreError)
构造
|
BeanValueProvider(Object bean,
boolean ignoreCase,
boolean ignoreError,
Editor<String> keyEditor)
构造
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String key)
是否包含指定KEY,如果不包含则忽略注入
此接口方法单独需要实现的意义在于:有些值提供者(比如Map)key是存在的,但是value为null,此时如果需要注入这个null,需要根据此方法判断 |
Object |
value(String key,
Type valueType)
获取值
返回值一般需要匹配被注入类型,如果不匹配会调用默认转换 Convert#convert(Type, Object)实现转换 |
public BeanValueProvider(Object bean, boolean ignoreCase, boolean ignoreError)
bean
- BeanignoreCase
- 是否忽略字段大小写ignoreError
- 是否忽略字段值读取错误public Object value(String key, Type valueType)
ValueProvider
value
in interface ValueProvider<String>
key
- Bean对象中参数名valueType
- 被注入的值的类型public boolean containsKey(String key)
ValueProvider
containsKey
in interface ValueProvider<String>
key
- Bean对象中参数名Copyright © 2024. All rights reserved.